aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sheepdog/worker.py11
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")