diff --git a/taskcluster/taskgraph/decision.py b/taskcluster/taskgraph/decision.py index a45927c3558b..5c247a8623e0 100644 --- a/taskcluster/taskgraph/decision.py +++ b/taskcluster/taskgraph/decision.py @@ -25,6 +25,7 @@ from .parameters import Parameters, get_version, get_app_version from .taskgraph import TaskGraph from taskgraph.util.python_path import find_object from .try_option_syntax import parse_message +from .util.bugbug import push_schedules from .util.chunking import resolver from .util.hg import get_hg_revision_branch, get_hg_commit_message from .util.partials import populate_release_history @@ -243,6 +244,10 @@ def taskgraph_decision(options, parameters=None): write_artifact('task-graph.json', tgg.morphed_task_graph.to_json()) write_artifact('label-to-taskid.json', tgg.label_to_taskid) + # write bugbug scheduling information if it was invoked + if len(push_schedules) > 0: + write_artifact("bugbug-push-schedules.json", push_schedules.popitem()[1]) + # actually create the graph create_tasks(tgg.graph_config, tgg.morphed_task_graph, tgg.label_to_taskid, tgg.parameters) diff --git a/taskcluster/taskgraph/test/test_util_bugbug.py b/taskcluster/taskgraph/test/test_util_bugbug.py index ca7bf5e7e86e..1a7fcb9c30af 100644 --- a/taskcluster/taskgraph/test/test_util_bugbug.py +++ b/taskcluster/taskgraph/test/test_util_bugbug.py @@ -31,6 +31,7 @@ def test_group_translation(responses): status=200, ) + assert len(push_schedules) == 0 data = push_schedules(branch, rev) print(data) assert sorted(data["groups"]) == [ @@ -38,6 +39,12 @@ def test_group_translation(responses): "/_mozilla/IndexedDB", "dom/indexedDB", ] + assert len(push_schedules) == 1 + + # Value is memoized. + responses.reset() + push_schedules(branch, rev) + assert len(push_schedules) == 1 if __name__ == '__main__': diff --git a/taskcluster/taskgraph/util/bugbug.py b/taskcluster/taskgraph/util/bugbug.py index c299deab0bc8..4aa9ab773c77 100644 --- a/taskcluster/taskgraph/util/bugbug.py +++ b/taskcluster/taskgraph/util/bugbug.py @@ -4,8 +4,6 @@ from __future__ import absolute_import, print_function, unicode_literals -import json -import logging import time import requests @@ -13,8 +11,6 @@ from mozbuild.util import memoize from taskgraph.util.taskcluster import requests_retry_session -logger = logging.getLogger(__name__) - BUGBUG_BASE_URL = "https://bugbug.herokuapp.com" RETRY_TIMEOUT = 8 * 60 # seconds RETRY_INTERVAL = 10 # seconds @@ -67,9 +63,6 @@ def push_schedules(branch, rev): i += 1 data = r.json() - logger.debug("Bugbug scheduler service returns:\n{}".format( - json.dumps(data, indent=2))) - if r.status_code == 202: raise BugbugTimeoutException("Timed out waiting for result from '{}'".format(url))