summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntoine Musso <hashar@free.fr>2014-04-10 15:50:16 +0200
committerAntoine Musso <hashar@free.fr>2014-05-07 10:12:51 +0000
commit43f5216757567678c3f12d41aa0fca0bfad98c70 (patch)
tree3a4873d676f23a615973ace2a0e242827ef24aaa
parent6b50c24fc86250bafd5c6dc2e0cde3383ae8f131 (diff)
downloadgear-43f5216757567678c3f12d41aa0fca0bfad98c70.tar.gz
Use Job repr instead of handle in Client debug log
The debug log are not that useful since they would only output the job handle. That is often meaningless: DEBUG gear.Client: Job failed; handle: H:127.0.0.1:12222 Instead of the handle, format the string using the job object. BaseJob.__repr__() let us yield the job name which is much more informative for the poor human we are: DEBUG gear.Client: Job failed; <gear.Job 0x123abcd handle: 127.0.0.1:12222 name: my_function unique: no_clue> Change-Id: I06f9203e730061ddd495579836c70f6bbed8f1f3
-rw-r--r--gear/__init__.py24
1 files changed, 12 insertions, 12 deletions
diff --git a/gear/__init__.py b/gear/__init__.py
index 186ffd2..4d2c0c8 100644
--- a/gear/__init__.py
+++ b/gear/__init__.py
@@ -1407,7 +1407,7 @@ class Client(BaseClient):
job.handle = packet.data
packet.connection.related_jobs[job.handle] = job
task.setComplete()
- self.log.debug("Job created; handle: %s" % job.handle)
+ self.log.debug("Job created; %s" % job)
return job
def handleWorkComplete(self, packet):
@@ -1429,8 +1429,8 @@ class Client(BaseClient):
job.complete = True
job.failure = False
del packet.connection.related_jobs[job.handle]
- self.log.debug("Job complete; handle: %s data: %s" %
- (job.handle, job.data))
+ self.log.debug("Job complete; %s data: %s" %
+ (job, job.data))
return job
def handleWorkFail(self, packet):
@@ -1449,7 +1449,7 @@ class Client(BaseClient):
job.complete = True
job.failure = True
del packet.connection.related_jobs[job.handle]
- self.log.debug("Job failed; handle: %s" % job.handle)
+ self.log.debug("Job failed; %s" % job)
return job
def handleWorkException(self, packet):
@@ -1469,8 +1469,8 @@ class Client(BaseClient):
job.complete = True
job.failure = True
del packet.connection.related_jobs[job.handle]
- self.log.debug("Job exception; handle: %s data: %s" %
- (job.handle, job.exception))
+ self.log.debug("Job exception; %s exception: %s" %
+ (job, job.exception))
return job
def handleWorkData(self, packet):
@@ -1487,8 +1487,8 @@ class Client(BaseClient):
data = packet.getArgument(1, True)
if data:
job.data.append(data)
- self.log.debug("Job data; handle: %s data: %s" %
- (job.handle, job.data))
+ self.log.debug("Job data; job: %s data: %s" %
+ (job, job.data))
return job
def handleWorkWarning(self, packet):
@@ -1506,8 +1506,8 @@ class Client(BaseClient):
if data:
job.data.append(data)
job.warning = True
- self.log.debug("Job warning; handle: %s data: %s" %
- (job.handle, job.data))
+ self.log.debug("Job warning; %s data: %s" %
+ (job, job.data))
return job
def handleWorkStatus(self, packet):
@@ -1528,8 +1528,8 @@ class Client(BaseClient):
float(job.denominator))
except Exception:
job.fraction_complete = None
- self.log.debug("Job status; handle: %s complete: %s/%s" %
- (job.handle, job.numerator, job.denominator))
+ self.log.debug("Job status; %s complete: %s/%s" %
+ (job, job.numerator, job.denominator))
return job
def handleStatusRes(self, packet):