Skip to content

Instantly share code, notes, and snippets.

@antunesleo
Last active February 14, 2020 02:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save antunesleo/bb8ed73f5de4abcd5990f63adfa29f13 to your computer and use it in GitHub Desktop.
Save antunesleo/bb8ed73f5de4abcd5990f63adfa29f13 to your computer and use it in GitHub Desktop.
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