celery/celery — pull request #1137 by lorenabrams (2012-12-19 20:36:58+00:00)
Title: Provide module/package route derivation to CELERY_ROUTES + documentation changes

Presently, if one wants to specify static routes in *CELERY_ROUTES*, one must provide the fully-qualified task name. This PR introduces module/package-derived task routing.

In other words, say you would like to specify static routes for the following (totally contrived) tasks to queue *some_queue*:

```python
# we're in module 'foo.bar'

@task
def lorem():
pass

@task
def ipsum():
pass
````

Currently you would need to specify the routing as such:

```python
CELERY_ROUTES = {
'foo.bar.lorem: {'queue': 'some_queue'},
'foo.bar.ipsum: {'queue': 'some_queue'}
}
```

With this PR you can instead specify the following module-level routing:

```python
CELERY_ROUTES = {
'foo.bar: {'queue': 'some_queue'}
}
```

.. or package-scoped routing:

```python
CELERY_ROUTES = {
'foo: {'queue': 'some_queue'}
}
```

A few things to note. Towards efficiency, all derived routes are cached, so for any given task, derivation only occurs once. Also, this change is non-destructive, all presently routes should function exactly as they did prior to the PR.