[Zope] XRON enhancement suggestion

Loren Stafford lstafford@morphics.com
Thu, 9 Aug 2001 14:25:46 -0700


Xron is designed so that rescheduling behavior can be tailored to different
applications by subclassing and providing a new "reschedule" method for the
class. A custom reschedule method could even make your Ebay application "go
to sleep" at night automatically so that you would not have to remember to
shut down Zope. It would simply not schedule any events for nighttime
execution. Some pseudocode:

   Add 30 min to current time, giving new time.
   If new time is after bedtime, set new time to wakeup time.
   Reschedule for new time.

You can program this in DTML, if you want.

I remember that you (Alan) are not into programming, but perhaps you could
get someone else to do it for you. (Any volunteers?) I do not have time to
code and test it myself. OK! OK! Here's some untested DTML off the top of my
head. Put this code in a DTML method called "reschedule" in a ZClass that
inherits from 'Xron DTML Method'.  Add DateTime properties to the subclass
with the names bedTime, wakeupTime; periodDays is already the interval
property of the class.

  <dtml-call "REQUEST.set('XronEventTime', XronEventOldTime+periodDays)">
  <dtml-if "XronEventTime > bedTime">
  <dtml-call "REQUEST.set('XronEventTime', wakeupTime)">
  </dtml-if>

That's all there is to it.

-- Loren


> -----Original Message-----
> From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Alan
> Capesius
> Sent: Thursday, August 09, 2001 07:05
> To: zope@zope.org
> Subject: [Zope] XRON enhancement suggestion
>
>
> XRON is designed such that when the server is restarted any jobs in queue
> are reviewed and sent when the server comes up. This is normally
> desireable
> behavior. However it can lead to problems under the scenario of
> desktop use
> of Zope or after extended downtime of a server.
>
> If Zope is started after an extended downtime and repetitive jobs are
> scheduled for short intervals, the same job will be fired
> multiple times on
> start-up. In some cases this is undesirable.
>
> For Example:
> I have a number of items for sale on Ebay that I want to track their
> progress while I am on the road.
> I've decided to use Zope as a desktop scheduler.
> I set up a xron job to use sendmail to alert me every 30 minutes to my
> current Ebay auctions status to be sent to my cellphone's email feature.
> I shut down Zope for the evening so that I won't get the alerts overnight.
> I restart Zope in the morning so that I will get alerts
> throughout the day.
> XRON detects the active job and fires it.
> XRON reschedules the job for 30 minutes later and continues to
> refire until
> the time is current.
> This results in 25 duplicate messages to the phone.
>
> Suggested Solution:
> For jobs that require some assurrance of multiple firing (counters, timed
> logging, etc.) the refire is desireable. For jobs that send
> current data or
> perform a function which is not intended to be run in rapid fire (database
> pack, database swaps, email alerts, etc.) the refire is not wanted.
>
> Addition of a parameter that controls the rescheduling time
> behavior should
> solve this problem. A simple checkbox, "reschedule to future only" or some
> such.
>
> XRON can check the current system time when this box is checked and if the
> intended reschedule time is in the past, continue to increment it per the
> interval until the new target time is in the future. This will
> maintain the
> desired interval (time of day) and prevent rapid fire duplicate messages.
>
> - Alan
> ---------------------------------------
> Zope tips and tricks site
> http://twsite.bizland.com/zopetips.htm
>
>
>
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )
>