This document describes an older version of Celery (2.5). For the latest stable version please go here.
Celery Application.
copyright: |
|
---|---|
license: | BSD, see LICENSE for more details. |
Celery Application.
Parameters: |
|
---|
Name of the __main__ module. Required for standalone scripts.
If set this will be used instead of __main__ when automatically generating task names.
Storing/retrieving task state. See BaseBackend.
Current loader.
Current configuration (dict and attribute access).
Read configuration from object, where object is either a object, or the name of a module to import.
>>> celery.config_from_object("myapp.celeryconfig")
>>> from myapp import celeryconfig
>>> celery.config_from_object(celeryconfig)
Read configuration from environment variable.
The value of the environment variable must be the name of a module to import.
>>> os.environ["CELERY_CONFIG_MODULE"] = "myapp.celeryconfig"
>>> celery.config_from_envvar("CELERY_CONFIG_MODULE")
Read configuration from argv.
The config
Decorator to create a task class out of any callable.
Examples:
@task()
def refresh_feed(url):
return Feed.objects.get(url=url).refresh()
with setting extra options and using retry.
from celery.task import current
@task(exchange="feeds")
def refresh_feed(url):
try:
return Feed.objects.get(url=url).refresh()
except socket.error, exc:
current.retry(exc=exc)
Calling the resulting task:
>>> refresh_feed("http://example.com/rss") # Regular
<Feed: http://example.com/rss>
>>> refresh_feed.delay("http://example.com/rss") # Async
<AsyncResult: 8998d0f4-da0b-4669-ba03-d5ab5ac6ad5d>
Creates a base task class using default configuration taken from this app.
Send task by name.
Parameters: |
|
---|
Supports the same arguments as apply_async().
Create celery.result.BaseAsyncResult instance.
Create celery.result.TaskSetResult instance.
Establish a connection to the message broker.
Parameters: |
|
---|
:returns kombu.connection.BrokerConnection:
With any function accepting connection and connect_timeout keyword arguments, establishes a default connection if one is not already passed to it.
Any automatically established connection will be closed after the function returns.
Deprecated
Use with app.default_connection(connection) instead.
Prepare configuration before it is merged with the defaults.
Fallback to the value of a configuration key if none of the *values are true.
Like dict(a, **b) except it will keep values from a if the value in b is None.