Change in vdsm[master]: utils: Create AsyncProcessOperation
abaron at redhat.com
abaron at redhat.com
Mon Oct 7 14:17:18 UTC 2013
Ayal Baron has posted comments on this change.
Change subject: utils: Create AsyncProcessOperation
......................................................................
Patch Set 9:
(5 comments)
....................................................
File lib/vdsm/utils.py
Line 914:
Line 915: time.sleep(sleep)
Line 916:
Line 917:
Line 918: class AsyncProcessOperation(object):
why is this a separate class and not part of AsyncProc?
Line 919: def __init__(self, proc, resultParser=None):
Line 920: """Wraps a running process operation.
Line 921:
Line 922: resultParser should be of type callback(rc, out, err) and can return
Line 933: the condition has been met"""
Line 934: return self._proc.wait(timeout, cond)
Line 935:
Line 936: def stop(self):
Line 937: """Stops the running operaions, effectively sending a kill signal to
s/operaions/operations/
Line 938: the process"""
Line 939: self._proc.kill()
Line 940:
Line 941: def result(self):
Line 938: the process"""
Line 939: self._proc.kill()
Line 940:
Line 941: def result(self):
Line 942: """Returns the result in the as a tuple of (result, error).
'in the' what?
Line 943: if the operation is still running it will block until it returns.
Line 944:
Line 945: The if no resultParser has been set the default result
Line 946: is (rc, out, err) """
Line 941: def result(self):
Line 942: """Returns the result in the as a tuple of (result, error).
Line 943: if the operation is still running it will block until it returns.
Line 944:
Line 945: The if no resultParser has been set the default result
'The if no'?
Line 946: is (rc, out, err) """
Line 947: with self._lock:
Line 948: if self._result is None:
Line 949: out, err = self._proc.communicate()
Line 956: self._result = (None, e)
Line 957: else:
Line 958: self._result = ((rc, out, err), None)
Line 959:
Line 960: self._done = True
this is never used
Line 961:
Line 962: return self._result
Line 963:
Line 964: def __del__(self):
--
To view, visit http://gerrit.ovirt.org/19254
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I79d0eefc9d917a4a93916d52867fb4f1e793c60e
Gerrit-PatchSet: 9
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Saggi Mizrahi <smizrahi at redhat.com>
Gerrit-Reviewer: Ayal Baron <abaron at redhat.com>
Gerrit-Reviewer: Barak Azulay <bazulay at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Eduardo <ewarszaw at redhat.com>
Gerrit-Reviewer: Federico Simoncelli <fsimonce at redhat.com>
Gerrit-Reviewer: Saggi Mizrahi <smizrahi at redhat.com>
Gerrit-Reviewer: Yaniv Bronhaim <ybronhei at redhat.com>
Gerrit-Reviewer: Yeela Kaplan <ykaplan at redhat.com>
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes
More information about the vdsm-patches
mailing list