Merge lp:~jml/launchpad/until-no-eintr into lp:launchpad
Proposed by
Jonathan Lange
Status: | Merged |
---|---|
Approved by: | Julian Edwards |
Approved revision: | no longer in the source branch. |
Merged at revision: | 11398 |
Proposed branch: | lp:~jml/launchpad/until-no-eintr |
Merge into: | lp:launchpad |
Diff against target: |
273 lines (+165/-34) 3 files modified
lib/lp/buildmaster/model/builder.py (+29/-32) lib/lp/services/osutils.py (+33/-1) lib/lp/services/tests/test_osutils.py (+103/-1) |
To merge this branch: | bzr merge lp:~jml/launchpad/until-no-eintr |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Julian Edwards (community) | Approve | ||
Review via email: mp+33095@code.launchpad.net |
Commit message
Add lp.services.
Description of the change
Julian asked me to do this the other day, after the cherrypick had landed.
This branch adds a generic until_no_eintr helper, much like the ones in Bazaar and Twisted, but this time with a maximum retry limit. It then changes builder.py to use our until_no_eintr helper.
There are tests, too.
To post a comment you must log in.
Thanks for the change! Looks good, land with the suggestions we discussed in IRC.
Cheers.
<jml> a soyuz person might like to review this: https:/ /code.edge. launchpad. net/~jml/ launchpad/ until-no- eintr/+ merge/33095
<noodles> jml: sure (I'm ocr today anyway :) ).
<jml> noodles, cool, thanks.
<jml> it's a patch bigjools asked for :)
<bigjools> jml: fail on python2.5
<jml> bigjools, why so?
<bigjools> e.errno doesn't work
<bigjools> you need e[0]
-*- noodles leaves the review to bigjools and continues with other stuff :)
<bigjools> lol
<noodles> lunch-time!
<bigjools> jml: also, does IOError and OSError provide the same context?
<jml> bigjools, ahh, but only for socket.errro
<jml> bigjools, I don't understand the question.
<bigjools> "e" in your code
<bigjools> exception value
<jml> bigjools, an instance of either IOError or OSError has an 'errno' attribute
<jml> bigjools, regardless of Python version.
<bigjools> ok cool - but they are not returned in py 2.5 are they?
<bigjools> it returns socket.error
<jml> bigjools, they are raised by lots of things in Python 2.5
<jml> bigjools, just not the ones that happen to affect builder.py
<bigjools> ok
<jml> (e.g. you can get an IOError for an EINTR reading from a file object)
<bigjools> jml: so you should probably catch socket.error separately and use e[0] with the same comment in my original code
<jml> bigjools, will do.
<jml> bigjools, there are enough warts in this function that I'm glad it's being split out :)
<bigjools> quite :)
<bigjools> jml: is there a reason you picked "5" in the tests?
<jml> bigjools, it's less than 10 and more than 1.
<jml> bigjools, want me to give it an intent-revealing name?
<bigjools> so is 2 :)
<bigjools> yes please
<bigjools> at the test class level since you use it in most of them