Are there options for this? Akin to an sqlite for tasks, in python?
Are there options for this? Akin to an sqlite for tasks, in python?
[1] http://uwsgi-docs.readthedocs.org/en/latest/Queue.html [2] http://uwsgi-docs.readthedocs.org/en/latest/Mules.html
Despite all that, I usually just find myself running celery. I'll usually have a redis instance going anyways that I can use as a sub-optimal queue, and if it's a small enough site, I'll run a single worker instance on the same machine as the host.
This can be a far better alternative to externally run cron scripts for long-running applications (e.g. web applications), as it is platform neutral and can directly access your application’s variables and functions.
The only downside is that, like Celery, RQ forks for every task. This can feel a bit heavy for some of our simpler tasks, although it hasn't proven to be an issue yet.
You can use redis as a backend for celery (which you should be using already for caching, probably), and AFAIK you can use a database as a backend too (although I haven't tried it).
That means that celery is exactly one dependency.
You need some kind of persistent store so that it can recover the task queue from hardware failure. But it can probably use the backend you already have.
The problem now becomes transferring data to that worker, which is where celery comes into play.
Python threads cannot be used for CPU heavy loads because they all run on a single core.[0][1]
[0]: CPython threads are kernel threads but effectively act like user threads. All threads run within a single VM and thus restricted to a single core.
[1]: Jython does not have the same limitation.
Multiprocessing makes it pretty straight-forward to manage inter-process communication with queues, but you'd have to write all the other stuff task queues handle for you, such as error management.