from celery import Celery
import os
import random
import time

# the app, named `celery` by default convention
my_app = Celery('tasks', backend='amqp', broker=os.environ['CELERY_RELIC_BROKER_URL'])

@my_app.task
def add(x, y):
    """The usual hello world demo."""
    return x + y

@my_app.task
def add_long_time(x, y):
    "Take a long time to add two numbers in order to mock expensive transactions."
    wait = random.randint(1, 5)
    print("Will wait {} seconds".format(wait))
    time.sleep(wait)
    return (x + y, wait)

if __name__ == '__main__':
    celery.worker_main()

@@ -527,35 +527,92 @@
 t)%0A%0A
-if __name__ == '__main__':%0A
+%0A# === Main Bootstrap ===%0A%0A# if __name__ == '__main__':%0A#     # celery.finalize()%0A# 
     

disable celery.worker_main() for now