commit ff272e528d69eb99a91d8d6ad9928a8c74168ae0
parent c553709e5cfb1b97c3e3def9fcf2f58e1b2bcfe0
Author: Florian Quèze <florian@queze.net>
Date: Thu, 6 Nov 2025 09:38:13 +0000
Bug 1998460 - only start the resource monitor for decision tasks when MOZ_UPLOAD_DIR is set, r=jcristau.
Differential Revision: https://phabricator.services.mozilla.com/D271503
Diffstat:
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/taskcluster/mach_commands.py b/taskcluster/mach_commands.py
@@ -253,13 +253,16 @@ def taskgraph_decision(command_context, **options):
try:
setup_logging(command_context)
- monitor = SystemResourceMonitor(poll_interval=0.1)
- monitor.start()
+ in_automation = os.environ.get("MOZ_AUTOMATION") == "1"
+ moz_upload_dir = os.environ.get("MOZ_UPLOAD_DIR")
+ if in_automation and moz_upload_dir:
+ monitor = SystemResourceMonitor(poll_interval=0.1)
+ monitor.start()
start = time.monotonic()
ret = taskgraph_commands["decision"].func(options)
end = time.monotonic()
- if os.environ.get("MOZ_AUTOMATION") == "1":
+ if in_automation:
perfherder_data = {
"framework": {"name": "build_metrics"},
"suites": [
@@ -276,14 +279,13 @@ def taskgraph_decision(command_context, **options):
f"PERFHERDER_DATA: {json.dumps(perfherder_data)}",
file=sys.stderr,
)
- moz_upload_dir = os.environ.get("MOZ_UPLOAD_DIR")
+
if moz_upload_dir:
upload_dir = pathlib.Path(moz_upload_dir)
out_path = upload_dir / "perfherder-data-decision.json"
with out_path.open("w", encoding="utf-8") as f:
json.dump(perfherder_data, f)
- # Save resource profile
monitor.stop()
profile_path = upload_dir / "profile_build_resources.json"
with open(profile_path, "w", encoding="utf-8", newline="\n") as f: