-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathtest_integration_meta_analysis_benchmark_fields.py
More file actions
53 lines (45 loc) · 1.76 KB
/
Copy pathtest_integration_meta_analysis_benchmark_fields.py
File metadata and controls
53 lines (45 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
"""Integration meta-analysis collector: benchmark timing fields.
``SweepDataCollector`` reads ``summaries/execution_summary.json`` whether the
aggregate uses ``execution_summary_format: slim_v1`` or detail rows; timing and
benchmark keys on each detail dict must remain present (see also
``test_collect_slim_execution_summary_preserves_timing_for_collector``).
"""
from __future__ import annotations
import json
from pathlib import Path
from typing import Any
import pytest
from integration.meta_analysis.collector import SweepDataCollector
def test_collects_execution_benchmark_metadata(tmp_path: Path) -> None:
exec_root = tmp_path / "12_execute_output"
summaries = exec_root / "summaries"
summaries.mkdir(parents=True)
payload: dict[str, Any] = {
"execution_details": [
{
"model_name": "pymdp_scaling_N4_T10",
"framework": "pymdp",
"success": True,
"skipped": False,
"execution_time": 2.0,
"execution_time_mean": 2.1,
"execution_time_std": 0.2,
"execution_benchmark_repeats": 3,
"execution_time_samples": [2.0, 2.2, 2.0],
}
]
}
(summaries / "execution_summary.json").write_text(
json.dumps(payload), encoding="utf-8"
)
collector = SweepDataCollector(exec_root)
records = collector.collect()
assert len(records) == 1
r = records[0]
assert r.execution_time == pytest.approx(2.0)
assert r.execution_time_mean == pytest.approx(2.1)
assert r.execution_time_std == pytest.approx(0.2)
assert r.execution_benchmark_repeats == 3
assert r.execution_time_samples == [2.0, 2.2, 2.0]
assert r.num_states == 4
assert r.num_timesteps == 10