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 | """ |
---|
21 | Config for all installed OpenQuake binaries and modules. |
---|
22 | Should be installed by setup.py into /etc/openquake |
---|
23 | eventually. |
---|
24 | """ |
---|
25 | |
---|
26 | import os |
---|
27 | import sys |
---|
28 | |
---|
29 | from openquake.utils import config |
---|
30 | |
---|
31 | |
---|
32 | config.abort_if_no_config_available() |
---|
33 | |
---|
34 | sys.path.insert(0, os.path.dirname(__file__)) |
---|
35 | |
---|
36 | amqp = config.get_section("amqp") |
---|
37 | |
---|
38 | BROKER_HOST = amqp.get("host") |
---|
39 | BROKER_PORT = int(amqp.get("port")) |
---|
40 | BROKER_USER = amqp.get("user") |
---|
41 | BROKER_PASSWORD = amqp.get("password") |
---|
42 | BROKER_VHOST = amqp.get("vhost") |
---|
43 | |
---|
44 | CELERY_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.) |
---|
53 | CELERY_ACKS_LATE = True |
---|
54 | CELERYD_PREFETCH_MULTIPLIER = 1 |
---|
55 | |
---|
56 | |
---|
57 | CELERY_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 | |
---|
66 | os.environ["DJANGO_SETTINGS_MODULE"] = "openquake.settings" |
---|