Skip to content

Commit

Permalink
Rendered documentation for Github Pages.
Browse files Browse the repository at this point in the history
  • Loading branch information
mher committed Jul 28, 2012
1 parent 62a677f commit 7cde1ad
Show file tree
Hide file tree
Showing 105 changed files with 1,725 additions and 12,419 deletions.
5,508 changes: 168 additions & 5,340 deletions _sources/changelog.txt

Large diffs are not rendered by default.

48 changes: 47 additions & 1 deletion _sources/configuration.txt
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ You can change methods too, for example the ``on_failure`` handler:
.. code-block:: python

def my_on_failure(self, exc, task_id, args, kwargs, einfo):
print("Oh no! Task failed: %r" % (exc, ))
print("Oh no! Task failed: {0!r}".format(exc))

CELERY_ANNOTATIONS = {"*": {"on_failure": my_on_failure}}

Expand Down Expand Up @@ -605,6 +605,32 @@ A list of routers, or a single router used to route tasks to queues.
When deciding the final destination of a task the routers are consulted
in order. See :ref:`routers` for more information.

.. setting:: CELERY_WORKER_DIRECT

CELERY_WORKER_DIRECT
~~~~~~~~~~~~~~~~~~~~

This option enables so that every worker has a dedicated queue,
so that tasks can be routed to specific workers.

The queue name for each worker is automatically generated based on
the worker hostname and a ``.dq`` suffix, using the ``C.dq`` exchange.

For example the queue name for the worker with hostname ``w1.example.com``
becomes::

w1.example.com.dq

Then you can route the task to the task by specifying the hostname
as the routung key and the ``C.dq`` exchange::

CELERY_ROUTES = {
'tasks.add': {'exchange': 'C.dq', 'routing_key': 'w1.example.com'}
}

This setting is mandatory if you want to use the ``move_to_worker`` features
of :mod:`celery.contrib.migrate`.

.. setting:: CELERY_CREATE_MISSING_QUEUES

CELERY_CREATE_MISSING_QUEUES
Expand Down Expand Up @@ -703,6 +729,26 @@ It can also be a fully qualified path to your own transport implementation.

See the Kombu documentation for more information about broker URLs.

.. setting:: BROKER_HEARTBEAT

BROKER_HEARTBEAT
~~~~~~~~~~~~~~~~
:transports supported: ``pyamqp``

It's not always possible to detect connection loss in a timely
manner using TCP/IP alone, so AMQP defines something called heartbeats
that's is used both by the client and the broker to detect if
a connection was closed.

Heartbeats are currently only supported by the ``pyamqp://`` transport,
and this requires the :mod:`amqp` module::

$ pip install amqp

The default heartbeat value is 10 seconds,
the heartbeat will then be monitored at double the rate of the heartbeat value
(so for the default 10 seconds, the heartbeat is checked every 5 seconds).

.. setting:: BROKER_USE_SSL

BROKER_USE_SSL
Expand Down
5 changes: 3 additions & 2 deletions _sources/contributing.txt
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ To run the tests for all supported Python versions simply execute::
If you only want to test specific Python versions use the :option:`-e`
option::

$ tox -e py25,py26
$ tox -e py26

Building the documentation
--------------------------
Expand Down Expand Up @@ -602,7 +602,8 @@ is following the conventions.

from __future__ import absolute_import

* If the module uses the with statement it must also enable that::
* If the module uses the with statement and must be compatible
with Python 2.5 (celery is not) then it must also enable that::

from __future__ import with_statement

Expand Down
2 changes: 1 addition & 1 deletion _sources/faq.txt
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ Also, a common pattern is to add callbacks to tasks:

@celery.task(ignore_result=True)
def log_result(result):
logger.info("log_result got: %r" % (result, ))
logger.info("log_result got: %r", result)

Invocation::

Expand Down
5 changes: 4 additions & 1 deletion _sources/getting-started/brokers/redis.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ your Redis database::

Where the URL is in the format of::

redis://userid:password@hostname:port/db_number
redis://:password@hostname:port/db_number

all fields after the scheme are optional, and will default to localhost on port 6379,
using database 0.

.. _redis-results-configuration:

Expand Down
6 changes: 3 additions & 3 deletions _sources/getting-started/introduction.txt
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,9 @@ Features

- **Monitoring**

The stream of monitoring events emitted by the worker are used
by built-in and external tools to tell you what your cluster
is doing in real-time.
A stream of monitoring events is emitted by workers and
is used by built-in and external tools to tell you what
your cluster is doing -- in real-time.

:ref:`Read more… <guide-monitoring>`.

Expand Down
1 change: 1 addition & 0 deletions _sources/index.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ Contents
changelog
reference/index
internals/index
history/index
glossary


Expand Down
5 changes: 2 additions & 3 deletions _sources/internals/deprecation.txt
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,13 @@ for example::
def add(x, y, task_id=None):
print("My task id is %r" % (task_id, ))

must be rewritten into::
should be rewritten into::

from celery import task

@task()
def add(x, y):
print("My task id is %r" % (add.request.id, ))
print("My task id is {0.request.id}".format(add))


Task attributes
Expand Down Expand Up @@ -201,7 +201,6 @@ Settings
``BROKER_USER`` :setting:`BROKER_URL`
``BROKER_PASSWORD`` :setting:`BROKER_URL`
``BROKER_VHOST`` :setting:`BROKER_URL`
``BROKER_INSIST`` *no alternative*
===================================== =====================================


Expand Down
8 changes: 4 additions & 4 deletions _sources/internals/guide.txt
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ as this means that they can be set by either instantiation or inheritance.

class Producer(object):
active = True
serializer = "json"
serializer = 'json'

def __init__(self, serializer=None):
self.serializer = serializer or self.serializer
Expand All @@ -104,13 +104,13 @@ A subclass can change the default value:
.. code-block:: python

TaskProducer(Producer):
serializer = "pickle"
serializer = 'pickle'

and the value can be set at instantiation:

.. code-block:: python

>>> producer = TaskProducer(serializer="msgpack")
>>> producer = TaskProducer(serializer='msgpack')

Exceptions
~~~~~~~~~~
Expand Down Expand Up @@ -220,7 +220,7 @@ from a module in the project, this module could look something like this:
from celery import Celery

celery = Celery()
celery.config_from_object(BROKER_URL="amqp://")
celery.config_from_object(BROKER_URL='amqp://')


Module Overview
Expand Down
7 changes: 7 additions & 0 deletions _sources/internals/protocol.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@ Message format
will be expired when the message is received and the expiration date
has been exceeded.

* timeouts
:`tuple`:

.. versionadded:: 2.7

Task execution timeouts. This is a tuple of hard and soft timeouts.
Timeout values are `int` or `float`.

Extensions
==========
Expand Down
26 changes: 25 additions & 1 deletion _sources/reference/celery.txt
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,23 @@ Application
>>> os.environ["CELERY_CONFIG_MODULE"] = "myapp.celeryconfig"
>>> celery.config_from_envvar("CELERY_CONFIG_MODULE")

.. method:: Celery.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.

.. method:: Celery.start(argv=None)

Run :program:`celery` using `argv`.
Expand Down Expand Up @@ -208,14 +225,21 @@ Application

:returns :class:`kombu.connection.Connection`:

.. method:: Celery.default_connection(connection=None)
.. method:: Celery.connection_or_acquire(connection=None)

For use within a with-statement to get a connection from the pool
if one is not already provided.

:keyword connection: If not provided, then a connection will be
acquired from the connection pool.

.. method:: Celery.producer_or_acquire(producer=None)

For use within a with-statement to get a producer from the pool
if one is not already provided

:keyword producer: If not provided, then a producer will be
acquired from the producer pool.

.. method:: Celery.mail_admins(subject, body, fail_silently=False)

Expand Down
4 changes: 2 additions & 2 deletions _sources/tutorials/daemonizing.txt
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ This is an example configuration for those using `django-celery`::
CELERYD_GROUP="celery"

# Name of the projects settings module.
export DJANGO_SETTINGS_MODULE="settings"
export DJANGO_SETTINGS_MODULE="MyProject.settings"

.. _generic-initd-celeryd-django-with-env-example:

Expand Down Expand Up @@ -145,7 +145,7 @@ environment's python interpreter::
CELERYD_GROUP="celery"

# Name of the projects settings module.
export DJANGO_SETTINGS_MODULE="settings"
export DJANGO_SETTINGS_MODULE="MyProject.settings"

.. _generic-initd-celeryd-options:

Expand Down
6 changes: 3 additions & 3 deletions _sources/tutorials/task-cookbook.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@ The cache key expires after some time in case something unexpected happens
# The cache key consists of the task name and the MD5 digest
# of the feed URL.
feed_url_digest = md5(feed_url).hexdigest()
lock_id = '%s-lock-%s' % (self.name, feed_url_hexdigest)
lock_id = '{0}-lock-{1}'.format(self.name, feed_url_hexdigest)

# cache.add fails if if the key already exists
acquire_lock = lambda: cache.add(lock_id, 'true', LOCK_EXPIRE)
# memcache delete is very slow, but we have to use it to take
# advantage of using add() for atomic locking
release_lock = lambda: cache.delete(lock_id)

logger.debug('Importing feed: %s' % feed_url)
logger.debug('Importing feed: %s', feed_url)
if acquire_lock():
try:
feed = Feed.objects.import_feed(feed_url)
Expand All @@ -60,4 +60,4 @@ The cache key expires after some time in case something unexpected happens
return feed.url

logger.debug(
'Feed %s is already being imported by another worker' % feed_url)
'Feed %s is already being imported by another worker', feed_url)
8 changes: 4 additions & 4 deletions _sources/userguide/application.txt
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ chain breaks::
.. code-block:: python

def hello(to):
return 'hello %s' % to
return 'hello {0}'.format(to)

>>> from celery.execute import apply_async

Expand All @@ -397,7 +397,7 @@ chain breaks::
send_error_emails = True

def run(self, to):
return 'hello %s' % to
return 'hello {0}'.format(to)
tasks.register(Hello)

>>> Hello.delay('world!')
Expand All @@ -413,7 +413,7 @@ chain breaks::

@task(send_error_emails=True)
def hello(x):
return 'hello %s' % to
return 'hello {0}'.format(to)

Abstract Tasks
==============
Expand All @@ -440,7 +440,7 @@ class: :class:`celery.Task`.
abstract = True

def __call__(self, *args, **kwargs):
print('TASK STARTING: %s[%s]' % (self.name, self.request.id))
print('TASK STARTING: {0.name}[{0.request.id}].format(self))
return self.run(*args, **kwargs)


Expand Down
4 changes: 2 additions & 2 deletions _sources/userguide/calling.txt
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@ This is an example error callback:
def error_handler(uuid):
result = AsyncResult(uuid)
exc = result.get(propagate=False)
print('Task %r raised exception: %r\n%r' % (
exc, result.traceback))
print('Task {0} raised exception: {1!r}\n{2!r}'.format(
uuid, exc, result.traceback))

it can be added to the task using the ``link_error`` execution
option:
Expand Down
Loading

0 comments on commit 7cde1ad

Please sign in to comment.