fabric.decorators.parallel(<str>) yields unexpected behavior #843

Closed
encryptio opened this Issue Feb 27, 2013 · 2 comments

Projects

None yet

2 participants

@encryptio

Passing a string to the parallel decorator, as in @parallel(pool_size="4"), causes there to be no pool size limit.

Expected behavior: either convert with int() and Do What I Meant, or raise an Exception and get the user of the decorator to pass the correct type.

This came up at justin.tv when we used @parallel(pool_size=config.get(...)), not realizing that the result was a string.

@bitprophet
Member

Thanks! Confirmed replication of bug. Looks like min(("a string heh", some_int_maybe)) fails to explode here, but also doesn't do any casting, which is why you got no traceback & the wrong behavior. (I honestly don't know what min() is doing to the string here, it's rather curious.)

I explicitly added an int() cast to the line that obtains the final value (before min'ing it with the host list length) and this appears to work correctly. Will post bugfix in a sec.

Also, you have good timing, I was going to push out more releases today anyway -- so 1.5.4 will be out soon.

@bitprophet
Member

Derp, wasn't entirely that simple due to some more bad logic that went undetected thanks to min being a piece of crap. Fixed now; testing + pushing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment