Repository navigation
benchmarking/evaluate: run evaluations, with a run_results source - #3551
Conversation
4805228 to
7972199
Compare
7972199 to
7ed57d5
Compare
d89d6b6 to
5950bb3
Compare
644cb0e to
f064e01
Compare
|
Max Smythe (@maxsmythe) I've addressed the comments. PTAL |
|
|
||
|
|
||
| @dataclass(frozen=True) | ||
| class BenchmarkRunContext: |
There was a problem hiding this comment.
Is this an abstract concept or specific to the RunResults source?
There was a problem hiding this comment.
It's an abstract. It's what every source gets about the run. Reworded the docstring.
There was a problem hiding this comment.
What I don't get is why every class gets/needs this information. Wont most/many sources be reading from their own data files that the benchmarking framework likely wont be aware of (even if they live in the artifact directory)?
If the source already knows what files they are looking for, why does it need this data?
There was a problem hiding this comment.
Good point. It was shaped around the RunResults source. Now it only says which run it is (test, tag, run_ts, uri) and gives access to the run's stored files. Each source reads what it needs, or looks the run up in its own data by that identity.
| if bad := [k for k in cfg if not isinstance(k, str)]: | ||
| raise ConfigError(f"{where}: source_cfg: non-string keys {sorted(bad, key=repr)}") | ||
| try: | ||
| SOURCES[source].validate(cfg) |
There was a problem hiding this comment.
nice.
We'll need to figure out how to extend this with pluggable sources, but... baby steps
|
Haowei Cai (Roy) (@roycaihw) Thanks! Took another pass. |
f064e01 to
c9310f3
Compare
Benchmark pass/fail logic is spread over one-off tools. With this, a test entry declares `evaluations`, each a set of variables (source queries) and CEL conditions over their values, and the evaluator judges a run into a `Report`: pass, fail or invalid per evaluation. Nothing calls it yet. Conditions compile with `cel-expr-python` when the evaluations load. Sources are classes with three hooks (`sources/base.py`): `validate(cfg)` when the evaluations load, `init(run)` when the run starts, and `query(cfg)` after it. A variable whose source can't judge the run is invalid and is left out of the CEL data, so every condition that reads it is invalid and the evaluation can't pass. `run_results` reads one `stats.jsonl` row. AI use: I wrote this with an AI coding agent from the design, then reviewed the diff and checked the goodput numbers against the tools/goodput prototype on 248 Prow runs. Signed-off-by: Haowei Cai <haoweic@google.com>
Conditions are now plain CEL: integer literals are no longer rewritten, reserved names are left to CEL, and the evaluator no longer tracks which variables a condition reads. An invalid variable is left out of the CEL data and makes its evaluation invalid. The config shape is pydantic models. Signed-off-by: Haowei Cai <haoweic@google.com>
c9310f3 to
3d13e0b
Compare
|
Max Smythe (@maxsmythe) I've addressed the comments. PTAL. |
|
/retest |
Max Smythe (maxsmythe)
left a comment
There was a problem hiding this comment.
One question about the run() object, and then I threw AI at it
BenchmarkRunContext now carries the run's identity and artifact(name) instead of a file list, and the Report reads the identity from it. Each source chooses which artifacts to read, or looks the run up in its own store by identity. source_cfg is typed as JSON so non-JSON values or non-string keys fail at load. RunResults skips blank lines in stats.jsonl and marks the variable invalid on any malformed line. Conditions accept DYN so bare bool fields work, and evaluated_at converts to UTC before formatting. AI use: I wrote this with an AI coding agent from the design, then reviewed the diff. Signed-off-by: Haowei Cai <haoweic@google.com>
|
Max Smythe (@maxsmythe) Thanks for reviewing! I addressed the question and the comments. PTAL. |
|
Thanks for all the work! Merging as a test-only change |
e472ffb
Part of #3298 (design). First of four PRs: #3551 (this), #3550, #3552, #3592.
Benchmark pass/fail logic is spread over one-off tools. With this, a test entry declares
evaluations, each a set of variables (source queries) and CEL conditions over their values, and the evaluator judges a run into aReport: pass, fail or invalid per evaluation. Nothing calls it yet. #3552 wires it into the runner and writesevaluation.jsonand thestats.jsonlrows.Conditions compile with
cel-expr-pythonwhen the evaluations load. Sources are classes with three hooks (sources/base.py):validate(cfg)when the evaluations load,init(run)when the run starts, andquery(cfg)after it. A variable whose source can't judge the run is invalid and is left out of the CEL data, so every condition that reads it is invalid and the evaluation can't pass.run_resultsreads onestats.jsonlrow. The config is pydantic models.source_cfg: nullis an error; leave the key out for{}.AI use: I wrote this with an AI coding agent from the design, then reviewed the diff and checked the goodput numbers against the #2526 prototype on 248 Prow runs.