Merge pull request #628 from SkyLothar/master

make sure state and exc_info is text_type
main
Vincent Driessen 9 years ago
commit 6fe277bb6c

@ -413,7 +413,7 @@ class Job(object):
self.started_at = to_date(as_text(obj.get('started_at'))) self.started_at = to_date(as_text(obj.get('started_at')))
self.ended_at = to_date(as_text(obj.get('ended_at'))) self.ended_at = to_date(as_text(obj.get('ended_at')))
self._result = unpickle(obj.get('result')) if obj.get('result') else None # noqa self._result = unpickle(obj.get('result')) if obj.get('result') else None # noqa
self.exc_info = obj.get('exc_info') self.exc_info = as_text(obj.get('exc_info'))
self.timeout = int(obj.get('timeout')) if obj.get('timeout') else None self.timeout = int(obj.get('timeout')) if obj.get('timeout') else None
self.result_ttl = int(obj.get('result_ttl')) if obj.get('result_ttl') else None # noqa self.result_ttl = int(obj.get('result_ttl')) if obj.get('result_ttl') else None # noqa
self._status = as_text(obj.get('status') if obj.get('status') else None) self._status = as_text(obj.get('status') if obj.get('status') else None)

@ -114,7 +114,7 @@ class Worker(object):
name = worker_key[len(prefix):] name = worker_key[len(prefix):]
worker = cls([], name, connection=connection) worker = cls([], name, connection=connection)
queues = as_text(connection.hget(worker.key, 'queues')) queues = as_text(connection.hget(worker.key, 'queues'))
worker._state = connection.hget(worker.key, 'state') or '?' worker._state = as_text(connection.hget(worker.key, 'state') or '?')
worker._job_id = connection.hget(worker.key, 'current_job') or None worker._job_id = connection.hget(worker.key, 'current_job') or None
if queues: if queues:
worker.queues = [cls.queue_class(queue, connection=connection) worker.queues = [cls.queue_class(queue, connection=connection)

Loading…
Cancel
Save