-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
39 lines (30 loc) · 964 Bytes
/
app.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
from multiprocessing import freeze_support
from spex_common.config import load_config
from spex_common.modules.logging import get_logger
from models.Worker import Worker, get_pool_size
from models.ArangoWorker import Worker as ArangoWorker
from models.ArangoWorker import GarbageWorker
def start_workers():
logger = get_logger('spex.ms-job-manager')
logger.info('Starting')
workers = []
worker = ArangoWorker(0)
workers.append(worker)
worker.start()
worker1 = GarbageWorker(0)
workers.append(worker1)
worker1.start()
for index in range(get_pool_size('WORKERS_POOL')):
worker = Worker(index)
workers.append(worker)
worker.start()
try:
for worker in workers:
worker.join()
except KeyboardInterrupt:
pass
logger.info('Finished')
if __name__ == "__main__":
freeze_support()
load_config()
start_workers()