Saggi Mizrahi has posted comments on this change.

Change subject: itmap starts threads for each argument causes too many oop 
operations
......................................................................


Patch Set 1: I would prefer that you didn't submit this

(4 inline comments)

....................................................
File vdsm/storage/misc.py
Line 1249:     if exception is not None:
Line 1250:         raise exception
Line 1251: 
Line 1252: 
Line 1253: def itmap(func, iterable, maxthreads):
default should be unlimited
Line 1254:     """
Line 1255:     Make an iterator that computes the function using
Line 1256:     arguments from the iterable. It works similar to tmap
Line 1257:     by running each operation in a different thread, this


Line 1268:             respQueue.put(e)
Line 1269: 
Line 1270:     def nextArg(iterable):
Line 1271:         for arg in iterable:
Line 1272:             yield arg
What is this for? Seems redundant.
Line 1273: 
Line 1274:     n = 0
Line 1275:     if maxthreads < 1:
Line 1276:         raise Exception("wrong input to function itmap: %s", 
maxthreads)


Line 1272:             yield arg
Line 1273: 
Line 1274:     n = 0
Line 1275:     if maxthreads < 1:
Line 1276:         raise Exception("wrong input to function itmap: %s", 
maxthreads)
Parameter validation should be at top of method
Line 1277: 
Line 1278:     for arg in nextArg(iterable):
Line 1279:         if not maxthreads:
Line 1280:             if n:


Line 1275:     if maxthreads < 1:
Line 1276:         raise Exception("wrong input to function itmap: %s", 
maxthreads)
Line 1277: 
Line 1278:     for arg in nextArg(iterable):
Line 1279:         if not maxthreads:
compare to 0 when you mean "is it zero"
Line 1280:             if n:
Line 1281:                 yield respQueue.get()
Line 1282:                 # if yield returns one thread stopped, so we can run 
another
Line 1283:                 # simultaneosly thread


--
To view, visit http://gerrit.ovirt.org/8745
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: If2877c28b916475aead16d47d37522c2bf44cc16
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Yaniv Bronhaim <[email protected]>
Gerrit-Reviewer: Saggi Mizrahi <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to