diff options
author | BonfaceKilz | 2021-03-10 13:36:24 +0300 |
---|---|---|
committer | BonfaceKilz | 2021-03-10 13:36:24 +0300 |
commit | a81b01836886fc6e15ee23647f26b6bfd563c4cf (patch) | |
tree | 035060fed83086e7550c1c611a2009c6e446b1b4 /sheepdog/worker.py | |
parent | e3a871e023d66495574f9b096036ae6d438629fd (diff) | |
download | genenetwork3-a81b01836886fc6e15ee23647f26b6bfd563c4cf.tar.gz |
Use the correct redis cmd when updating variables
Diffstat (limited to 'sheepdog/worker.py')
-rw-r--r-- | sheepdog/worker.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/sheepdog/worker.py b/sheepdog/worker.py index 403f944..55dccc2 100644 --- a/sheepdog/worker.py +++ b/sheepdog/worker.py @@ -18,15 +18,14 @@ def run_jobs(conn): from gn3.commands import run_cmd cmd_id = str(conn.lpop("GN3::job-queue")) if bool(cmd_id): - cmd = conn.hget("cmd", cmd_id) - if cmd and (str(conn.hget(cmd, "status")) not in ["success", - "error"]): + cmd = conn.hget(name=cmd_id, key="cmd") + if cmd and (str(conn.hget(cmd, "status")) == "queued"): result = run_cmd(cmd) - cmd.hset("result", result.get("output"), cmd_id) + conn.hset(name=cmd_id, key="result", value=result.get("output")) if result.get("code") == 0: # Success - cmd.hset("status", "success", cmd_id) + conn.hset(name=cmd_id, key="status", value="success") else: - cmd.hset("status", "error", cmd_id) + conn.hset(name=cmd_id, key="status", value="error") if __name__ == "__main__": |