[Twisted-Python] A resizable cooperator class for queuing and dispatching jobs

Terry Jones terry at jon.es
Fri Dec 11 06:44:57 EST 2009


>>>>> "Dave" == Dave Peticolas <dave at krondo.com> writes:

Dave> Cool. What about being able to get the set of underway objects, in
Dave> addition to the set of pending objects? Then you can get the whole
Dave> state of the queue at that point.

I added an underway() method that gets you a set of underway jobs, each
with its job spec, deferred, and start time. I guess you could add
callbacks or timeouts to the set of outstanding deferreds (e.g., for some
reason you're about to pause and you know the currently outstanding jobs
are going to fail or are somehow invalid and that you're going to have to
redo them, so you could add a callback to each to put it back on the queue,
and then call pause).

Dave> I think:
Dave> queue.resume(0)
Dave> doesn't work the way you'd expect at the moment.

OK, added an assert to make sure you can't do this.

I'm not sure the details of all this are of interest to many people on the
list. I'll find time to put the code up somewhere more useful. It would be
nice to have a runnable demo/example too. Not sure I'll get there.

Terry



More information about the Twisted-Python mailing list