[Zope-dev] Scheduler product, anyone?

Stuart 'Zen' Bishop zen@cs.rmit.edu.au
Sun, 6 Feb 2000 14:30:14 +1100 (EST)


On Fri, 4 Feb 2000, Loren Stafford wrote:

> What I have in mind is a product that includes a schedule data structure
> containing tuples of (date/time, method to call), a Dispatcher method, and a
> Scheduler method:
> 
> 1. Cron runs a Dispatcher method via RPC.
> 
> 2. Dispatcher looks in schedule table, finds next scheduled method in table,
> and runs it as a separate transaction (could use RPC), and removes the entry
> from the table.

It may be possible to do this from within Zope and not involve cron
at all. Your Scheduler product could fire off a seperate thread
when its package is first loaded. Has the advantages of only attempting
calls when Zope is running, and being platform independant.

> 3. Schedule-aware objects can use the Scheduler method to schedule one of
> their methods for execution at a given time. The schedule-aware object would
> specify the URL of scheduled method. Simple RPC would be the default.
> XML-RPC would be possible (but as I have no need for it I probably would
> leave a hook to extend the product). Repetitive tasks can reschedule
> themselves each time they are called.

Why the requirement for being schedule-aware? I personally would
want an interface that could be used from arbitrary DTML, external
methods or python methods using aquisition:
    <dtml-comment>Assumes an object with Id 'Schedule'</dtml-comment>
    <dtml-call "Schedule(myMethod.absolute_url(),ZopeTime() + 60)">

If an Id is returned from the Schedule(...) call, it would be possible
to unschedule as well.

-- 
 ___
   //     Zen (alias Stuart Bishop)     Work: zen@cs.rmit.edu.au
  // E N  Senior Systems Alchemist      Play: zen@shangri-la.dropbear.id.au
 //__     Computer Science, RMIT 	 WWW: http://www.cs.rmit.edu.au/~zen