Last active
December 19, 2015 13:39
-
-
Save andretw/5963704 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| This gist is for my post: http://www.andretw.com/2013/07/using-celery-right-now-and-more-best-practices-1.html |
This file contains hidden or 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
| pip install celery-with-redis |
This file contains hidden or 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
| celery -A tasks worker --loglevel=debug |
This file contains hidden or 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 tasks import send_email, add | |
| print "my other codes are here." | |
| send_email.delay('[email protected]', '1q2w3e4r5t6y7u') | |
| result = add.delay(10, 25) | |
| result.get(timeout=10) |
This file contains hidden or 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 celery import Celery | |
| celery = Celery('tasks', broker='redis://localhost:6379/0') | |
| @celery.task | |
| def send_email(email, token): | |
| print "sending email..." | |
| print "you can saving a file or log a message here to verify it." | |
| @celery.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