Skip to main content

Dalma to automate java.net project approval process

Posted by kohsuke on February 14, 2006 at 11:21 PM PST

I posted another version of Dalma, a continuation-based workflow engine.
I've been using this to develop a project approval automation system for java.net, and this is mostly a bug fix release to fix issues I found during this process. It's always good to eat your own dogfood, I guess.

One nifty feature that I implemented was the "try again" feature. When your code is doing something as a part of the workflow, and if it fails, you often just want to retry it later. In my project automation case, if the system fails to access the java.net website for some reason, I just want to wait for, say, an hour and try it again. With Dalma, you can write it as:

// wait for an e-mail reply to tell me what to do with this project?
reply = waitForReply(...);

try {
  goToJavaNetAndDoSomeWork();
} catch(IOException e) {
  // network error. probably java.net is down.
  // retry it one hour later, up to 24 times.
  Fiber.again(1,HOURS,7);
 
  // if we still fail after one day,
  // abort
  throw e;
}

When the execution hits Fiber.again, the workflow suspends for one hour. When it resumes, it resumes at the last blocking method (which is waitForReply.) If the specified retry count is reached, Fiber.again becomes no-op.

This allows you to write a retry as a simple try/catch block, not a loop, which helps improve the readability of the code, I think.

A bit about java.net project approval process. When you request a new project on java.net, currently real people are handling those requests manually. A request goes to Eric, who acts as the domain administrator. He checks the form you entered and dispatch that to the appropriate community leads, then those community leads accept projects to their community. Sometimes they don't agree with Eric, so projects get routed back to another community.

This whole process involves a lot of sending e-mails and accessing java.net through a web browser, and given the pace that new projects are coming in, this is starting to become a lot of work. And besides, humans are tend to be slower than computers, so this tends to increase the delay between when you submit a project and when it gets approved.

Hopefully dalma based automated system can make this situation better.

Related Topics >>