Bug 1486970: [taskgraph] Add retries to getting pushlog information; r=Callek
authorTom Prince <mozilla@hocat.ca>
Tue, 27 Nov 2018 19:13:35 +0000
changeset 507754 b59f4aa8d4a32212a3cedeb8779c13fda9863569
parent 507753 d6229a4bce1ad2b785a8f6da57bdbf49906bc123
child 507755 e75b3f5571fe4127b09b468cc8c7dacb6d822863
push id1905
push userffxbld-merge
push dateMon, 21 Jan 2019 12:33:13 +0000
treeherdermozilla-release@c2fca1944d8c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersCallek
bugs1486970
milestone65.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1486970: [taskgraph] Add retries to getting pushlog information; r=Callek Differential Revision: https://phabricator.services.mozilla.com/D13104
taskcluster/taskgraph/util/hg.py
--- a/taskcluster/taskgraph/util/hg.py
+++ b/taskcluster/taskgraph/util/hg.py
@@ -3,26 +3,34 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 from __future__ import absolute_import
 
 import requests
 import subprocess
+from redo import retry
 
 PUSHLOG_TMPL = '{}/json-pushes?version=2&changeset={}&tipsonly=1&full=1'
 
 
 def find_hg_revision_push_info(repository, revision):
     """Given the parameters for this action and a revision, find the
     pushlog_id of the revision."""
     pushlog_url = PUSHLOG_TMPL.format(repository, revision)
-    r = requests.get(pushlog_url)
-    r.raise_for_status()
+
+    def query_pushlog(url):
+        r = requests.get(pushlog_url, timeout=60)
+        r.raise_for_status()
+        return r
+    r = retry(
+        query_pushlog, args=(pushlog_url,),
+        attempts=5, sleeptime=10,
+    )
     pushes = r.json()['pushes']
     if len(pushes) != 1:
         raise RuntimeError(
             "Unable to find a single pushlog_id for {} revision {}: {}".format(
                 repository, revision, pushes
             )
         )
     pushid = pushes.keys()[0]