Add timeouts to buildapi's urllib.urlopen() requests

RESOLVED FIXED

Status

Release Engineering
Tools
RESOLVED FIXED
3 years ago
3 years ago

People

(Reporter: emorley, Assigned: emorley)

Tracking

({buildapi})

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments)

buildapi equivalent of bug 884115 and friends.

Should help the blocking that we're seeing as part of bug 1049430 comment 2.
(Assignee)

Comment 1

3 years ago
Created attachment 8468377 [details] [diff] [review]
Add timeouts to buildapi's urllib.urlopen() requests

urllib.urlopen() doesn't support the timeout param, unlike urllib2.urlopen().
Helpfully, urllib2 doesn't support urlencode() or quote() - so we have to use a mixture of the two (some parts of buildapi are already using a mixture).

I'm _hopeful_ but not 100% sure that the switch from urllib.urlopen() to urllib2.urlopen() shouldn't affect any of the consumers in this patch.

See also:
http://www.hacksparrow.com/python-difference-between-urllib-and-urllib2.html
http://stackoverflow.com/a/2018074

Using a timeout of 30 seconds, the same as in mozharness. Note https://docs.python.org/2/library/urllib2.html describes this as "timeout in seconds for blocking operations like the connection attempt" - ie: the content transfer itself doesn't have to complete in under 30 seconds.
Attachment #8468377 - Flags: review?(nthomas)
Comment on attachment 8468377 [details] [diff] [review]
Add timeouts to buildapi's urllib.urlopen() requests

Review of attachment 8468377 [details] [diff] [review]:
-----------------------------------------------------------------

Looks good. Per 
  https://wiki.mozilla.org/ReleaseEngineering/How_To/Update_BuildAPI
please bump the version to 0.3.2 in setup.py when you land. There's a matching puppet patch to write, but I can handle the rest.
Attachment #8468377 - Flags: review?(nthomas) → review+
(Assignee)

Comment 3

3 years ago
Thank you :-)

remote:   https://hg.mozilla.org/build/buildapi/rev/d573598ac0f2
remote:   https://hg.mozilla.org/build/buildapi/rev/66f1d42de07d
Created attachment 8471143 [details] [diff] [review]
[puppet] Update selfserve-agent
Attachment #8471143 - Flags: review?(bugspam.Callek)
Deployed to the server side, staging and production (with bug 1043996).

Updated

3 years ago
Attachment #8471143 - Flags: review?(bugspam.Callek) → review+
Comment on attachment 8471143 [details] [diff] [review]
[puppet] Update selfserve-agent

https://hg.mozilla.org/build/puppet/rev/440f95e73d3b
https://hg.mozilla.org/build/puppet/rev/b8b75c09b948
Attachment #8471143 - Flags: checked-in+
Puppet deployed this to the 5 instances of selfserve-agent.
Status: ASSIGNED → RESOLVED
Last Resolved: 3 years ago
Resolution: --- → FIXED
(Assignee)

Comment 8

3 years ago
:-)
You need to log in before you can comment on or make changes to this bug.