diff options
author | BonfaceKilz | 2021-03-10 14:26:01 +0300 |
---|---|---|
committer | BonfaceKilz | 2021-03-10 14:26:01 +0300 |
commit | 9170e293e896d1d283d3b19d79d673c9a92724d2 (patch) | |
tree | 7caecfc8ff45ae760e3e9d1c89dbac99860a1d59 /sheepdog | |
parent | a81b01836886fc6e15ee23647f26b6bfd563c4cf (diff) | |
download | genenetwork3-9170e293e896d1d283d3b19d79d673c9a92724d2.tar.gz |
Fix encoding issues with worker
Diffstat (limited to 'sheepdog')
-rw-r--r-- | sheepdog/worker.py | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/sheepdog/worker.py b/sheepdog/worker.py index 55dccc2..6299ca7 100644 --- a/sheepdog/worker.py +++ b/sheepdog/worker.py @@ -5,22 +5,19 @@ import time import redis import redis.connection - # Enable importing from one dir up since gn3 isn't installed as a globally -sys.path.append( - os.path.abspath(os.path.join(os.path.dirname(__file__), - '..'))) +sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) def run_jobs(conn): """Process the redis using a redis connection, CONN""" # pylint: disable=E0401, C0415 from gn3.commands import run_cmd - cmd_id = str(conn.lpop("GN3::job-queue")) + cmd_id = (conn.lpop("GN3::job-queue") or b'').decode("utf-8") if bool(cmd_id): cmd = conn.hget(name=cmd_id, key="cmd") - if cmd and (str(conn.hget(cmd, "status")) == "queued"): - result = run_cmd(cmd) + if cmd and (conn.hget(cmd, "status") == b"queued"): + result = run_cmd(cmd.decode("utf-8")) conn.hset(name=cmd_id, key="result", value=result.get("output")) if result.get("code") == 0: # Success conn.hset(name=cmd_id, key="status", value="success") |