Shu Ming has posted comments on this change.
Change subject: Adding threads limitation to misc.tmap
......................................................................
Patch Set 2: (2 inline comments)
....................................................
File vdsm/storage/misc.py
Line 1227: if maxthreads < 1 and maxthreads != UNLIMITED_THREADS:
Line 1228: raise ValueError("Wrong input passed to function tmap: %s",
maxthreads)
Line 1229:
Line 1230: resultsDict = {}
Line 1231: error = [None]
Interesting, so it a way to make error[0] assignment in wrapper() to be
effective outside of wrapper().
Line 1232:
Line 1233: def wrapper(f, arg, index):
Line 1234: try:
Line 1235: resultsDict[index] = f(arg)
Line 1252: if threadsQueue.full():
Line 1253: # Wait for the first unfinished thread in list to finish
if we
Line 1254: # have already initiate all possible thread's slots
(maxthreads)
Line 1255: if threadsQueue.empty():
Line 1256: raise RuntimeError("Queue is empty")
If it is that, why not use more intuitive way to check that like:
if maxthreads < 1:
Line 1257: else:
Line 1258: threadsQueue.get_nowait().join()
Line 1259: t = threading.Thread(target=wrapper, args=(func, arg, i))
Line 1260: threadsQueue.put_nowait(t)
--
To view, visit http://gerrit.ovirt.org/8858
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I07845bfd78b9215e8994ac2ebe46a7ff78c85625
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Yaniv Bronhaim <[email protected]>
Gerrit-Reviewer: Dan Kenigsberg <[email protected]>
Gerrit-Reviewer: Saggi Mizrahi <[email protected]>
Gerrit-Reviewer: ShaoHe Feng <[email protected]>
Gerrit-Reviewer: Shu Ming <[email protected]>
Gerrit-Reviewer: Yaniv Bronhaim <[email protected]>
Gerrit-Reviewer: Zhou Zheng Sheng <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches