[Zope-CMF] [DCWorkflow] active workflows
fg at nuxeo.com
Fri Jan 7 09:57:28 EST 2005
Dieter Maurer <dieter at handshake.de> wrote:
> I have a need for "active" workflows, i.e. workflows where transitions
> can happen automatically after some time has expired.
> I plan to extend DCWorkflow to support this.
> Currently, my concept looks like this:
> States are extended by optional scripts "script_on_entry"
> and "script_on_exit".
> If defined, "script_on_entry" is executed when a transition
> enters the state (after the transition's 'script_after').
> If defined, "script_on_exit" is executed when a transition
> leaves the state (before the transition's 'script_before').
> I plan to use this extension as follows to implement an
> "active" state:
> Such a state has
> * variables "initial_delay" and "repeated_delay",
> * a special transition "probe" that remains in state and
> has a "script_before" "reschedule"
> * a "script_on_entry" "schedule" and a "script_on_exit"
> * at least one automatic transition that can leave the state
> The "*schedule" scripts use a scheduling service to
> schedule the "probe" transition after
> "initial_delay" (for 'schedule') and 'repeated_delay' (for 'reschedule').
> 'unschedule' cancels the scheduling request.
> The scheduling service calls "probe" at the given time.
> This reschedules and then checks for automatic
> transitions. If one is electable and leaves the state,
> the schedule request is canceled.
> What do you think about this approach?
Do you really perform a transition every time the object is probed ?
This will have the side effect of writing a new status and thus
modifying the object, which in itself is bad, and also doesn't scale if
you have thousands of objects that are probed once in a while.
It seems to me that you're implementing a much more general framework
than your immediate need. I'd simply store an additional variable on the
state, like 'expire_after', and have a catalog search that gets all the
objects to expire.
> Is the DCWorkflow extension interesting enough to become
> part of the official sources?
Well it seems a bit overengineered to me at that point.
Florent Guillaume, Nuxeo (Paris, France) CTO, Director of R&D
+33 1 40 33 71 59 http://nuxeo.com fg at nuxeo.com
More information about the Zope-CMF