Skip to content

Instantly share code, notes, and snippets.

@lukassup
Created March 28, 2021 20:58
Show Gist options
  • Save lukassup/7ebd2b91c8f552a24a6f25e0593144bd to your computer and use it in GitHub Desktop.
Save lukassup/7ebd2b91c8f552a24a6f25e0593144bd to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
from time import sleep
from tasks import add
result = add.delay(4,4)
sleep(0.1) # wait 0.1s
result.ready()
print(result.get())
#!/usr/bin/env python3
from celery import Celery
app = Celery('tasks', backend='redis://localhost', broker='redis://localhost')
@app.task
def add(x, y):
return x + y
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment