Merge lp:~adeuring/launchpad/celery-config into lp:launchpad
| Status: | Merged | ||||
|---|---|---|---|---|---|
| Approved by: | Aaron Bentley on 2012-04-18 | ||||
| Approved revision: | no longer in the source branch. | ||||
| Merged at revision: | 15126 | ||||
| Proposed branch: | lp:~adeuring/launchpad/celery-config | ||||
| Merge into: | lp:launchpad | ||||
| Diff against target: |
303 lines (+270/-15) 3 files modified
lib/lp/services/config/schema-lazr.conf (+35/-0) lib/lp/services/job/celeryconfig.py (+87/-15) lib/lp/services/job/tests/test_celery_configuration.py (+148/-0) |
||||
| To merge this branch: | bzr merge lp:~adeuring/launchpad/celery-config | ||||
| Related bugs: |
|
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Aaron Bentley (community) | 2012-04-18 | Approve on 2012-04-18 | |
| Abel Deuring (community) | Resubmit on 2012-04-18 | ||
|
Review via email:
|
|||
Commit Message
configuration for the Celery based job runner.
Description of the Change
This branch adds configuration details we need for the Celery based
job runner.
Celery reads its configuration from a Python file (we use
lp.services.
from our regular lp.services.
lp.services.
that were missing, and I added some sanity checks.
Note that the config module is used in two different places: The app
servers load it in order to send messages to a RabbitMQ server; several
celeryd instances consume these messages and run the jobs described by
them.
Normally, a celeryconfig modules looks like so:
PARAMETER_1 = value_1
PARAMETER_2 = value_2
i.e., the variables are set when the module is loaded. This makes it
difficult to test variants of the configuration -- re-loading a Python
module can be quite painful, so I moved this into a function configure().
The check for circular chain of linked fallback queues is quite naive and
inefficient, but I think it is good enough for our purposes: It is
unlikely that we will have, let's say, 500 different queues where some
complex fallback chains need to be tested.
test: ./bin/test -vvt lp.services.
= Launchpad lint =
Checking for conflicts and issues in changed files.
Linting changed files:
lib/lp/
lib/lp/
lib/lp/
./lib/lp/
501: Line exceeds 80 characters.
1112: Line exceeds 80 characters.
1119: Line exceeds 80 characters.
1711: Line exceeds 80 characters.
These are lines I did not change.

I think we want the timeout to be 5 minutes. That's what it's currently set to, and it will ensure that ~99% of tasks run in the fast lane.
It's generally a bad idea to assume that sys.argv is defined. It won't be when Python is loaded as an extension. I've been bitten by that in Launchpad work before. If you must use sys.argv, you need to handle the case where it's not defined.
Since we expect to use binding keys that match the queue names, please don't require the binding key to be specified.
I think it would be nicer if configure accepted "argv" and returned a dict. Then you could do "globals( ).update( configure( getattr( sys, 'argv', [''])))" to actually set it. That would make it easier to test, and also shorter. You could even pull the function into a different module so that testing didn't have to actually set the globals.
check_job_ specific_ celeryd_ configutartion is misspelled.