Created
February 10, 2015 10:37
-
-
Save danhper/80f80fe6e32317aa2593 to your computer and use it in GitHub Desktop.
Python RQ worker
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
from foo import add | |
from time import sleep | |
job = add.delay(1, 2) | |
print("i do some other stuff") | |
sleep(3) | |
print(job.result) |
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
from rq.decorators import job | |
from redis import Redis | |
from time import sleep | |
@job('default', connection=Redis(), timeout=100) | |
def add(x, y): | |
sleep(2) | |
return x + y |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment