forked from mushkevych/scheduler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
context.py
98 lines (81 loc) · 3.12 KB
/
context.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
__author__ = 'Bohdan Mushkevych'
from constants import *
from system.time_qualifier import *
from scheduler.scheduler_constants import *
from supervisor.supervisor_constants import *
from db.model.queue_context_entry import _queue_context_entry
from db.model.process_context_entry import _process_context_entry
from db.model.timetable_context_entry import _timetable_context_entry
mx_page_context = {
MX_PAGE_FINANCIAL: 'financial details',
MX_PAGE_TRAFFIC: 'traffic details',
}
mq_queue_context = {
QUEUE_REQUESTED_PACKAGES: _queue_context_entry(exchange=EXCHANGE_FREERUN_WORKER,
queue_name=QUEUE_REQUESTED_PACKAGES),
}
process_context = {
PROCESS_GC: _process_context_entry(
process_name=PROCESS_GC,
classname='workers.garbage_collector_worker.GarbageCollectorWorker.start',
token=TOKEN_GC,
time_qualifier=QUALIFIER_BY_SCHEDULE,
exchange=EXCHANGE_UTILS,
process_type=TYPE_GARBAGE_COLLECTOR,
source='units_of_work',
sink='units_of_work'),
PROCESS_SCHEDULER: _process_context_entry(
process_name=PROCESS_SCHEDULER,
classname='scheduler.synergy_scheduler.Scheduler.start',
token=TOKEN_SCHEDULER,
time_qualifier='',
queue='',
routing='',
exchange=''),
PROCESS_SUPERVISOR: _process_context_entry(
process_name=PROCESS_SUPERVISOR,
classname='supervisor.synergy_supervisor.Supervisor.start',
token=TOKEN_SUPERVISOR,
time_qualifier='',
queue='',
routing='',
exchange=''),
PROCESS_LAUNCH_PY: _process_context_entry(
process_name=PROCESS_LAUNCH_PY,
classname='',
token=TOKEN_LAUNCH_PY,
time_qualifier=QUALIFIER_REAL_TIME,
routing=ROUTING_IRRELEVANT,
exchange=EXCHANGE_UTILS)
}
timetable_context = {
TREE_SITE_VERTICAL: _timetable_context_entry(
tree_name=TREE_SITE_VERTICAL,
tree_classname='scheduler.tree.FourLevelTree',
enclosed_processes=[PROCESS_SITE_YEARLY, PROCESS_SITE_MONTHLY, PROCESS_SITE_DAILY, PROCESS_SITE_HOURLY],
dependent_on=[],
mx_name=TOKEN_SITE,
mx_page=MX_PAGE_TRAFFIC),
TREE_CLIENT_HORIZONTAL: _timetable_context_entry(
tree_name=TREE_CLIENT_HORIZONTAL,
tree_classname='scheduler.tree.ThreeLevelTree',
enclosed_processes=[PROCESS_CLIENT_YEARLY, PROCESS_CLIENT_MONTHLY, PROCESS_CLIENT_DAILY],
dependent_on=[TREE_SITE_VERTICAL],
mx_name=TOKEN_CLIENT,
mx_page=MX_PAGE_TRAFFIC),
TREE_LINEAR_DAILY: _timetable_context_entry(
tree_name=TREE_CLIENT_HORIZONTAL,
tree_classname='scheduler.tree.TwoLevelTree',
enclosed_processes=[PROCESS_ALERT_DAILY],
dependent_on=[],
mx_name=TOKEN_ALERT,
mx_page=MX_PAGE_TRAFFIC)
}
try:
from settings import ENVIRONMENT
overrides = __import__('context_' + ENVIRONMENT)
except:
overrides = __import__('context_dev')
process_context.update(overrides.process_context)
mq_queue_context.update(overrides.mq_queue_context)
timetable_context.update(overrides.timetable_context)