Skip to content

Commit 3506c49

Browse files
authored
chore: get lakeprof upload url from env var (#14355)
This PR allows the bench repo to decide whether and where to upload the lakeprof report. This brings this bench suite more in-line with the others like mathlib's or cslib's.
1 parent 0fc9303 commit 3506c49

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

tests/bench/build/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,5 @@ The following metrics are collected individually for each module:
3838
- `build/module/<name>//bytes .olean.server`
3939
- `build/module/<name>//bytes .olean.private`
4040

41-
If the file `build_upload_lakeprof_report` is present in the repo root,
42-
the lakeprof report will be uploaded once the benchmark run concludes.
41+
If the `LAKEPROF_UPLOAD_URL` environment variable is set,
42+
the lakeprof report will be uploaded to that URL prefix once the benchmark run concludes.

tests/bench/build/lakeprof_report_upload.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
11
#!/usr/bin/env python3
22

33
import json
4+
import os
45
import subprocess
56
import sys
67
from pathlib import Path
78

9+
upload_url = os.environ.get("LAKEPROF_UPLOAD_URL")
10+
if not upload_url:
11+
sys.exit(0)
12+
if upload_url.endswith("/"):
13+
upload_url = upload_url[:-1]
14+
815
# Determine paths relative to the current file.
916
script_file = Path(__file__)
1017
template_file = script_file.parent / "lakeprof_report_template.html"
@@ -21,7 +28,7 @@ def run_stdout(*command: str, cwd: Path | None = None) -> str:
2128

2229

2330
sha = run_stdout("git", "rev-parse", "@", cwd=src_dir).strip()
24-
base_url = f"https://speed.lean-lang.org/lean4-out/{sha}"
31+
base_url = f"{upload_url}/{sha}"
2532
report = (src_dir / "lakeprof_report.txt").read_text()
2633

2734
template = template_file.read_text()

0 commit comments

Comments
 (0)