feat(profiling): publish preview runs for dashboard debugging

This commit is contained in:
Pepijn
2026-04-16 10:54:34 +02:00
parent 25e5062b2c
commit 40470648d1
3 changed files with 13 additions and 2 deletions
+4 -2
View File
@@ -81,8 +81,8 @@ jobs:
HF_USER_TOKEN: ${{ secrets.LEROBOT_HF_USER }} HF_USER_TOKEN: ${{ secrets.LEROBOT_HF_USER }}
PROFILE_MODE: ${{ github.event_name == 'pull_request' && 'summary' || github.event.inputs.profile_mode || 'trace' }} PROFILE_MODE: ${{ github.event_name == 'pull_request' && 'summary' || github.event.inputs.profile_mode || 'trace' }}
POLICY_FILTER: ${{ github.event_name == 'pull_request' && 'act' || github.event.inputs.policies || '' }} POLICY_FILTER: ${{ github.event_name == 'pull_request' && 'act' || github.event.inputs.policies || '' }}
RESULTS_REPO: ${{ github.event.inputs.results_repo || 'model-profiling-history' }} RESULTS_REPO: ${{ github.event_name == 'pull_request' && 'model-profiling-history-preview' || github.event.inputs.results_repo || 'model-profiling-history' }}
SHOULD_PUBLISH: ${{ github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && github.event.inputs.publish_results == 'true') }} SHOULD_PUBLISH: ${{ github.event_name == 'pull_request' || github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && github.event.inputs.publish_results == 'true') }}
steps: steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with: with:
@@ -195,6 +195,8 @@ jobs:
--results_repo="${RESULTS_REPO}" --results_repo="${RESULTS_REPO}"
--profile_mode="${PROFILE_MODE}" --profile_mode="${PROFILE_MODE}"
--git_commit="${HOST_GIT_COMMIT}" --git_commit="${HOST_GIT_COMMIT}"
--git_ref="${{ github.head_ref || github.ref_name || github.event.inputs.git_ref || 'main' }}"
--pr_number="${{ github.event.pull_request.number || '' }}"
) )
if [[ -n "${POLICY_FILTER}" ]]; then if [[ -n "${POLICY_FILTER}" ]]; then
+5
View File
@@ -97,6 +97,8 @@ def parse_args() -> argparse.Namespace:
parser.add_argument("--publish", action="store_true") parser.add_argument("--publish", action="store_true")
parser.add_argument("--profile_mode", choices=["summary", "trace"], default="trace") parser.add_argument("--profile_mode", choices=["summary", "trace"], default="trace")
parser.add_argument("--git_commit", default="") parser.add_argument("--git_commit", default="")
parser.add_argument("--git_ref", default="")
parser.add_argument("--pr_number", default="")
return parser.parse_args() return parser.parse_args()
@@ -221,6 +223,7 @@ def main() -> int:
args.output_dir.mkdir(parents=True, exist_ok=True) args.output_dir.mkdir(parents=True, exist_ok=True)
repo_id = normalize_repo_id(args.results_repo, args.hub_org) repo_id = normalize_repo_id(args.results_repo, args.hub_org)
git_commit = args.git_commit or subprocess.check_output(["git", "rev-parse", "HEAD"], text=True).strip() git_commit = args.git_commit or subprocess.check_output(["git", "rev-parse", "HEAD"], text=True).strip()
pr_number = int(args.pr_number) if str(args.pr_number).strip() else None
for policy_name in selected: for policy_name in selected:
spec = specs[policy_name] spec = specs[policy_name]
@@ -254,6 +257,8 @@ def main() -> int:
"run_id": run_id, "run_id": run_id,
"policy": policy_name, "policy": policy_name,
"git_commit": git_commit, "git_commit": git_commit,
"git_ref": args.git_ref or None,
"pr_number": pr_number,
"status": "success" if result.returncode == 0 else "failed", "status": "success" if result.returncode == 0 else "failed",
"return_code": result.returncode, "return_code": result.returncode,
"profile_mode": args.profile_mode, "profile_mode": args.profile_mode,
+4
View File
@@ -139,6 +139,8 @@ def test_model_profiling_main_smoke_writes_row(monkeypatch, tmp_path):
publish=False, publish=False,
profile_mode="summary", profile_mode="summary",
git_commit="", git_commit="",
git_ref="codex/model-profiling",
pr_number="3389",
) )
monkeypatch.setattr(module, "parse_args", lambda: args) monkeypatch.setattr(module, "parse_args", lambda: args)
@@ -183,6 +185,8 @@ def test_model_profiling_main_smoke_writes_row(monkeypatch, tmp_path):
assert row["policy"] == "act" assert row["policy"] == "act"
assert row["status"] == "success" assert row["status"] == "success"
assert row["git_commit"] == "deadbeef" assert row["git_commit"] == "deadbeef"
assert row["git_ref"] == "codex/model-profiling"
assert row["pr_number"] == 3389
assert row["step_timing_summary"]["forward_s"]["mean"] == 0.1 assert row["step_timing_summary"]["forward_s"]["mean"] == 0.1
assert row["deterministic_forward"]["operator_fingerprint"] == "ops-fingerprint" assert row["deterministic_forward"]["operator_fingerprint"] == "ops-fingerprint"
assert "policy_setup" in row["artifact_paths"]["cprofile_summaries"] assert "policy_setup" in row["artifact_paths"]["cprofile_summaries"]