annotate celeryconfig.py @ 591:1e2adb37cab6

docs update
author Marcin Kuzminski <marcin@python-works.com>
date Mon, 11 Oct 2010 19:18:05 +0200
parents 1e757ac98988
children 89b9037d68b7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
467
3fc3ce53659b starting celery branch
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
1 # List of modules to import when celery starts.
3fc3ce53659b starting celery branch
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
2 import sys
3fc3ce53659b starting celery branch
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
3 import os
483
a9e50dce3081 Removed config names from whoosh and celery,
Marcin Kuzminski <marcin@python-works.com>
parents: 474
diff changeset
4 import ConfigParser
484
d3f701d912bd fixed up celeryconfig, to get results database from config files
Marcin Kuzminski <marcin@python-works.com>
parents: 483
diff changeset
5 root = os.getcwd()
483
a9e50dce3081 Removed config names from whoosh and celery,
Marcin Kuzminski <marcin@python-works.com>
parents: 474
diff changeset
6
535
72778dda34cf some fixups in cache, added fallback and cache invalidation when key not found in cached repos list,
Marcin Kuzminski <marcin@python-works.com>
parents: 533
diff changeset
7 PYLONS_CONFIG_NAME = 'production.ini'
483
a9e50dce3081 Removed config names from whoosh and celery,
Marcin Kuzminski <marcin@python-works.com>
parents: 474
diff changeset
8
484
d3f701d912bd fixed up celeryconfig, to get results database from config files
Marcin Kuzminski <marcin@python-works.com>
parents: 483
diff changeset
9 sys.path.append(root)
483
a9e50dce3081 Removed config names from whoosh and celery,
Marcin Kuzminski <marcin@python-works.com>
parents: 474
diff changeset
10 config = ConfigParser.ConfigParser({'here':root})
a9e50dce3081 Removed config names from whoosh and celery,
Marcin Kuzminski <marcin@python-works.com>
parents: 474
diff changeset
11 config.read('%s/%s' % (root, PYLONS_CONFIG_NAME))
a9e50dce3081 Removed config names from whoosh and celery,
Marcin Kuzminski <marcin@python-works.com>
parents: 474
diff changeset
12 PYLONS_CONFIG = config
a9e50dce3081 Removed config names from whoosh and celery,
Marcin Kuzminski <marcin@python-works.com>
parents: 474
diff changeset
13
547
1e757ac98988 renamed project to rhodecode
Marcin Kuzminski <marcin@python-works.com>
parents: 535
diff changeset
14 CELERY_IMPORTS = ("rhodecode.lib.celerylib.tasks",)
467
3fc3ce53659b starting celery branch
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
15
3fc3ce53659b starting celery branch
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
16 ## Result store settings.
3fc3ce53659b starting celery branch
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
17 CELERY_RESULT_BACKEND = "database"
484
d3f701d912bd fixed up celeryconfig, to get results database from config files
Marcin Kuzminski <marcin@python-works.com>
parents: 483
diff changeset
18 CELERY_RESULT_DBURI = dict(config.items('app:main'))['sqlalchemy.db1.url']
493
2256c78afe53 implemented basic autoupdating statistics fetched from database
Marcin Kuzminski <marcin@python-works.com>
parents: 484
diff changeset
19 CELERY_RESULT_SERIALIZER = 'json'
2256c78afe53 implemented basic autoupdating statistics fetched from database
Marcin Kuzminski <marcin@python-works.com>
parents: 484
diff changeset
20
467
3fc3ce53659b starting celery branch
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
21
474
a3d9d24acbec Implemented password reset(forms/models/ tasks) and mailing tasks.
Marcin Kuzminski <marcin@python-works.com>
parents: 467
diff changeset
22 BROKER_CONNECTION_MAX_RETRIES = 30
467
3fc3ce53659b starting celery branch
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
23
3fc3ce53659b starting celery branch
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
24 ## Broker settings.
3fc3ce53659b starting celery branch
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
25 BROKER_HOST = "localhost"
3fc3ce53659b starting celery branch
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
26 BROKER_PORT = 5672
3fc3ce53659b starting celery branch
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
27 BROKER_VHOST = "rabbitmqhost"
3fc3ce53659b starting celery branch
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
28 BROKER_USER = "rabbitmq"
3fc3ce53659b starting celery branch
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
29 BROKER_PASSWORD = "qweqwe"
3fc3ce53659b starting celery branch
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
30
3fc3ce53659b starting celery branch
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
31 ## Worker settings
3fc3ce53659b starting celery branch
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
32 ## If you're doing mostly I/O you can have more processes,
3fc3ce53659b starting celery branch
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
33 ## but if mostly spending CPU, try to keep it close to the
3fc3ce53659b starting celery branch
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
34 ## number of CPUs on your machine. If not set, the number of CPUs/cores
3fc3ce53659b starting celery branch
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
35 ## available will be used.
3fc3ce53659b starting celery branch
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
36 CELERYD_CONCURRENCY = 2
3fc3ce53659b starting celery branch
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
37 # CELERYD_LOG_FILE = "celeryd.log"
3fc3ce53659b starting celery branch
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
38 CELERYD_LOG_LEVEL = "DEBUG"
506
d5efb83590ef fixed lock decorator bug which didn't release the lock after func execution and rewrote the pidlock a little with Ask Solem suggestions!
Marcin Kuzminski <marcin@python-works.com>
parents: 493
diff changeset
39 CELERYD_MAX_TASKS_PER_CHILD = 3
467
3fc3ce53659b starting celery branch
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
40
493
2256c78afe53 implemented basic autoupdating statistics fetched from database
Marcin Kuzminski <marcin@python-works.com>
parents: 484
diff changeset
41 #Tasks will never be sent to the queue, but executed locally instead.
2256c78afe53 implemented basic autoupdating statistics fetched from database
Marcin Kuzminski <marcin@python-works.com>
parents: 484
diff changeset
42 CELERY_ALWAYS_EAGER = False
533
53aa1ee1af86 updated tests for new version 6char password etc...
Marcin Kuzminski <marcin@python-works.com>
parents: 512
diff changeset
43 if PYLONS_CONFIG_NAME == 'test.ini':
53aa1ee1af86 updated tests for new version 6char password etc...
Marcin Kuzminski <marcin@python-works.com>
parents: 512
diff changeset
44 #auto eager for tests
53aa1ee1af86 updated tests for new version 6char password etc...
Marcin Kuzminski <marcin@python-works.com>
parents: 512
diff changeset
45 CELERY_ALWAYS_EAGER = True
493
2256c78afe53 implemented basic autoupdating statistics fetched from database
Marcin Kuzminski <marcin@python-works.com>
parents: 484
diff changeset
46
2256c78afe53 implemented basic autoupdating statistics fetched from database
Marcin Kuzminski <marcin@python-works.com>
parents: 484
diff changeset
47 #===============================================================================
2256c78afe53 implemented basic autoupdating statistics fetched from database
Marcin Kuzminski <marcin@python-works.com>
parents: 484
diff changeset
48 # EMAIL SETTINGS
2256c78afe53 implemented basic autoupdating statistics fetched from database
Marcin Kuzminski <marcin@python-works.com>
parents: 484
diff changeset
49 #===============================================================================
2256c78afe53 implemented basic autoupdating statistics fetched from database
Marcin Kuzminski <marcin@python-works.com>
parents: 484
diff changeset
50 pylons_email_config = dict(config.items('DEFAULT'))
2256c78afe53 implemented basic autoupdating statistics fetched from database
Marcin Kuzminski <marcin@python-works.com>
parents: 484
diff changeset
51
2256c78afe53 implemented basic autoupdating statistics fetched from database
Marcin Kuzminski <marcin@python-works.com>
parents: 484
diff changeset
52 CELERY_SEND_TASK_ERROR_EMAILS = True
2256c78afe53 implemented basic autoupdating statistics fetched from database
Marcin Kuzminski <marcin@python-works.com>
parents: 484
diff changeset
53
2256c78afe53 implemented basic autoupdating statistics fetched from database
Marcin Kuzminski <marcin@python-works.com>
parents: 484
diff changeset
54 #List of (name, email_address) tuples for the admins that should receive error e-mails.
2256c78afe53 implemented basic autoupdating statistics fetched from database
Marcin Kuzminski <marcin@python-works.com>
parents: 484
diff changeset
55 ADMINS = [('Administrator', pylons_email_config.get('email_to'))]
2256c78afe53 implemented basic autoupdating statistics fetched from database
Marcin Kuzminski <marcin@python-works.com>
parents: 484
diff changeset
56
2256c78afe53 implemented basic autoupdating statistics fetched from database
Marcin Kuzminski <marcin@python-works.com>
parents: 484
diff changeset
57 #The e-mail address this worker sends e-mails from. Default is "celery@localhost".
2256c78afe53 implemented basic autoupdating statistics fetched from database
Marcin Kuzminski <marcin@python-works.com>
parents: 484
diff changeset
58 SERVER_EMAIL = pylons_email_config.get('error_email_from')
2256c78afe53 implemented basic autoupdating statistics fetched from database
Marcin Kuzminski <marcin@python-works.com>
parents: 484
diff changeset
59
2256c78afe53 implemented basic autoupdating statistics fetched from database
Marcin Kuzminski <marcin@python-works.com>
parents: 484
diff changeset
60 #The mail server to use. Default is "localhost".
2256c78afe53 implemented basic autoupdating statistics fetched from database
Marcin Kuzminski <marcin@python-works.com>
parents: 484
diff changeset
61 MAIL_HOST = pylons_email_config.get('smtp_server')
2256c78afe53 implemented basic autoupdating statistics fetched from database
Marcin Kuzminski <marcin@python-works.com>
parents: 484
diff changeset
62
2256c78afe53 implemented basic autoupdating statistics fetched from database
Marcin Kuzminski <marcin@python-works.com>
parents: 484
diff changeset
63 #Username (if required) to log on to the mail server with.
2256c78afe53 implemented basic autoupdating statistics fetched from database
Marcin Kuzminski <marcin@python-works.com>
parents: 484
diff changeset
64 MAIL_HOST_USER = pylons_email_config.get('smtp_username')
2256c78afe53 implemented basic autoupdating statistics fetched from database
Marcin Kuzminski <marcin@python-works.com>
parents: 484
diff changeset
65
2256c78afe53 implemented basic autoupdating statistics fetched from database
Marcin Kuzminski <marcin@python-works.com>
parents: 484
diff changeset
66 #Password (if required) to log on to the mail server with.
2256c78afe53 implemented basic autoupdating statistics fetched from database
Marcin Kuzminski <marcin@python-works.com>
parents: 484
diff changeset
67 MAIL_HOST_PASSWORD = pylons_email_config.get('smtp_password')
2256c78afe53 implemented basic autoupdating statistics fetched from database
Marcin Kuzminski <marcin@python-works.com>
parents: 484
diff changeset
68
2256c78afe53 implemented basic autoupdating statistics fetched from database
Marcin Kuzminski <marcin@python-works.com>
parents: 484
diff changeset
69 MAIL_PORT = pylons_email_config.get('smtp_port')
2256c78afe53 implemented basic autoupdating statistics fetched from database
Marcin Kuzminski <marcin@python-works.com>
parents: 484
diff changeset
70
2256c78afe53 implemented basic autoupdating statistics fetched from database
Marcin Kuzminski <marcin@python-works.com>
parents: 484
diff changeset
71
2256c78afe53 implemented basic autoupdating statistics fetched from database
Marcin Kuzminski <marcin@python-works.com>
parents: 484
diff changeset
72 #===============================================================================
2256c78afe53 implemented basic autoupdating statistics fetched from database
Marcin Kuzminski <marcin@python-works.com>
parents: 484
diff changeset
73 # INSTRUCTIONS FOR RABBITMQ
2256c78afe53 implemented basic autoupdating statistics fetched from database
Marcin Kuzminski <marcin@python-works.com>
parents: 484
diff changeset
74 #===============================================================================
2256c78afe53 implemented basic autoupdating statistics fetched from database
Marcin Kuzminski <marcin@python-works.com>
parents: 484
diff changeset
75 # rabbitmqctl add_user rabbitmq qweqwe
2256c78afe53 implemented basic autoupdating statistics fetched from database
Marcin Kuzminski <marcin@python-works.com>
parents: 484
diff changeset
76 # rabbitmqctl add_vhost rabbitmqhost
2256c78afe53 implemented basic autoupdating statistics fetched from database
Marcin Kuzminski <marcin@python-works.com>
parents: 484
diff changeset
77 # rabbitmqctl set_permissions -p rabbitmqhost rabbitmq ".*" ".*" ".*"