Change in vdsm[master]: lib: Simplify and generalize concurrent.tmap()
danken at redhat.com
danken at redhat.com
Tue Mar 24 14:34:08 UTC 2015
Dan Kenigsberg has submitted this change and it was merged.
Change subject: lib: Simplify and generalize concurrent.tmap()
......................................................................
lib: Simplify and generalize concurrent.tmap()
The previous version of tmap had few issues:
- Used non-daemon threads, so the caller application may be blocked on
shutdown if a mapped function got stuck.
- Assumed that mapped functions do not raise, limiting the usefulness of
this utility.
- Logged exceptions for functions that do raise - libraries should not
log behind you back.
- Dropped all errors but the last one, so the caller could not handle
them.
- Assumed that all errors are equal, and raised the last error.
This version fixes these issues by making tmap() simpler and more
generic. The function is mapped to the values, and the result is a 2
namedtuple (succeeded, value), holding either the result of the
function, or the exception raised by the function.
The caller is responsible now for handling the errors, and logging them
if needed.
Change-Id: I4337db65fe1b326157507b1424a8b4924b91210f
Signed-off-by: Nir Soffer <nsoffer at redhat.com>
Reviewed-on: https://gerrit.ovirt.org/38465
Reviewed-by: Francesco Romani <fromani at redhat.com>
Reviewed-by: Allon Mureinik <amureini at redhat.com>
Reviewed-by: Adam Litke <alitke at redhat.com>
Reviewed-by: Yaniv Bronhaim <ybronhei at redhat.com>
Reviewed-by: Dan Kenigsberg <danken at redhat.com>
---
M lib/vdsm/concurrent.py
M tests/concurrentTests.py
2 files changed, 24 insertions(+), 29 deletions(-)
Approvals:
Adam Litke: Looks good to me, but someone else must approve
Nir Soffer: Verified
Yaniv Bronhaim: Looks good to me, but someone else must approve
Dan Kenigsberg: Looks good to me, approved
Allon Mureinik: Looks good to me, but someone else must approve
Francesco Romani: Looks good to me, but someone else must approve
--
To view, visit https://gerrit.ovirt.org/38465
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I4337db65fe1b326157507b1424a8b4924b91210f
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: Allon Mureinik <amureini at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani at redhat.com>
Gerrit-Reviewer: Nir Soffer <nsoffer at redhat.com>
Gerrit-Reviewer: Yaniv Bronhaim <ybronhei at redhat.com>
Gerrit-Reviewer: automation at ovirt.org
Gerrit-Reviewer: oVirt Jenkins CI Server
More information about the vdsm-patches
mailing list