diff options
| -rw-r--r-- | python/client.py | 4 | ||||
| -rw-r--r-- | python/master.py | 2 | ||||
| -rw-r--r-- | python/tasks.py | 4 |
3 files changed, 7 insertions, 3 deletions
diff --git a/python/client.py b/python/client.py index 177ab1ed..1652ce4b 100644 --- a/python/client.py +++ b/python/client.py @@ -13,6 +13,6 @@ while True: f, args = loads(q.blpop("tasks")[1]) getattr(tasks, f)(*args) if f == "build_portfolio": - q.rpush("tasks", dumps(("build_scenarios", args))) + q.rpush("tasks", dumps(("build_scenarios", args), protocol=2)) if f == "build_scenarios": - q.rpush("tasks", dumps(("generate_scenarios", args[:-1]))) + q.rpush("tasks", dumps(("gen_scenarios", args[:-1]), protocol=2)) diff --git a/python/master.py b/python/master.py index 982eb3ee..60bea7b4 100644 --- a/python/master.py +++ b/python/master.py @@ -18,6 +18,6 @@ while True: with open(dealsfile) as fh: for line in fh: dealname, reinvflag = line.rstrip().split("\t") - q.rpush("tasks", dumps(("build_portfolio", [workdate, dealname, reinvflag]))) + q.rpush("tasks", dumps(("build_portfolio", [workdate, dealname, reinvflag]), protocol=2)) os.unlink(dealsfile) time.sleep(3) diff --git a/python/tasks.py b/python/tasks.py index e8db6d26..41465f13 100644 --- a/python/tasks.py +++ b/python/tasks.py @@ -1,5 +1,6 @@ import subprocess from intex_scenarios import generate_scenarios +from common import conn import os if os.name =='nt': @@ -21,3 +22,6 @@ def build_scenarios(workdate, dealname, reinvflag): workdate, dealname + "," + reinvflag] with open(os.path.join(logpath, "build_scenarios.Rout"), "w") as fh: subprocess.call(args, stderr = subprocess.STDOUT, stdout = fh) + +def gen_scenarios(workdate, dealname): + generate_scenarios(conn, workdate, dealname) |
