Bug 1383880: handle keyError from find_task_id; r?glandium
MozReview-Commit-ID: F3mVgKcqZwA
--- 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, _):