aboutsummaryrefslogtreecommitdiffstats
path: root/python/client.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/client.py')
-rw-r--r--python/client.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/python/client.py b/python/client.py
index 84e44a50..21eba000 100644
--- a/python/client.py
+++ b/python/client.py
@@ -1,11 +1,15 @@
+import logging
+import os
import redis
+import socket
import tasks
+
from json import loads, dumps
-import socket
-import os
+from db import dbconn
def run():
hostname = socket.gethostname()
+ ET = dbconn('etdb')
if hostname == 'debian':
q = redis.Redis(unix_socket_path='/var/run/redis/redis.sock')
os.environ['OMP_NUM_THREADS'] = '8'
@@ -14,11 +18,17 @@ def run():
os.environ['OMP_NUM_THREADS'] = '4'
while True:
f, args = loads(q.blpop("tasks")[1].decode('utf-8'))
+ if f == 'generate_scenarios':
+ args += [ET]
getattr(tasks, f)(*args)
if f == "build_portfolio":
q.rpush("tasks", dumps(("build_scenarios", args)))
if f == "build_scenarios":
q.rpush("tasks", dumps(("generate_scenarios", args[:-1])))
+ ET.close()
if __name__=="__main__":
+ logger = logging.getLogger('intex')
+ logger.setLevel(logging.INFO)
+ logger.addHandler(logging.StreamHandler())
run()