-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathworker.py
executable file
·50 lines (35 loc) · 1 KB
/
worker.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
#!/usr/bin/env python3
import os
import sys
import json
import yaml
#import ecto
from opendm import config
from stages.odm_app import ODMApp
print("[worker] Starting")
arg_file = os.environ.get('ODM_SETTINGS')
print("[worker] settings file: " + arg_file)
if arg_file is None:
print("[worker] raising missing argument")
raise ValueError("Missing settings file environment variable")
newsettings = None
print("[worker] loading settings")
with open(arg_file) as in_f:
newsettings = yaml.safe_load(in_f)
if not newsettings:
print("[worker] bad argument file")
raise ValueError("Invalid argument file passed in")
print("[worker] getting config")
args = config.config()
print("[worker] merging config")
for name in newsettings:
setattr(args, name, newsettings[name])
print("[worker] Starting")
app = ODMApp(args=args)
app.execute()
# create a plasm that only contains the BlackBox
#plasm = ecto.Plasm()
#plasm.insert(app)
# execute the plasm
#plasm.execute(niter=1)
print("[worker] finishing")