JobQueue spawns a pool of workers in a
gevent.queue.PriorityQueue. JSON encoded job inputs are routed through a list at key
jobqueue in the environment's Redis database (eg.
>>> # enqueues a job to fetch a resource at Alice's site root >>> canopy.enqueue(canopy.get, "https://alice.example.org") >>> # sets a schedule to enqueue the same job every three minutes >>> canopy.enqueue(canopy.get, "https://alice.example.org", ... _schedule="*/3 * * * *")
The idea is to have all outgoing tasks piped through this queue, no matter how trivial. Web responses should be instantaneous. Once in the background tasks can be managed – restarted, reprioritized, canceled, delayed, etc.
Lines of Code