From 40470648d1b9b082a667dda67d28738a2e0ccee6 Mon Sep 17 00:00:00 2001 From: Pepijn Date: Thu, 16 Apr 2026 10:54:34 +0200 Subject: [PATCH] feat(profiling): publish preview runs for dashboard debugging --- .github/workflows/model_profiling.yml | 6 ++++-- scripts/ci/run_model_profiling.py | 5 +++++ tests/scripts/test_model_profiling.py | 4 ++++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/.github/workflows/model_profiling.yml b/.github/workflows/model_profiling.yml index 031143406..8dccd60f7 100644 --- a/.github/workflows/model_profiling.yml +++ b/.github/workflows/model_profiling.yml @@ -81,8 +81,8 @@ jobs: HF_USER_TOKEN: ${{ secrets.LEROBOT_HF_USER }} 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 || '' }} - RESULTS_REPO: ${{ 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') }} + RESULTS_REPO: ${{ github.event_name == 'pull_request' && 'model-profiling-history-preview' || github.event.inputs.results_repo || 'model-profiling-history' }} + SHOULD_PUBLISH: ${{ github.event_name == 'pull_request' || github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && github.event.inputs.publish_results == 'true') }} steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: @@ -195,6 +195,8 @@ jobs: --results_repo="${RESULTS_REPO}" --profile_mode="${PROFILE_MODE}" --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 diff --git a/scripts/ci/run_model_profiling.py b/scripts/ci/run_model_profiling.py index e8815643e..24099fab9 100644 --- a/scripts/ci/run_model_profiling.py +++ b/scripts/ci/run_model_profiling.py @@ -97,6 +97,8 @@ def parse_args() -> argparse.Namespace: parser.add_argument("--publish", action="store_true") parser.add_argument("--profile_mode", choices=["summary", "trace"], default="trace") parser.add_argument("--git_commit", default="") + parser.add_argument("--git_ref", default="") + parser.add_argument("--pr_number", default="") return parser.parse_args() @@ -221,6 +223,7 @@ def main() -> int: args.output_dir.mkdir(parents=True, exist_ok=True) 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() + pr_number = int(args.pr_number) if str(args.pr_number).strip() else None for policy_name in selected: spec = specs[policy_name] @@ -254,6 +257,8 @@ def main() -> int: "run_id": run_id, "policy": policy_name, "git_commit": git_commit, + "git_ref": args.git_ref or None, + "pr_number": pr_number, "status": "success" if result.returncode == 0 else "failed", "return_code": result.returncode, "profile_mode": args.profile_mode, diff --git a/tests/scripts/test_model_profiling.py b/tests/scripts/test_model_profiling.py index b2fde3f88..7250b6e2c 100644 --- a/tests/scripts/test_model_profiling.py +++ b/tests/scripts/test_model_profiling.py @@ -139,6 +139,8 @@ def test_model_profiling_main_smoke_writes_row(monkeypatch, tmp_path): publish=False, profile_mode="summary", git_commit="", + git_ref="codex/model-profiling", + pr_number="3389", ) 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["status"] == "success" 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["deterministic_forward"]["operator_fingerprint"] == "ops-fingerprint" assert "policy_setup" in row["artifact_paths"]["cprofile_summaries"]