This document describes an older version of Celery (2.2). 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/retreiving task state. See BaseBackend.
Current loader.
Current configuration (dict and attribute access).
Read configuration from object, where object is either a real object, or the name of an object 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 an object 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.
@task(exchange="feeds")
def refresh_feed(url, **kwargs):
try:
return Feed.objects.get(url=url).refresh()
except socket.error, exc:
refresh_feed.retry(args=[url], kwargs=kwargs, 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.
Run celeryd using argv. Uses sys.argv if argv is not specified.
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.
Send an e-mail to the admins in the ADMINS setting.
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.