-
Notifications
You must be signed in to change notification settings - Fork 0
/
matahari.py
42 lines (39 loc) · 1.29 KB
/
matahari.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
from configobj import ConfigObj
import time, sys
from framework import Daemon, Logger, Core, initReporters
from autoload import getReporters
config = ConfigObj('matahari.conf')
logger = Logger(config["LOGGING"])
reporters = initReporters(getReporters(), config["REPORTERS"])
def runtime():
logger.info('main', "App started")
try:
while True:
pass
logger.info('main', "Starting tests")
for runner in config["RUNNERS"].sections:
runnerConfig = config["RUNNERS"][runner]
runnerConfig["logger"] = logger
Core.executeRunner(runnerConfig, reporters)
logger.info('main', "Tests finished: Going to sleep for 30s before next test")
time.sleep(30)
except KeyboardInterrupt:
logger.logInterrupt('main', "Shutting down, bye :)")
except:
logger.logInterrupt('main', "Shutting down with ERRROR!")
raise
finally:
config.write()
daemon = Daemon("/tmp/mathari.pid", runtime)
if len(sys.argv) > 1:
if 'start' == sys.argv[1]:
daemon.start()
elif 'stop' == sys.argv[1]:
daemon.stop()
elif 'restart' == sys.argv[1]:
daemon.restart()
else:
print("Unknown command")
sys.exit(2)
else:
runtime()