Last active
February 14, 2020 02:07
-
-
Save antunesleo/bb8ed73f5de4abcd5990f63adfa29f13 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
from time import sleep | |
from celery import Celery | |
# Creating a celery instance with redis as message broker. | |
app = Celery('first_app', broker='redis://localhost/2') | |
@app.task | |
def serve_a_beer(_type, size): | |
""" | |
This is a celery task. Just a normal function with task decorator. | |
Note that we use the decorator from a celery insance. | |
""" | |
print('Serving {} of {} beer!'.format(size, _type)) | |
sleep(3) | |
print(""" | |
------------------------------------------------ | |
. * .. . * * | |
* * @()Ooc()* o . | |
(Q@*0CG*O() ___ | |
|\_________/|/ _ \ | |
| | | | | / | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | \_| | | |
| | | | |\___/ | |
|\_|__|__|_/| | |
\_________/ | |
------------------------------------------------ | |
""") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment