[Twisted-Python] Custom Scheduler
Gerrat Rickert
grickert at coldstorage.com
Mon Apr 8 17:10:41 EDT 2013
Some background:
I have implemented a "relative frequency scheduler".
Tasks added to it are run with frequencies relative to one another - basically, if tasks 1-3 have relative frequencies of 1,2, and 3 respectively, then task 2 is run 1/2 as often as task 1, and task 3 is run 1/3 as often.
The tasks are all generators, so each iteration of the scheduler yields one item from one of its scheduled generators.
The scheduler will also run tasks on both a periodic basis (ie.run this task every X other tasks), as well as running tasks on a timed basis (ie. every X seconds).
I'd like to use twisted in the same program to do some network I/O as well as database interaction.
I did a small test with adding a task that calls both: reactor.doIteration(0) and reactor.runUntilCurrent() to my scheduler, and that seems to run both the network I/O, and the database interactions.
I was wondering if there were other issues with this type of setup?
I can't find any examples online of using other schedulers with twisted.
I glanced briefly at t.i.task.Cooperator, but I don't really need deferreds for any of the CPU stuff, and I'm not really sure how I could replace its scheduler with a non-reactor based one.
Thanks for any insight,
Gerrat
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20130408/7a292604/attachment.htm
More information about the Twisted-Python
mailing list