Angelo Gladding

dlv5vbq7lzlthol5 4b942a3185b37d00

South Pasadena, California, United States



canopy job queue

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. KVDB=./path/to/redis.sock).

>>> # enqueues a job to fetch a resource at Alice's site root
>>> canopy.enqueue(canopy.get, "")
>>> # sets a schedule to enqueue the same job every three minutes
>>> canopy.enqueue(canopy.get, "",
...                _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.



full listing

Lines of Code

Source Docstrings Comments
140 0 19