Nir Soffer has posted comments on this change.
Change subject: jobs: Add when_finished callback and wire up abort
......................................................................
Patch Set 2:
(2 comments)
https://gerrit.ovirt.org/#/c/61254/2/vdsm/storage/sdm/api/base.py
File vdsm/storage/sdm/api/base.py:
Line 55: finally:
Line 56: vars.job_id = None
Line 57:
Line 58: def abort(self):
Line 59: super(Job, self).abort()
This style, calling parent implementation makes the code hard to understand and the code
fragile - anything you do in the super class may break the subclass or the other way
around.
Lets avoid it in new code.
Line 60: self._finished_cb()
Line 61:
Line 62: def when_finished(self, fn, *args, **kwargs):
Line 59: super(Job, self).abort()
Line 60: self._finished_cb()
Line 61:
Line 62: def when_finished(self, fn, *args, **kwargs):
Line 63: self._finished_cb = functools.partial(fn, *args, **kwargs)
This is not simple and direct code you mentioned in another patch.
--
To view, visit
https://gerrit.ovirt.org/61254
To unsubscribe, visit
https://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I73d4c167a4cf1f1da4c1e2629b7afa9c01d338fd
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke <alitke(a)redhat.com>
Gerrit-Reviewer: Adam Litke <alitke(a)redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Nir Soffer <nsoffer(a)redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation(a)ovirt.org>
Gerrit-HasComments: Yes