Change in vdsm[master]: misc: Safer and simpler itmap

amureini at redhat.com amureini at redhat.com
Wed Mar 25 08:34:07 UTC 2015


Allon Mureinik has posted comments on this change.

Change subject: misc: Safer and simpler itmap
......................................................................


Patch Set 3:

(3 comments)

https://gerrit.ovirt.org/#/c/39119/3//COMMIT_MSG
Commit Message:

Line 8: 
Line 9: The previous code had few issues:
Line 10: 
Line 11: - It used unlimited number of threads by default. This may lead to
Line 12:   creation of 100's of threads if you do not specify a value.
s/100's/hundreds/, s/creation/the creation/
Line 13: - It used non-daemon threads, which could lead to unwanted delay during
Line 14:   vdsm shutdown.
Line 15: - It tried to yield results before all arguments were handled. This
Line 16:   could lead to unwanted delay in argument processing, if the caller


Line 19:   number of values.
Line 20: - If invalid maxthreads was given, the ValueError was intialized with a
Line 21:   tuple ("Wrong input to function itmap: %s", maxthreads) instead of
Line 22:   a formatted string.
Line 23: - It was too complicated.
I'm not a fan of such vague statements. IMHO, either elaborate it or drop it.
Line 24: 
Line 25: Changes:
Line 26: 
Line 27: - The caller must specify the maximum number of threads.


https://gerrit.ovirt.org/#/c/39119/3/tests/miscTests.py
File tests/miscTests.py:

Line 213:         def dummy(arg):
Line 214:             raise err
Line 215: 
Line 216:         data = [1, 2, 3]
Line 217:         self.assertEqual(list(misc.itmap(dummy, data, 4)), [err] * len(data))
Just for the fun of it, I'd add a test with maxthreads = 2 (< len(data)).
Not that I expect it to fail, but I think it has a nice declarative value to show you thought of this usecase and verified it works properly.
Line 218: 
Line 219: 
Line 220: class RotateFiles(TestCaseBase):
Line 221: 


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Iba6116ac4003702c8e921cebaf494491a6f9afaf
Gerrit-PatchSet: 3
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: Federico Simoncelli <fsimonce 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