Change in vdsm[master]: lib: Simplify and generalize concurrent.tmap()

fromani at redhat.com fromani at redhat.com
Mon Mar 16 11:38:52 UTC 2015


Francesco Romani has posted comments on this change.

Change subject: lib: Simplify and generalize concurrent.tmap()
......................................................................


Patch Set 2: Code-Review+1

(1 comment)

This patch makes the code nicer. But I'm not sure about the longer term direction.

https://gerrit.ovirt.org/#/c/38465/2/lib/vdsm/concurrent.py
File lib/vdsm/concurrent.py:

Line 36:             results[i] = Result(False, e)
Line 37: 
Line 38:     threads = []
Line 39:     for i, arg in enumerate(args):
Line 40:         t = threading.Thread(target=worker, args=(i, func, arg))
let me stress again that I'm ok with this patch. This is just a general observation, which we may want to move on the ML.

So we basically fire up and shut down a tailor-made thread pool for each invocation.
This is not the best practice even when threads aren't crippled as they are in CPython.

For future patch/discussion: what about having a generic thread pool (maybe an Executor) and just adding utilities like this one on top of it?
Line 41:         t.daemon = True
Line 42:         t.start()
Line 43:         threads.append(t)
Line 44: 


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I4337db65fe1b326157507b1424a8b4924b91210f
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer 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
Gerrit-HasComments: Yes


More information about the vdsm-patches mailing list