[Zope-dev] Xron fragility

Chris McDonough chrism@digicool.com
Wed, 11 Oct 2000 09:47:03 -0400


> It is the Xron DTML Method's responsibility to reschedule itself.
> It could be its first duty, however. Then again, as all the work happens
> inside a ZODB transaction, it doesn't matter when the reschedule
> happens.

I understand.

As a side note, I do not like the fact that Xron requires you to use special
DTML methods.  I suppose this is a requirement in this architecture due to
the fact they need to be autocataloged, but I don't really like that feature
either :-).

> > What does the Dispatcher thread do?  Does it fire off worker threads?
>
> Xron has a single dispatcher thread. This thread knows how long to sleep
> for until the next job needs to run.

Do you think this is this any more effective than having a producer thread
do a lookup every minute to see what jobs are current, after which it should
put the current jobs in a queue?  E.g., as the "run" method of a separate
producer thread:

    def run(self,localtime=time.localtime,time=time.time,sleep=time.sleep):
       while 1:
            t = localtime(time())
            sleeptime = (60 - t[SECOND])
            sleep(sleeptime)
            for event in self.eventdata.values():
                if event.isCurrent():

self.outputqueue.put(EventWrapper(event,self.reportqueue))


> It uses Client.py to run a job.

Why is this?  This doesn't make any sense to me on its face.  Why not just
call the method from a separate thread?

> > What are other threads in Xron doing while the Dispatcher thread is
hosed?
> > What are the other threads?
>
> There are no other threads in Xron.
> Xron creates a single thread to do all event dispatching. The work is
> done in Zope ZODB threads (or whatever the correct terminology is). The
> dispatcher thread communicates with a ZODB thread by using Client to
> make a web request.

I see... would it be naive if I were to say that I think that a scheduler
should fire off threads of its own and not rely on an external facility to
run the jobs?

> Xron usually makes requests as the anonymous user. However, I've patched
> my Xron to make requests as XronUser by hardcoding (!) the username and
> password for that in the RPC.py module of Xron. Then, I've manually
> created a XronUser user in my root user folder. I give XronUser the
> local roles needed to run methods I want to be scheduled via Xron.

If this were handled not using Client.py, I think we could just use the
security manager to change users.