From fcd005f61cab961eb8f89a41756e3bb3e4ebcc0f Mon Sep 17 00:00:00 2001 From: Joshua Harlow Date: Wed, 8 Jul 2015 17:55:23 -0700 Subject: [PATCH] Add more useful `__str__` to redis job The information about the sequence and the owner_key is useful for debugging and for interacting with redis if the owner key ever needs to be manually removed. Change-Id: Ibe751d15938a2bcb83fb057f4c139f8f0022a60b --- taskflow/jobs/backends/impl_redis.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/taskflow/jobs/backends/impl_redis.py b/taskflow/jobs/backends/impl_redis.py index 4d61dc01..1b06b691 100644 --- a/taskflow/jobs/backends/impl_redis.py +++ b/taskflow/jobs/backends/impl_redis.py @@ -187,6 +187,13 @@ class RedisJob(base.Job): listings_key, owner_key, value_from_callable=True) + def __str__(self): + """Pretty formats the job into something *more* meaningful.""" + tpl = "%s: %s (uuid=%s, owner_key=%s, sequence=%s, details=%s)" + return tpl % (type(self).__name__, + self.name, self.uuid, self.owner_key, + self.sequence, self.details) + class RedisJobBoard(base.JobBoard): """A jobboard backed by `redis`_.