aboutsummaryrefslogtreecommitdiffstats
path: root/python/task_runner.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/task_runner.py')
-rw-r--r--python/task_runner.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/python/task_runner.py b/python/task_runner.py
index 5fcf8070..3c8ca247 100644
--- a/python/task_runner.py
+++ b/python/task_runner.py
@@ -1,7 +1,6 @@
import logging
from systemd.daemon import notify
-from systemd import journal
from db import dbconn
from common import get_redis_queue
from tasks import Rpc
@@ -13,11 +12,15 @@ def run():
while True:
rpc = Rpc.from_json(q.blpop("tasks")[1].decode('utf-8'))
- journal.send("Running '{}'".format(rpc.fun), ARGS=rpc.args)
+ print("Running '{}' with {}".format(rpc.fun, rpc.args))
if rpc.fun == 'generate_scenarios':
rpc.args += [ET]
- rpc()
- journal.send("'{}' completed".format(rpc.fun))
+ try:
+ rpc()
+ except CalledProcessError:
+ print("'{}' did not complete".format(rpc.fun))
+ else:
+ print("'{}' completed".format(rpc.fun))
if rpc.fun == "build_portfolios":
q.rpush("tasks", str(Rpc('build_scenarios', rpc.args)))
if rpc.fun == "build_scenarios":