Download Celery Documentation

Transcript
Celery Documentation, Release 3.1.19
• related_name – The name of the module to find. Defaults to “tasks”, which means
it look for “module.tasks” for every module in packages.
• force – By default this call is lazy so that the actual autodiscovery will not happen
until an application imports the default modules. Forcing will cause the autodiscovery
to happen immediately.
add_defaults(d)
Add default configuration from dict d.
If the argument is a callable function then it will be regarded as a promise, and it won’t be loaded until
the configuration is actually needed.
This method can be compared to:
>>> celery.conf.update(d)
with a difference that 1) no copy will be made and 2) the dict will not be transferred when the worker
spawns child processes, so it’s important that the same configuration happens at import time when pickle
restores the object on the other side.
setup_security(. . . )
Setup the message-signing serializer. This will affect all application instances (a global operation).
Disables untrusted serializers and if configured to use the auth serializer will register the auth serializer
with the provided settings into the Kombu serializer registry.
Parameters
• allowed_serializers – List of serializer names, or content_types that should
be exempt from being disabled.
• key – Name of private key file to use. Defaults to the CELERY_SECURITY_KEY
setting.
• cert – Name of certificate file to
CELERY_SECURITY_CERTIFICATE setting.
use.
• store – Directory containing certificates.
CELERY_SECURITY_CERT_STORE setting.
Defaults
Defaults
to
the
to
the
• digest – Digest algorithm used when signing messages. Default is sha1.
• serializer – Serializer used to encode messages after they have been signed. See
CELERY_TASK_SERIALIZER for the serializers supported. Default is json.
start(argv=None)
Run celery using argv.
Uses sys.argv if argv is not specified.
task(fun, . . . )
Decorator to create a task class out of any callable.
Examples:
@app.task
def refresh_feed(url):
return ...
with setting extra options:
280
Chapter 2. Contents