Spaces:
Running
Running
Download tests/test_diagnostics.py from ArchitSharma/InferScale-Sim: direct link, hf CLI and curl.
- Browser
- Download file 1.02 kB
-
https://huggingface.co/spaces/ArchitSharma/InferScale-Sim/resolve/main/tests/test_diagnostics.py
- Command line
-
hf download hf://spaces/ArchitSharma/InferScale-Sim/tests/test_diagnostics.py
-
curl -L -o test_diagnostics.py https://huggingface.co/spaces/ArchitSharma/InferScale-Sim/resolve/main/tests/test_diagnostics.py
1.02 kB
| from inferscale import run_simulation | |
| def test_healthy_run_has_diagnosis(): | |
| result = run_simulation( | |
| { | |
| "duration_s": 6, | |
| "request_rate_rps": 0.5, | |
| "prompt_tokens_mean": 128, | |
| "output_tokens_mean": 8, | |
| "slo_ttft_ms": 2000, | |
| "slo_e2e_ms": 20000, | |
| "slo_attainment_target": 0.95, | |
| } | |
| ) | |
| assert result["diagnostics"]["code"] in {"healthy", "healthy_near_saturation"} | |
| assert result["diagnostics"]["provenance"] == "heuristic-simulator-diagnosis" | |
| def test_summary_exposes_component_slo_attainment(): | |
| result = run_simulation( | |
| { | |
| "duration_s": 6, | |
| "request_rate_rps": 2, | |
| "prompt_tokens_mean": 128, | |
| "output_tokens_mean": 8, | |
| } | |
| ) | |
| summary = result["summary"] | |
| assert 0 <= summary["ttft_slo_attainment"] <= 1 | |
| assert 0 <= summary["e2e_slo_attainment"] <= 1 | |
| assert set(summary["slo_failure_breakdown"]) == {"ttft_only", "e2e_only", "both"} | |