Created
March 28, 2021 20:31
-
-
Save lukassup/ae45da93f7df30257fde98b3790d7e83 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
Install deps:
Run redis:
Install Celery:
Run Celery worker:
Execute task: