Repository navigation
Conversation
Extend the schema 2.2 variant metrics to the standard suite (test_pytorch_wheels.yml): test_run_count, test_passed_count, test_failure_count, and test_skipped_count, published only for complete, self-consistent reports and attached to the cell named by the test workflow's inputs. merge_variant keeps metrics when a same-attempt snapshot without them wins the cell.
Copy PyTorch test counts whenever TheRock reports results_complete: true instead of re-checking expected/observed shard counts and count sums; TheRock already sets the flag only for complete, valid report sets. Trim the metric tests to the core attachment, ordering, rerun, incomplete, and publication cases.
… assertion Date the 2.2 changelog entry for the current change and reference ROCm#127. Assert the full-suite leaf shape on the published JSON instead of hasattr on a RunLeaf, which could never fail.
develop's ROCm#125 already shipped status.json schema_version 2.2 (summary build counters), so this PR's per-variant PyTorch test metrics move to 2.3: SCHEMA_VERSION, the model literal, the reference JSONC, and the consumer test assertions. Resolve the changelog conflict with a 2.3 entry above ROCm#125's 2.2 entry, and cover restamping live 2.2 documents.
There was a problem hiding this comment.
thanks for all the work.
Could you also update the description? ROCm/TheRock#10006 alone does not make the counts flow. It also needs a step in test_wheels that writes the counts (the existing completed notify forwards step outputs) and the full-suite wiring in test_summary.
While reviewing, I found #139. It is not caused by this PR and does not need to be fixed here; it is just for information.
Please also update the schema to 2.4 (#138 bumped it to 2.3)
| "completed_at": "2026-04-08T18:00:00Z", | ||
| "variants": [ | ||
| { "py": "3.12", "torch": "release/2.10", "run_id": 12346900, "run_attempt": 1, "status": "in_progress", "started_at": "2026-04-08T13:00:00Z", "completed_at": null } | ||
| { "py": "3.12", "torch": "release/2.10", "run_id": 12346900, "run_attempt": 1, "test_failure_count": 20, "test_results_complete": true, "status": "failure", "started_at": "2026-04-08T13:00:00Z", "completed_at": "2026-04-08T18:00:00Z" } |
There was a problem hiding this comment.
we should always list all test_.. if at least one of them is set.
|
|
||
| ### Added | ||
|
|
||
| - Optional per-variant PyTorch test metrics: `test_results_complete`, plus |
There was a problem hiding this comment.
can we make it a bit more clear what (test_full and test) means? there will be people not familiar with that for pytorch we have 2 test workflows: test_full and test - and how come there is no test_skipped_count for test_full?
i would argue that independent of test_full or test, the counters being exposed in quartz are the same - to not have any surprise. even if that means that test_skipped_count = 0 always for test_full
further question:
results_complete: true - this should be maybe a bit more clarified that this is a return value of within the therock pytorch test workflows?
|
|
||
| # Per-variant test metrics, in on-disk order. A cell carries them only when the | ||
| # reporting test run published a complete, self-consistent report set. | ||
| TEST_RESULT_FIELDS: Final = ( |
There was a problem hiding this comment.
lets use the same naming schema without count as we are already using in the summary:
"test": { "success": 1, "failure": 1, "in_progress": 1, "cancelled": 0, "skipped": 0 }
so i would suggest a restructering:
have a dict for the test_results and drop all the test_.._count part.
{ "py": "3.10",
"torch": "release/2.10",
"run_id": 12345900,
"run_attempt": 1,
"test_results": {
"total": 10278, (if we do sum(of all test including skipped), or "executed" to exclude the skipped ones?)
"passed": 10278, (or "succeeded"?)
"failed": 0,
"skipped": 9117,
"results_complete": true
},
"status": "success",
"started_at": "2026-04-08T11:30:00Z",
"completed_at": "2026-04-08T12:15:00Z" },
agent suggestion how this then can look like:
Sketch for therock_status_document.py (replaces the five fields, TEST_RESULT_FIELDS, and the test_results() method, which would clash with the field name):
class TestResults(BaseModel):
executed: int | None = Field(default=None, ge=0) # ran; excludes skipped
passed: int | None = Field(default=None, ge=0)
failed: int | None = Field(default=None, ge=0) # failures + errors
skipped: int | None = Field(default=None, ge=0)
results_complete: bool
_VARIANT_STATE_KEYS = frozenset(
{"run_id", "run_attempt", "test_results", "status", "started_at", "completed_at"}
)
class Variant(BaseModel):
...
test_results: TestResults | None = None
def _flatten(self):
...
if self.test_results is not None:
out["test_results"] = self.test_results.model_dump(exclude_none=True)
def merge_variant(existing, new):
winner, other = (new, existing) if existing.should_replace(new) else (existing, new)
same_attempt = (winner.run_id, winner.run_attempt) == (other.run_id, other.run_attempt)
if winner.test_results is None and other.test_results is not None and same_attempt:
return winner.model_copy(update={"test_results": other.test_results})
return winnerNotes:
- "test_results" must be in _VARIANT_STATE_KEYS. Otherwise _unflatten treats it as a matrix axis and stringifies it, which changes the cell key on reload.
- In therock_update_status_json.py, _test_results would return TestResults | None, and _attach_test_results would use update={"test_results": results}.
| _TEST_COUNT_OUTPUTS: dict[str, str] = { | ||
| "run_test_count": "test_run_count", | ||
| "passed_test_count": "test_passed_count", | ||
| "failed_test_count": "test_failure_count", | ||
| "skipped_test_count": "test_skipped_count", | ||
| } |
There was a problem hiding this comment.
with the nested model, this duplicate declaration is not needed, and the one from therock_status_document can be used.
| ) | ||
|
|
||
|
|
||
| def _nonnegative_output_int(value: object) -> int | None: |
There was a problem hiding this comment.
please use _parse_int from therock_types.py
|
|
||
| # More than one reporting job would make attribution to this variant | ||
| # ambiguous; fail closed instead of combining their counts. | ||
| if len(output_sets) != 1: |
There was a problem hiding this comment.
this is then not needed anymore
| if not results or not variants: | ||
| return variants | ||
| cell = _input_cell(workflow_run, axis_key) | ||
| matches = [ |
There was a problem hiding this comment.
No need for the matches list and the len(matches) != 1 check: _variants_from_jobs groups jobs by (py, ref), so each combination appears at most once in variants. An exact match on the input cell therefore hits zero or one variant, and the fail-closed behavior stays without extra code.
Possible implementation (uses _captured_pytorch_test_results and the nested test_results field from my other comments):
def _attach_test_results(
workflow_run: WorkflowRunRecord, variants: list[Variant], axis_key: str
) -> list[Variant]:
"""Attach this run's test counts to the cell named by its inputs."""
results = _captured_pytorch_test_results(workflow_run)
if results is None:
return variants
cell = _input_cell(workflow_run, axis_key)
return [
v.model_copy(update={"test_results": results}) if v.matrix == cell else v
for v in variants
]The exact match is slightly stricter than the current subset match: a partial or empty input cell no longer matches anything. Both TheRock test workflows always send python_version and pytorch_git_ref, so that should not drop real results.
| for output, field in _TEST_COUNT_OUTPUTS.items(): | ||
| count = _nonnegative_output_int(outputs.get(output)) | ||
| if count is not None: | ||
| results[field] = count |
There was a problem hiding this comment.
with the new design we should always list all counters, and if there is at least one counter put "missing" ones to 0.
| # reporting test run published a complete, self-consistent report set. | ||
| TEST_RESULT_FIELDS: Final = ( | ||
| "test_run_count", | ||
| "test_passed_count", |
There was a problem hiding this comment.
lets also let full test always report all values itself
| from pydantic import BaseModel, Field, model_serializer, model_validator | ||
|
|
||
| SCHEMA_VERSION: Final = "2.2" | ||
| SCHEMA_VERSION: Final = "2.3" |
There was a problem hiding this comment.
please update the schema to 2.4
Problem
PyTorch test variants in status.json only report a job status. Consumers can't
see how many tests ran, passed, failed, or were skipped, and can't tell a clean
run from an incomplete report set.
Tracked in AIPYTORCH-1779 (builds on AIPYTORCH-1525).
Changes
test_results_completetest_failure_count(test_fullandtest)test_run_count,test_passed_count, andtest_skipped_count(test, standard suite)results_complete: true. TheRock sets that flag only for a complete, valid report set, so Quartz does not re-check shard counts or sums.merge_variant: the cell merge used by both leaf-merge functions. When a same-attempt snapshot without metrics wins a cell (for example the build run's completion re-deriving cells from job names), the metrics carry over. A newer run attempt never inherits them.TheRock producer: ROCm/TheRock#10006 (standard and full suite counts).
Validation
pytest scripts docsafter merging develop: 669 passed, 49 subtests passed. The metric tests cover:pre-commit runon the changed files (black, mypy, mdformat, whitespace, tabs): passed.