Skip to content
Snippets Groups Projects
Commit 1691c989 authored by Tom Prince's avatar Tom Prince
Browse files

Bug 1652184: Report to perherder stats about bugbug timings; r=ahal

parent f4c2e303
No related branches found
No related tags found
No related merge requests found
......@@ -200,6 +200,7 @@ tasks:
GECKO_HEAD_REV: '${push.revision}'
HG_STORE_PATH: /builds/worker/checkouts/hg-store
TASKCLUSTER_CACHES: /builds/worker/checkouts
MOZ_AUTOMATION: '1'
# mach generates pyc files when reading `mach_commands.py`
# This causes cached_task digest generation to be random for
# some tasks. Disable bytecode generation to work around that.
......
......@@ -11,3 +11,15 @@ from responses import RequestsMock
def responses():
with RequestsMock() as rsps:
yield rsps
@pytest.fixture(scope="session", autouse=True)
def patch_prefherder(request):
from _pytest.monkeypatch import MonkeyPatch
m = MonkeyPatch()
m.setattr(
"taskgraph.util.bugbug._write_perfherder_data", lambda lower_is_better: None,
)
yield
m.undo()
......@@ -4,6 +4,9 @@
from __future__ import absolute_import, print_function, unicode_literals
import os
import json
import sys
import time
import requests
......@@ -45,10 +48,31 @@ def get_session():
return requests_retry_session(retries=5, session=s)
def _write_perfherder_data(lower_is_better):
if os.environ.get("MOZ_AUTOMATION", "0") == "1":
perfherder_data = {
"framework": {"name": "build_metrics"},
"suites": [
{
"name": suite,
"value": value,
"lowerIsBetter": True,
"shouldAlert": False,
"subtests": [],
}
for suite, value in lower_is_better.items()
],
}
print(
"PERFHERDER_DATA: {}".format(json.dumps(perfherder_data)), file=sys.stderr
)
@memoize
def push_schedules(branch, rev):
url = BUGBUG_BASE_URL + '/push/{branch}/{rev}/schedules'.format(branch=branch, rev=rev)
# TODO(py3): use time.monotonic()
start = time.clock()
session = get_session()
attempts = RETRY_TIMEOUT / RETRY_INTERVAL
i = 0
......@@ -61,6 +85,12 @@ def push_schedules(branch, rev):
time.sleep(RETRY_INTERVAL)
i += 1
end = time.clock()
_write_perfherder_data(lower_is_better={
'bugbug_push_schedules_time': end-start,
'bugbug_push_schedules_retries': i,
})
data = r.json()
if r.status_code == 202:
......
......@@ -6,6 +6,7 @@ black:
- python/mozrelease/mozrelease/scriptworker_canary.py
- taskcluster/docker/funsize-update-generator
- taskcluster/taskgraph/actions/scriptworker_canary.py
- taskcluster/taskgraph/test/conftest.py
- taskcluster/taskgraph/transforms/scriptworker_canary.py
- testing/condprofile/condprof
- tools/crashreporter/system-symbols
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment