Commit 64d4e428 authored by Samuel GAIST's avatar Samuel GAIST Committed by André Anjos

[utils][commands][scheduler] Decode message if python is lower than 3.6

Python json module takes only str up to 3.6. Therefore decode
the message received if we are running a python version lower
than 3.6.
parent 5153acb1
......@@ -29,6 +29,7 @@
import logging
import signal
import json
import sys
from django.core.management.base import BaseCommand
from django.conf import settings
......@@ -142,6 +143,9 @@ class Command(BaseCommand):
elif status == BCP.BCPP_JOB_DONE:
output = reply[3]
if sys.version_info < (3, 6):
output = output.decode("utf-8")
logger.info(
"Job split {} was was done by worker {}".format(
split_id, worker_id
......@@ -170,6 +174,8 @@ class Command(BaseCommand):
elif status == BCP.BCPP_JOB_ERROR:
message = reply[3]
if sys.version_info < (3, 6):
message = message.decode("utf-8")
logger.info(
"Job split {} processed by worker {} failed:\n{}".format(
split_id, worker_id, message
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment