-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathserver.py
42 lines (31 loc) · 997 Bytes
/
server.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
import logging
import json
from docopt import docopt
from obnl.core.impl.server import Scheduler
# This doc is used by docopt to make the server callable by command line and gather easily all the given parameters
doc = """>>> IntegrCiTy obnl command <<<
Usage:
server.py (<host> <graph> <schedule>)
server.py -h | --help
server.py --version
Options
-h --help show this
--version show version
"""
if __name__ == "__main__":
args = docopt(doc, version='0.0.1')
Scheduler.activate_console_logging(logging.DEBUG)
with open(args["<graph>"]) as json_data:
graph_data = json.load(json_data)
with open(args["<schedule>"]) as json_data:
schedule_data = json.load(json_data)
c = Scheduler(
host=args["<host>"],
vhost='obnl_vhost',
username='obnl',
password='obnl',
config_file='config_file.json',
simu_data=graph_data,
schedule_data=schedule_data,
log_level=logging.DEBUG)
c.start()