diff --git a/.github/workflows/benchmark-fastlanes.yml b/.github/workflows/benchmark-fastlanes.yml index e754947..bf58d86 100644 --- a/.github/workflows/benchmark-fastlanes.yml +++ b/.github/workflows/benchmark-fastlanes.yml @@ -314,7 +314,13 @@ jobs: from pathlib import Path results = json.loads(Path(sys.argv[1]).read_text()) - evidence = results.get("evidence", {}) + evidence = results.get("evidence") + if evidence is None: + raise SystemExit( + "FastLanes claim " + f"{results.get('status', 'UNKNOWN')}: " + f"{results.get('failure_reason', 'no failure reason recorded')}" + ) if evidence.get("status") != "MEASURED": raise SystemExit(f"FastLanes claim status: {evidence.get('status')}") mixed = evidence.get("mixed", {}) diff --git a/src/format_bench/claims/__init__.py b/src/format_bench/claims/__init__.py index e5f561b..2041b7c 100644 --- a/src/format_bench/claims/__init__.py +++ b/src/format_bench/claims/__init__.py @@ -1,5 +1,23 @@ +from __future__ import annotations + +from typing import TYPE_CHECKING + from .fastlanes import run_fastlanes_claim -from .tsfile import run_tsfile_claim -from .vortex import run_vortex_stress + +if TYPE_CHECKING: + from .tsfile import run_tsfile_claim + from .vortex import run_vortex_stress __all__ = ["run_fastlanes_claim", "run_tsfile_claim", "run_vortex_stress"] + + +def __getattr__(name: str): + if name == "run_tsfile_claim": + from .tsfile import run_tsfile_claim + + return run_tsfile_claim + if name == "run_vortex_stress": + from .vortex import run_vortex_stress + + return run_vortex_stress + raise AttributeError(f"module {__name__!r} has no attribute {name!r}") diff --git a/tests/test_claims_import.py b/tests/test_claims_import.py new file mode 100644 index 0000000..559bc49 --- /dev/null +++ b/tests/test_claims_import.py @@ -0,0 +1,18 @@ +import subprocess +import sys + + +def test_fastlanes_claim_import_does_not_require_tsfile_dependencies() -> None: + code = """ +import sys +sys.modules["pyarrow"] = None +from format_bench.claims.fastlanes import run_fastlanes_claim +assert callable(run_fastlanes_claim) +""" + completed = subprocess.run( + [sys.executable, "-c", code], + check=False, + capture_output=True, + text=True, + ) + assert completed.returncode == 0, completed.stderr diff --git a/tests/test_fastlanes_workflow.py b/tests/test_fastlanes_workflow.py index c2760b0..419923b 100644 --- a/tests/test_fastlanes_workflow.py +++ b/tests/test_fastlanes_workflow.py @@ -37,4 +37,5 @@ def test_fastlanes_retry_workflow_preserves_build_and_measurement_logs() -> None assert '"status": "UNSUPPORTED" if not available else "FAILED"' in workflow assert "case_hash_algorithm" in workflow assert "input/data.csv" in workflow + assert "no failure reason recorded" in workflow assert "if: always()" in workflow