commit d75e28f97928da5efc18b8f24b611a3cbfe6c1aa
parent 79e1d3c86de275de317f52b75b64e98d58857314
Author: myeongjun <myeongjun.ko@gmail.com>
Date: Mon, 27 Oct 2025 13:25:43 +0000
Bug 1994940 - Support writing multiple files for Push Schedules instead of overwriting r=sparky,taskgraph-reviewers,bhearsum
Differential Revision: https://phabricator.services.mozilla.com/D269344
Diffstat:
2 files changed, 20 insertions(+), 5 deletions(-)
diff --git a/taskcluster/gecko_taskgraph/util/bugbug.py b/taskcluster/gecko_taskgraph/util/bugbug.py
@@ -54,6 +54,20 @@ def get_session():
return requests_retry_session(retries=5, session=s)
+def _next_indexed_path(base_path):
+ base_dir = base_path.parent
+ stem = base_path.stem
+ pattern = f"{stem}-*.json"
+ max_index = 1
+ for file in base_dir.glob(pattern):
+ try:
+ index = int(file.stem.replace(stem + "-", ""))
+ max_index = max(max_index, index + 1)
+ except ValueError:
+ continue
+ return base_dir / f"{stem}-{max_index}.json"
+
+
def _write_perfherder_data(lower_is_better):
if os.environ.get("MOZ_AUTOMATION", "0") == "1":
perfherder_data = {
@@ -82,7 +96,8 @@ def _write_perfherder_data(lower_is_better):
return
upload_path.parent.mkdir(parents=True, exist_ok=True)
- with upload_path.open("w", encoding="utf-8") as f:
+ target = _next_indexed_path(upload_path)
+ with target.open("w", encoding="utf-8") as f:
json.dump(perfherder_data, f)
diff --git a/taskcluster/kinds/source-test/shadow-scheduler.yml b/taskcluster/kinds/source-test/shadow-scheduler.yml
@@ -12,12 +12,12 @@ task-defaults:
- type: file
name: public/shadow-scheduler/optimized-tasks.json
path: /builds/worker/optimized-tasks.json
- - type: file
- name: public/build/perfherder-data-bugbug.json
- path: /builds/worker/perfherder-data-bugbug.json
+ - type: directory
+ name: public/build
+ path: /builds/worker/artifacts/perf
env:
DECISION_TASK_ID: {task-reference: <decision>}
- MOZ_PERFHERDER_UPLOAD: /builds/worker/perfherder-data-bugbug.json
+ MOZ_PERFHERDER_UPLOAD: /builds/worker/artifacts/perf/perfherder-data-bugbug.json
treeherder:
kind: other
tier: 3