Bug 1339592 - Increase timeout for SETA api; r?jmaher draft
authorRob Wood <rwood@mozilla.com>
Wed, 15 Feb 2017 08:19:56 -0500
changeset 484606 70ec4fc40e0ded9b48596ecd513c2f839723a57a
parent 484604 d713355dff6c69f2895b4620d2c1ee68ff3aedf3
child 545815 9a8741cc090e7f8883363c3a2ac1243e1c70acc2
push id45507
push userrwood@mozilla.com
push dateWed, 15 Feb 2017 13:20:55 +0000
reviewersjmaher
bugs1339592
milestone54.0a1
Bug 1339592 - Increase timeout for SETA api; r?jmaher MozReview-Commit-ID: JSIg3vER0AE
taskcluster/taskgraph/util/seta.py
--- a/taskcluster/taskgraph/util/seta.py
+++ b/taskcluster/taskgraph/util/seta.py
@@ -49,38 +49,38 @@ class SETA(object):
 
         url = SETA_ENDPOINT % project
         # Try to fetch the SETA data twice, falling back to an empty list of low value tasks.
         # There are 10 seconds between each try.
         try:
             logger.debug("Retrieving low-value jobs list from SETA")
             response = retry(requests.get, attempts=2, sleeptime=10,
                              args=(url, ),
-                             kwargs={'timeout': 5, 'headers': ''})
+                             kwargs={'timeout': 60, 'headers': ''})
             task_list = json.loads(response.content).get('jobtypes', '')
 
             if type(task_list) == dict and len(task_list) > 0:
                 if type(task_list.values()[0]) == list and len(task_list.values()[0]) > 0:
                     low_value_tasks = task_list.values()[0]
                     # bb job types return a list instead of a single string,
                     # convert to a single string to match tc tasks format
                     if type(low_value_tasks[0]) == list:
                         low_value_tasks = [self._get_task_string(x) for x in low_value_tasks]
 
             # ensure no build tasks slipped in, we never want to optimize out those
             low_value_tasks = [x for x in low_value_tasks if 'build' not in x.lower()]
 
         # In the event of request times out, requests will raise a TimeoutError.
         except exceptions.Timeout:
-            logger.warning("SETA server is timeout, we will treat all test tasks as high value.")
+            logger.warning("SETA timeout, we will treat all test tasks as high value.")
 
         # In the event of a network problem (e.g. DNS failure, refused connection, etc),
         # requests will raise a ConnectionError.
         except exceptions.ConnectionError:
-            logger.warning("SETA server is timeout, we will treat all test tasks as high value.")
+            logger.warning("SETA connection error, we will treat all test tasks as high value.")
 
         # In the event of the rare invalid HTTP response(e.g 404, 401),
         # requests will raise an HTTPError exception
         except exceptions.HTTPError:
             logger.warning("We got bad Http response from ouija,"
                            " we will treat all test tasks as high value.")
 
         # We just print the error out as a debug message if we failed to catch the exception above
@@ -115,17 +115,17 @@ class SETA(object):
         if prev_push_id in self.failed_json_push_calls:
             return min_between_pushes
 
         url = PUSH_ENDPOINT % (project, cur_push_id - 2, prev_push_id)
 
         try:
             response = retry(requests.get, attempts=2, sleeptime=10,
                              args=(url, ),
-                             kwargs={'timeout': 5, 'headers': {'User-Agent': 'TaskCluster'}})
+                             kwargs={'timeout': 60, 'headers': {'User-Agent': 'TaskCluster'}})
             prev_push_date = json.loads(response.content).get(str(prev_push_id), {}).get('date', 0)
 
             # cache it for next time
             self.push_dates[project].update({prev_push_id: prev_push_date})
 
             # now have datetime of current and previous push
             if cur_push_date > 0 and prev_push_date > 0:
                 min_between_pushes = (cur_push_date - prev_push_date) / 60