[Zope] Best Event system for Zope?

Terry Hancock hancock at anansispaceworks.com
Thu Feb 19 13:26:48 EST 2004


On Thursday 19 February 2004 07:25 am, Etienne Labuschagne wrote:
> I have mostly figured out the event system by now, but cannot figure out 
> how to get the scheduler to fire scheduled tasks by itself.  Isn't the 
> scheduler supposed to fire off scheduled tasks once their next scheduled 
> time comes up?  The only time when mine fires up tasks is when I trigger it 
> manually from the ZMI.

My initial experiments with Zope event systems like Xron was not that
promising, and I realized it doesn't matter that much.

I solved the problem by creating a "heartbeat" method in the object
that is supposed to be triggered by an XML-RPC call.  It's a very
quick method that checks to see if sufficient time has elapsed (or
whatever criteria you want to use) to decide if it needs to run
scheduled events.

Then it's trivial to set up a system on the server to fire that heartbeat
method periodically.  I'll attach a sample heartbeat script which I
wrote for that purpose (probably needs to be cleaned up to work
for other people, though).  This is only if you need quite frequent 
heartbeats (which corresponds to more precise timing or more
frequent events).  For heartbeats of less than once a minute, it'd
probably be more reliable to set up a regular cron job.

This is great, easy to test both the heartbeat method and the
heartbeat generator, and does the job.

Cheers,
Terry


--
Terry Hancock ( hancock at anansispaceworks.com )
Anansi Spaceworks  http://www.anansispaceworks.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: heartbeat.py
Type: text/x-java
Size: 2350 bytes
Desc: not available
Url : http://mail.zope.org/pipermail/zope/attachments/20040219/32172a45/heartbeat.bin


More information about the Zope mailing list