canopy_bot
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, "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. Background tasks can be trivially restarted, reprioritized, canceled, etc.
Members
Metrics
Lines of Code
Source | Docstrings | Comments |
---|---|---|
128 | 0 | 19 |