Change in vdsm[master]: jobs: Add Job.__repr__ for easier debugging

fromani at redhat.com fromani at redhat.com
Tue Jan 5 16:40:30 UTC 2016


Francesco Romani has posted comments on this change.

Change subject: jobs: Add Job.__repr__ for easier debugging
......................................................................


Patch Set 4: Code-Review+1

(2 comments)

overall looks good, I'm not 100% sold but not enough to stop this patch.

https://gerrit.ovirt.org/#/c/51217/4/lib/vdsm/jobs.py
File lib/vdsm/jobs.py:

Line 126:         s = "<{self.__class__.__name__} id={self.id} status={self.status} "
Line 127:         if self.progress is not None:
Line 128:             s += "progress={self.progress}% "
Line 129:         s += "at 0x{id}>"
Line 130:         return s.format(self=self, id=id(self))
neat!
Line 131: 
Line 132: 
Line 133: # This helper should only be called by test code.  Everything else should be
Line 134: # using the public APIs.


https://gerrit.ovirt.org/#/c/51217/4/tests/jobsTests.py
File tests/jobsTests.py:

Line 216: 
Line 217:     def test_job_repr(self):
Line 218:         job = TestingJob()
Line 219:         rep = repr(job)
Line 220:         self.assertIn("TestingJob", rep)
not sure it is a good idea. We are committing to this format, or at least to these fields. Open question, I don't have strong feelings here, because your choice of fields seems sensible to me.
Line 221:         self.assertIn("id=%s" % job.id, rep)
Line 222:         self.assertIn("status=pending", rep)
Line 223:         self.assertNotIn("progress=", rep)
Line 224: 


-- 
To view, visit https://gerrit.ovirt.org/51217
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I8317fde241d064ae230093610f9aaac750fcf08f
Gerrit-PatchSet: 4
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer at redhat.com>
Gerrit-Reviewer: Adam Litke <alitke at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani at redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Nir Soffer <nsoffer at redhat.com>
Gerrit-Reviewer: Piotr Kliczewski <piotr.kliczewski at gmail.com>
Gerrit-Reviewer: Shahar Havivi <shavivi at redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation at ovirt.org>
Gerrit-HasComments: Yes


More information about the vdsm-patches mailing list