Bug 1383880: handle keyError from find_task_id; r?glandium draft
authorDustin J. Mitchell <dustin@mozilla.com>
Thu, 21 Sep 2017 12:02:44 +0000
changeset 668279 ad896d3a555405848f1f9f4a89ac9c6f2ddb4e75
parent 668278 330938f303906e1ebd5c96a08acbf9e0acac3ea8
child 732657 8ae937d6c9e3e56590a10e78f642d16598112809
push id80998
push userdmitchell@mozilla.com
push dateThu, 21 Sep 2017 12:49:52 +0000
reviewersglandium
bugs1383880
milestone57.0a1
Bug 1383880: handle keyError from find_task_id; r?glandium MozReview-Commit-ID: F3mVgKcqZwA
python/mozbuild/mozbuild/artifacts.py
taskcluster/taskgraph/optimize.py
--- a/python/mozbuild/mozbuild/artifacts.py
+++ b/python/mozbuild/mozbuild/artifacts.py
@@ -653,17 +653,17 @@ class TaskCache(CacheManager):
             product=artifact_job.product,
             job=job,
         )
         self.log(logging.DEBUG, 'artifact',
                  {'namespace': namespace},
                  'Searching Taskcluster index with namespace: {namespace}')
         try:
             taskId = find_task_id(namespace)
-        except Exception:
+        except KeyError:
             # Not all revisions correspond to pushes that produce the job we
             # care about; and even those that do may not have completed yet.
             raise ValueError('Task for {namespace} does not exist (yet)!'.format(namespace=namespace))
 
         artifacts = list_artifacts(taskId)
 
         urls = []
         for artifact_name in artifact_job.find_candidate_artifacts(artifacts):
--- a/taskcluster/taskgraph/optimize.py
+++ b/taskcluster/taskgraph/optimize.py
@@ -10,17 +10,16 @@ task.
 
 See ``taskcluster/docs/optimization.rst`` for more information.
 """
 
 from __future__ import absolute_import, print_function, unicode_literals
 
 import logging
 import os
-import requests
 from collections import defaultdict
 
 from .graph import Graph
 from . import files_changed
 from .taskgraph import TaskGraph
 from .util.seta import is_low_value_task
 from .util.taskcluster import find_task_id
 from .util.parameterization import resolve_task_references
@@ -302,17 +301,17 @@ class IndexSearch(OptimizationStrategy):
     def should_replace_task(self, task, params, index_paths):
         "Look for a task with one of the given index paths"
         for index_path in index_paths:
             try:
                 task_id = find_task_id(
                     index_path,
                     use_proxy=bool(os.environ.get('TASK_ID')))
                 return task_id
-            except requests.exceptions.HTTPError:
+            except KeyError:
                 # 404 will end up here and go on to the next index path
                 pass
 
         return False
 
 
 class SETA(OptimizationStrategy):
     def should_remove_task(self, task, params, _):