Recurring Task

Dan Stromberg drsalists at gmail.com
Sun Nov 23 20:56:57 CET 2014


On Sun, Nov 23, 2014 at 10:35 AM, Dennis Lee Bieber
<wlfraed at ix.netcom.com> wrote:
> On Sun, 23 Nov 2014 07:23:43 -0800 (PST), tim at timothyarnold.co.uk declaimed
> the following:
>
>>Hi All
>>Looking for some advice. I'm creating a small netwok poller and wondered what people recommend to use? Will be polling up to 100 hosts every ten reconds or so
>>
>
>         Trickiest part would be maintaining the time-ordered queue (has Python
> created a priority queue yet? -- Ah, apparently it has -- so one could use
> the desired clock value for the priority, and when the thread finishes it
> requeues incrementing the clock value by the rescan interval... -- you'd
> need to implement a sleep_until if the thread grabs an entry before its
> time)

The standard library way: https://docs.python.org/3/library/queue.html
Here's another way - a class I ported from Java:
https://pypi.python.org/pypi/fibonacci-heap-mod

The Fibonacci Heap is theoretically nice because it's lazy and
supports some interesting operations like O(1) merge and O(1)
decrease-key, but it has a large constant on its O(logn) dequeue-min.



More information about the Python-list mailing list