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
This commit is contained in:
Joshua Harlow
2015-07-08 17:55:23 -07:00
parent df5fbe469c
commit fcd005f61c

View File

@@ -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`_.