 Celery 2.3 Documentationso here’s an example task adding two numbers: from celery.task import task @task def add(x, y): return x + y You can execute the task in the background, or wait for it to finish: >>> result = add.delay(4 tasks.py, and it looks like this: file tasks.py from celery.task import task @task def add(x, y): return x + y Behind the scenes the @task decorator actually creates a class that inherits from Task. The availability of keys in this mapping. Example Usage from celery.task import task @task def add(x, y): print("Executing task id %r, args: %r kwargs: %r" % ( add.request.id, add.request.args, add.request0 码力 | 334 页 | 1.25 MB | 1 年前3 Celery 2.3 Documentationso here’s an example task adding two numbers: from celery.task import task @task def add(x, y): return x + y You can execute the task in the background, or wait for it to finish: >>> result = add.delay(4 tasks.py, and it looks like this: file tasks.py from celery.task import task @task def add(x, y): return x + y Behind the scenes the @task decorator actually creates a class that inherits from Task. The availability of keys in this mapping. Example Usage from celery.task import task @task def add(x, y): print("Executing task id %r, args: %r kwargs: %r" % ( add.request.id, add.request.args, add.request0 码力 | 334 页 | 1.25 MB | 1 年前3
 Celery 3.1 Documentationimport Celery app = Celery('tasks', broker='amqp://guest@localhost//') @app.task def add(x, y): return x + y The first argument to Celery is the name of the current module, this is needed so that names import absolute_import from proj.celery import app @app.task def add(x, y): return x + y @app.task def mul(x, y): return x * y @app.task def xsum(numbers): return sum(numbers) Starting the worker task, that task will also be added to the local registry: >>> @app.task ... def add(x, y): ... return x + y >>> add <@task: __main__.add> >>> add.name __main__.add >>> app.tasks['__main__.add']0 码力 | 887 页 | 1.22 MB | 1 年前3 Celery 3.1 Documentationimport Celery app = Celery('tasks', broker='amqp://guest@localhost//') @app.task def add(x, y): return x + y The first argument to Celery is the name of the current module, this is needed so that names import absolute_import from proj.celery import app @app.task def add(x, y): return x + y @app.task def mul(x, y): return x * y @app.task def xsum(numbers): return sum(numbers) Starting the worker task, that task will also be added to the local registry: >>> @app.task ... def add(x, y): ... return x + y >>> add <@task: __main__.add> >>> add.name __main__.add >>> app.tasks['__main__.add']0 码力 | 887 页 | 1.22 MB | 1 年前3
 Celery 3.1 Documentationimport Celery app = Celery('tasks', broker='amqp://guest@localhost//') @app.task def add(x, y): return x + y The first argument to Celery is the name of the current module, this is needed so that names import absolute_import from proj.celery import app @app.task def add(x, y): return x + y @app.task def mul(x, y): return x * y @app.task def xsum(numbers): return sum(numbers) Starting the worker a task, that task will also be added to the local registry: >>> @app.task ... def add(x, y): ... return x + y >>> add <@task: __main__.add> >>> add.name __main__.add >>> app.tasks['__main__.add'] <@task:0 码力 | 607 页 | 2.27 MB | 1 年前3 Celery 3.1 Documentationimport Celery app = Celery('tasks', broker='amqp://guest@localhost//') @app.task def add(x, y): return x + y The first argument to Celery is the name of the current module, this is needed so that names import absolute_import from proj.celery import app @app.task def add(x, y): return x + y @app.task def mul(x, y): return x * y @app.task def xsum(numbers): return sum(numbers) Starting the worker a task, that task will also be added to the local registry: >>> @app.task ... def add(x, y): ... return x + y >>> add <@task: __main__.add> >>> add.name __main__.add >>> app.tasks['__main__.add'] <@task:0 码力 | 607 页 | 2.27 MB | 1 年前3
 Celery 2.5 Documentationso here’s an example task adding two numbers: from celery.task import task @task def add(x, y): return x + y You can execute the task in the background, or wait for it to finish: >>> result = add.delay(4 tasks.py, and it looks like this: file tasks.py from celery.task import task @task def add(x, y): return x + y Behind the scenes the @task decorator actually creates a class that inherits from Task. The availability of keys in this mapping. Example Usage from celery.task import task @task def add(x, y): print("Executing task id %r, args: %r kwargs: %r" % ( add.request.id, add.request.args, add.request0 码力 | 400 页 | 1.40 MB | 1 年前3 Celery 2.5 Documentationso here’s an example task adding two numbers: from celery.task import task @task def add(x, y): return x + y You can execute the task in the background, or wait for it to finish: >>> result = add.delay(4 tasks.py, and it looks like this: file tasks.py from celery.task import task @task def add(x, y): return x + y Behind the scenes the @task decorator actually creates a class that inherits from Task. The availability of keys in this mapping. Example Usage from celery.task import task @task def add(x, y): print("Executing task id %r, args: %r kwargs: %r" % ( add.request.id, add.request.args, add.request0 码力 | 400 页 | 1.40 MB | 1 年前3
 Celery 2.3 Documentationhere’s an example task adding two numbers: from celery.task import task @task def add(x, y): return x + y You can execute the task in the background, or wait for it to finish: >>> result = add.delay(4 py, and it looks like this: file: tasks.py from celery.task import task @task def add(x, y): return x + y Behind the scenes the @task decorator actually creates a class that inherits from Task. The availability of keys in this mapping. Example Usage from celery.task import task @task def add(x, y): print("Executing task id %r, args: %r kwargs: %r" % ( add.request.id, add.request.args0 码力 | 530 页 | 900.64 KB | 1 年前3 Celery 2.3 Documentationhere’s an example task adding two numbers: from celery.task import task @task def add(x, y): return x + y You can execute the task in the background, or wait for it to finish: >>> result = add.delay(4 py, and it looks like this: file: tasks.py from celery.task import task @task def add(x, y): return x + y Behind the scenes the @task decorator actually creates a class that inherits from Task. The availability of keys in this mapping. Example Usage from celery.task import task @task def add(x, y): print("Executing task id %r, args: %r kwargs: %r" % ( add.request.id, add.request.args0 码力 | 530 页 | 900.64 KB | 1 年前3
 Celery 2.2 Documentationso here’s an example task adding two numbers: from celery.task import task @task def add(x, y): return x + y You can execute the task in the background, or wait for it to finish: >>> result = add.delay(4 tasks.py, and it looks like this: file tasks.py from celery.task import task @task def add(x, y): return x + y Behind the scenes the @task decorator actually creates a class that inherits from Task. The capabilities, you can’t trust the availability of keys in this mapping. Example Usage @task def add(x, y): print("Executing task id %r, args: %r kwargs: %r" % ( add.request.id, add.request.args, add.request0 码力 | 314 页 | 1.26 MB | 1 年前3 Celery 2.2 Documentationso here’s an example task adding two numbers: from celery.task import task @task def add(x, y): return x + y You can execute the task in the background, or wait for it to finish: >>> result = add.delay(4 tasks.py, and it looks like this: file tasks.py from celery.task import task @task def add(x, y): return x + y Behind the scenes the @task decorator actually creates a class that inherits from Task. The capabilities, you can’t trust the availability of keys in this mapping. Example Usage @task def add(x, y): print("Executing task id %r, args: %r kwargs: %r" % ( add.request.id, add.request.args, add.request0 码力 | 314 页 | 1.26 MB | 1 年前3
 Celery 2.4 Documentationhere’s an example task adding two numbers: from celery.task import task @task def add(x, y): return x + y You can execute the task in the background, or wait for it to finish: >>> result = add.delay(4 py, and it looks like this: file: tasks.py from celery.task import task @task def add(x, y): return x + y Behind the scenes the @task decorator actually creates a class that inherits from Task. The availability of keys in this mapping. Example Usage from celery.task import task @task def add(x, y): print("Executing task id %r, args: %r kwargs: %r" % ( add.request.id, add.request.args0 码力 | 543 页 | 957.42 KB | 1 年前3 Celery 2.4 Documentationhere’s an example task adding two numbers: from celery.task import task @task def add(x, y): return x + y You can execute the task in the background, or wait for it to finish: >>> result = add.delay(4 py, and it looks like this: file: tasks.py from celery.task import task @task def add(x, y): return x + y Behind the scenes the @task decorator actually creates a class that inherits from Task. The availability of keys in this mapping. Example Usage from celery.task import task @task def add(x, y): print("Executing task id %r, args: %r kwargs: %r" % ( add.request.id, add.request.args0 码力 | 543 页 | 957.42 KB | 1 年前3
 Celery 1.0 Documentationhere’s an example task adding two numbers: from celery.decorators import task @task def add(x, y): return x + y You can execute the task in the background, or wait for it to finish: >>> result = add.delay(4 addition task looks like this: tasks.py: from celery.decorators import task @task def add(x, y): return x + y All celery tasks are classes that inherit from the Task class. In this case we’re using a decorator This is a task that adds two numbers: from celery.decorators import task @task() def add(x, y): return x + y To execute this task, we can use the delay method of the task class. This is a handy shortcut0 码力 | 123 页 | 400.69 KB | 1 年前3 Celery 1.0 Documentationhere’s an example task adding two numbers: from celery.decorators import task @task def add(x, y): return x + y You can execute the task in the background, or wait for it to finish: >>> result = add.delay(4 addition task looks like this: tasks.py: from celery.decorators import task @task def add(x, y): return x + y All celery tasks are classes that inherit from the Task class. In this case we’re using a decorator This is a task that adds two numbers: from celery.decorators import task @task() def add(x, y): return x + y To execute this task, we can use the delay method of the task class. This is a handy shortcut0 码力 | 123 页 | 400.69 KB | 1 年前3
 Celery 2.4 Documentationso here’s an example task adding two numbers: from celery.task import task @task def add(x, y): return x + y You can execute the task in the background, or wait for it to finish: >>> result = add.delay(4 Celery 13 Celery Documentation, Release 2.4.7 from celery.task import task @task def add(x, y): return x + y Behind the scenes the @task decorator actually creates a class that inherits from Task. The availability of keys in this mapping. Example Usage from celery.task import task @task def add(x, y): print("Executing task id %r, args: %r kwargs: %r" % ( add.request.id, add.request.args, add.request0 码力 | 395 页 | 1.54 MB | 1 年前3 Celery 2.4 Documentationso here’s an example task adding two numbers: from celery.task import task @task def add(x, y): return x + y You can execute the task in the background, or wait for it to finish: >>> result = add.delay(4 Celery 13 Celery Documentation, Release 2.4.7 from celery.task import task @task def add(x, y): return x + y Behind the scenes the @task decorator actually creates a class that inherits from Task. The availability of keys in this mapping. Example Usage from celery.task import task @task def add(x, y): print("Executing task id %r, args: %r kwargs: %r" % ( add.request.id, add.request.args, add.request0 码力 | 395 页 | 1.54 MB | 1 年前3
 Celery 2.2 Documentationhere’s an example task adding two numbers: from celery.task import task @task def add(x, y): return x + y You can execute the task in the background, or wait for it to finish: >>> result = add.delay(4 py, and it looks like this: file: tasks.py from celery.task import task @task def add(x, y): return x + y Behind the scenes the @task decorator actually creates a class that inherits from Task. The capabilities, you can’t trust the availability of keys in this mapping. Example Usage @task def add(x, y): print("Executing task id %r, args: %r kwargs: %r" % ( add.request.id, add.request.args0 码力 | 505 页 | 878.66 KB | 1 年前3 Celery 2.2 Documentationhere’s an example task adding two numbers: from celery.task import task @task def add(x, y): return x + y You can execute the task in the background, or wait for it to finish: >>> result = add.delay(4 py, and it looks like this: file: tasks.py from celery.task import task @task def add(x, y): return x + y Behind the scenes the @task decorator actually creates a class that inherits from Task. The capabilities, you can’t trust the availability of keys in this mapping. Example Usage @task def add(x, y): print("Executing task id %r, args: %r kwargs: %r" % ( add.request.id, add.request.args0 码力 | 505 页 | 878.66 KB | 1 年前3
共 51 条
- 1
- 2
- 3
- 4
- 5
- 6














