Created
March 28, 2021 20:58
-
-
Save lukassup/7ebd2b91c8f552a24a6f25e0593144bd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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