Thomas Stephens (uStudio)
“We make managing online video easy!”
Using Celery
Some normal tasks
Some very long tasks
Tasks restarting
Prefetching
Introspection
Disable ACKS_LATE
Make more queues
Read the source
How hard could it be?
Make it a library, not a framework
Leave the details up to the client
Lean on Redis for atomicity guarantees
Don’t implement concurrency ourselves
lpoprpush
The worker:
from blueque import Client
from blueque import forking_runner
import time
def do_work(task):
print task.id, task.parameters
time.sleep(1000)
return "result"
if __name__ == "__main__":
client = Client(hostname="localhost", port=6379, db=0)
forking_runner.run(client, "some.queue", do_work)
The client:
from blueque import Client
import time
client = Client(hostname="localhost", port=6379, db=0)
queue = client.get_queue("some.queue")
task_id = queue.enqueue("some data to process")
task = client.get_task(task_id)
while task.status != "complete":
task = client.get_task(task_id)
print task.result
Atomicity!
~2.5 million tasks since July
Use pub/sub instead of polling
Build out administrative tools
Documentation on how to integrate it into your app
https://github.com/ustudio/Blueque
http://ustudio.github.io/Blueque/introducing-blueque.html