Bug 1641283 - [taskgraph] Upload bugbug push schedules API data to an artifact rather than the log, r=marco

Differential Revision: https://phabricator.services.mozilla.com/D77140
This commit is contained in:
Andrew Halberstadt 2020-05-29 14:39:38 +00:00
Родитель 55c95e297a
Коммит e5ab1dc839
3 изменённых файлов: 12 добавлений и 7 удалений

Просмотреть файл

@ -25,6 +25,7 @@ from .parameters import Parameters, get_version, get_app_version
from .taskgraph import TaskGraph from .taskgraph import TaskGraph
from taskgraph.util.python_path import find_object from taskgraph.util.python_path import find_object
from .try_option_syntax import parse_message from .try_option_syntax import parse_message
from .util.bugbug import push_schedules
from .util.chunking import resolver from .util.chunking import resolver
from .util.hg import get_hg_revision_branch, get_hg_commit_message from .util.hg import get_hg_revision_branch, get_hg_commit_message
from .util.partials import populate_release_history 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('task-graph.json', tgg.morphed_task_graph.to_json())
write_artifact('label-to-taskid.json', tgg.label_to_taskid) 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 # actually create the graph
create_tasks(tgg.graph_config, tgg.morphed_task_graph, tgg.label_to_taskid, tgg.parameters) create_tasks(tgg.graph_config, tgg.morphed_task_graph, tgg.label_to_taskid, tgg.parameters)

Просмотреть файл

@ -31,6 +31,7 @@ def test_group_translation(responses):
status=200, status=200,
) )
assert len(push_schedules) == 0
data = push_schedules(branch, rev) data = push_schedules(branch, rev)
print(data) print(data)
assert sorted(data["groups"]) == [ assert sorted(data["groups"]) == [
@ -38,6 +39,12 @@ def test_group_translation(responses):
"/_mozilla/IndexedDB", "/_mozilla/IndexedDB",
"dom/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__': if __name__ == '__main__':

Просмотреть файл

@ -4,8 +4,6 @@
from __future__ import absolute_import, print_function, unicode_literals from __future__ import absolute_import, print_function, unicode_literals
import json
import logging
import time import time
import requests import requests
@ -13,8 +11,6 @@ from mozbuild.util import memoize
from taskgraph.util.taskcluster import requests_retry_session from taskgraph.util.taskcluster import requests_retry_session
logger = logging.getLogger(__name__)
BUGBUG_BASE_URL = "https://bugbug.herokuapp.com" BUGBUG_BASE_URL = "https://bugbug.herokuapp.com"
RETRY_TIMEOUT = 8 * 60 # seconds RETRY_TIMEOUT = 8 * 60 # seconds
RETRY_INTERVAL = 10 # seconds RETRY_INTERVAL = 10 # seconds
@ -67,9 +63,6 @@ def push_schedules(branch, rev):
i += 1 i += 1
data = r.json() data = r.json()
logger.debug("Bugbug scheduler service returns:\n{}".format(
json.dumps(data, indent=2)))
if r.status_code == 202: if r.status_code == 202:
raise BugbugTimeoutException("Timed out waiting for result from '{}'".format(url)) raise BugbugTimeoutException("Timed out waiting for result from '{}'".format(url))