From a81b01836886fc6e15ee23647f26b6bfd563c4cf Mon Sep 17 00:00:00 2001 From: BonfaceKilz Date: Wed, 10 Mar 2021 13:36:24 +0300 Subject: Use the correct redis cmd when updating variables --- sheepdog/worker.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'sheepdog') 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__": -- cgit v1.2.3