-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathparameters.py
executable file
·62 lines (51 loc) · 1.71 KB
/
parameters.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import os
import redis
# Job Queue Prefix
JOB_QUEUE_PREFIX = "jqueue_service_"
# Backend configuration - Rabbitmq
broker_protocol = "pyamqp"
broker_username = os.getenv("RABBIT_USER", "admin")
broker_password = os.getenv("RABBIT_PASS", "mypass")
broker_server = os.getenv("RABBIT_SERVER", "jqueuer-rabbit")
broker_port = os.getenv("RABBIT_PORT", 5672)
# Jqueuer job max retries configuration
jqueuer_job_max_retries = int(os.getenv("JQUEUER_JOB_MAX_RETRIES", "3"))
node_id = os.getenv("JQUEUER_HOST_IP", "default_id_1")
# JQueuer Manager Service configuration
JQUEUER_SERVER = os.getenv("JQUEUER_MANAGER_SERVICE_NAME", "jqueuer-manager")
JQUEUER_PORT = os.getenv("JQUEUER_MANAGER_SERVICE_PORT", "8081")
jqueuer_service_url = "http://" + JQUEUER_SERVER + ":" + JQUEUER_PORT + "/experiment/metrics"
def broker():
broker = broker_protocol + "://" + broker_username
if broker_password != "":
broker = broker + ":" + broker_password
broker = broker + "@" + broker_server + ":" + str(broker_port) + "//"
return broker
# Redis Backend configuration
backend_protocol = "redis"
backend_server = os.getenv("REDIS_SERVER", "jqueuer-redis")
backend_password = os.getenv("REDIS_PASS", "mypass")
backend_port = os.getenv("REDIS_PORT", 6379)
backend_db = 0
backend_experiment_db_id = 10
backend_experiment_db = redis.Redis(
host=backend_server,
port=backend_port,
password=backend_password,
db=backend_experiment_db_id,
charset="utf-8",
decode_responses=True,
)
def backend(db):
backend = (
backend_protocol
+ "://:"
+ backend_password
+ "@"
+ backend_server
+ ":"
+ str(backend_port)
+ "/"
+ str(db)
)
return backend