Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 6e402b1b09
Fetching contributors…

Cannot retrieve contributors at this time

33 lines (20 sloc) 0.542 kb
import time
from datetime import datetime
from celery import Celery
celery = Celery("tasks", broker="amqp://guest:guest@localhost:5672")
celery.conf.CELERY_RESULT_BACKEND = "amqp"
@celery.task
def add(x, y):
return int(x) + int(y)
@celery.task
def sleep(seconds):
time.sleep(float(seconds))
return seconds
@celery.task
def echo(msg, timestamp=False):
return "%s: %s" % (datetime.now(), msg) if timestamp else msg
@celery.task
def error(msg):
raise Exception(msg)
if __name__ == "__main__":
celery.start()
Jump to Line
Something went wrong with that request. Please try again.