Ticket #37442: celeryconfig.py

File celeryconfig.py, 2.2 KB (added by marcop@…, 12 years ago)
Line 
1# -*- coding: utf-8 -*-
2# vim: tabstop=4 shiftwidth=4 softtabstop=4
3
4# Copyright (c) 2010-2012, GEM Foundation.
5#
6# OpenQuake is free software: you can redistribute it and/or modify it
7# under the terms of the GNU Affero General Public License as published
8# by the Free Software Foundation, either version 3 of the License, or
9# (at your option) any later version.
10#
11# OpenQuake is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14# GNU General Public License for more details.
15#
16# You should have received a copy of the GNU Affero General Public License
17# along with OpenQuake.  If not, see <http://www.gnu.org/licenses/>.
18
19
20"""
21Config for all installed OpenQuake binaries and modules.
22Should be installed by setup.py into /etc/openquake
23eventually.
24"""
25
26import os
27import sys
28
29from openquake.utils import config
30
31
32config.abort_if_no_config_available()
33
34sys.path.insert(0, os.path.dirname(__file__))
35
36amqp = config.get_section("amqp")
37
38BROKER_HOST = amqp.get("host")
39BROKER_PORT = int(amqp.get("port"))
40BROKER_USER = amqp.get("user")
41BROKER_PASSWORD = amqp.get("password")
42BROKER_VHOST = amqp.get("vhost")
43
44CELERY_RESULT_BACKEND = "amqp"
45
46# CELERY_ACKS_LATE and CELERYD_PREFETCH_MULTIPLIER settings help evenly
47# distribute tasks across the cluster. This configuration is intended
48# make worker processes reserve only a single task at any given time.
49# (The default settings for prefetching define that each worker process will
50# reserve 4 tasks at once. For long running calculations with lots of long,
51# heavy tasks, this greedy prefetching is not recommended and can result in
52# performance issues with respect to cluster utilization.)
53CELERY_ACKS_LATE = True
54CELERYD_PREFETCH_MULTIPLIER = 1
55
56
57CELERY_IMPORTS = (
58    "openquake.calculators.hazard.classical.core",
59    "openquake.calculators.hazard.classical.post_processing",
60    "openquake.calculators.hazard.event_based.core_next",
61    "openquake.calculators.hazard.event_based.post_processing",
62    "openquake.calculators.risk.classical.core",
63    "openquake.calculators.risk.classical_bcr.core",
64    "tests.utils.tasks")
65
66os.environ["DJANGO_SETTINGS_MODULE"] = "openquake.settings"