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 <[email protected]>
Reviewed-on: https://gerrit.ovirt.org/38465
Reviewed-by: Francesco Romani <[email protected]>
Reviewed-by: Allon Mureinik <[email protected]>
Reviewed-by: Adam Litke <[email protected]>
Reviewed-by: Yaniv Bronhaim <[email protected]>
Reviewed-by: Dan Kenigsberg <[email protected]>
---
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 <[email protected]>
Gerrit-Reviewer: Adam Litke <[email protected]>
Gerrit-Reviewer: Allon Mureinik <[email protected]>
Gerrit-Reviewer: Dan Kenigsberg <[email protected]>
Gerrit-Reviewer: Francesco Romani <[email protected]>
Gerrit-Reviewer: Nir Soffer <[email protected]>
Gerrit-Reviewer: Yaniv Bronhaim <[email protected]>
Gerrit-Reviewer: [email protected]
Gerrit-Reviewer: oVirt Jenkins CI Server
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to