Download 3.0 PDF - Read the Docs

Transcript
Celery Documentation, Release 3.0.25
Note: If you specify AWS credentials in the broker URL, then please keep in mind that the secret access key may
contain unsafe characters that needs to be URL encoded.
Options
Region The default region is us-east-1 but you can select another region by configuring the
BROKER_TRANSPORT_OPTIONS setting:
BROKER_TRANSPORT_OPTIONS = {’region’: ’eu-west-1’}
See also:
An overview of Amazon Web Services regions can be found here:
http://aws.amazon.com/about-aws/globalinfrastructure/
Visibility Timeout The visibility timeout defines the number of seconds to wait for the worker to acknowledge the
task before the message is redelivered to another worker. Also see caveats below.
This option is set via the BROKER_TRANSPORT_OPTIONS setting:
BROKER_TRANSPORT_OPTIONS = {’visibility_timeout’: 3600}
# 1 hour.
The default visibility timeout is 30 seconds.
Polling Interval The polling interval decides the number of seconds to sleep between unsuccessful polls. This value
can be either an int or a float. By default the value is 1 second, which means that the worker will sleep for one second
whenever there are no more messages to read.
You should note that more frequent polling is also more expensive, so increasing the polling interval can save you
money.
The polling interval can be set via the BROKER_TRANSPORT_OPTIONS setting:
BROKER_TRANSPORT_OPTIONS = {’polling_interval’: 0.3}
Very frequent polling intervals can cause busy loops, which results in the worker using a lot of CPU time. If you
need sub-millisecond precision you should consider using another transport, like RabbitMQ <broker-amqp>, or Redis
<broker-redis>.
Queue Prefix By default Celery will not assign any prefix to the queue names, If you have other services using SQS
you can configure it do so using the BROKER_TRANSPORT_OPTIONS setting:
BROKER_TRANSPORT_OPTIONS = {’queue_name_prefix’: ’celery-’}
Caveats
• If a task is not acknowledged within the visibility_timeout, the task will be redelivered to another
worker and executed.
16
Chapter 2. Contents