Skip to content

Commit a162b63

Browse files
feat: per-cell build counters on PyTorch/JAX status.json summary (#125)
## Motivation Closes #124. PyTorch and JAX build each Python x framework version as a separate matrix cell. The `summary` build only carried a worst-of `status`, so one failed cell hid how many of the others had built. `test` already carries per-status counters; the PyTorch and JAX `build` now carries them too. ## Technical Details - The PyTorch and JAX `summary.<platform>.<pipeline>.build` carries `success`, `failure`, `in_progress`, `cancelled` and `skipped` counts, one per matrix cell, next to the existing worst-of `status` (unchanged). They are computed by `_build_rollup` and stored as optional fields on `BuildRollup`. - `rocm` and `native_packages` are single builds, so their `build` stays a bare `status` with no counters. - The counters are optional. Consumers must handle their absence, because documents written before schema 2.2 do not have them. - `schema_version` goes from 2.1 to 2.2. This is a backward-compatible minor addition. Existing 2.x documents are restamped to 2.2 on the next write, using the migration already in place since 2.1. - All five counters are kept for parity with `test`. In practice `skipped`, and usually `cancelled`, stay 0: a fully skipped matrix records no cells, so it shows up only in the build's `status`. - Docs: the `README.md` overview, `status_json_reference.jsonc` and the changelog describe the counters and that they are optional. ## Test Plan Unit tests in `therock_summary_test.py`: - per-cell counts for PyTorch and JAX, covering all five statuses - the exact on-disk dict - rocm, native packages and unreported placeholders carry no counters ## Test Result Tests pass. ## Submission Checklist - [ ] Look over the contributing guidelines at https://github.com/ROCm/TheRock/blob/main/GOVERNANCE.md#pull-requests. --------- Co-authored-by: Laura Promberger <laura.promberger@amd.com>
1 parent 33b1aa9 commit a162b63

8 files changed

Lines changed: 152 additions & 26 deletions

File tree

‎docs/changelogs/status_json.md‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@ the same major can ignore. Layout and path changes are listed under the date
1212
they shipped even when they do not move `schema_version`. Entries reference the
1313
pull request that introduced the change.
1414

15+
## schema_version 2.2 - 2026-11-10
16+
17+
### Added
18+
19+
- Status counters on the PyTorch and JAX `summary` build, one per Python x
20+
framework version build (#125).
21+
1522
## schema_version 2.1 - 2026-09-08
1623

1724
### Added

‎docs/status-json/README.md‎

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ status.json
3232
│ ├─ architectures e.g. gfx942, gfx1201
3333
│ ├─ urls tarballs, wheels, rpm/deb, artifacts index
3434
│ └─ <pipeline> rocm | pytorch | jax | native_packages
35-
│ ├─ build one status
35+
│ ├─ build one status [+ status counts for PyTorch/JAX]
3636
│ └─ test pass/fail counters
3737
└─ pipelines deep per-arch / per-variant detail
3838
```
@@ -65,9 +65,16 @@ case with no `build` / `test` phases:
6565
| `jax` | `build`, `test` | linux only |
6666
| `native_packages` | per package type (`rpm`, `deb`) | linux only |
6767

68-
`build` is a single status; `test` carries pass/fail counters. Each block is
69-
described in detail in [What is in a status.json](#what-is-in-a-statusjson)
70-
below.
68+
`build` is a single status; `test` carries pass/fail counters. The PyTorch and
69+
JAX `build` may also carry counters, one per Python x framework version build.
70+
Those counters are optional and are absent from documents written before
71+
schema 2.2. Each block is described in detail in
72+
[What is in a status.json](#what-is-in-a-statusjson) below.
73+
74+
> **Note:** A successful build does not guarantee that its wheels were
75+
> published. `urls.wheels` points to a `whl-next/` index that holds all Python wheels
76+
> (ROCm, PyTorch, JAX), and it is set as soon as the ROCm wheels are
77+
> published, whether or not the PyTorch / JAX wheels are there yet.
7178
7279
## Endpoints
7380

@@ -197,6 +204,14 @@ constituent is `failure`, the rollup is `failure`; if any is still
197204
Test phases in `summary` carry **counters** (one count per matrix entry), not a
198205
single status. Pass/fail is derived by summing or inspecting them.
199206

207+
The `rocm` and `native_packages` builds are a single build each, so a single
208+
`status` is enough. PyTorch and JAX build one wheel set per Python x framework
209+
version, so their `build` may also carry the five counters next to its worst-of
210+
`status`. The counters are optional and absent from documents written before
211+
schema 2.2. For example, `"status": "failure"` with `"success": 14, "failure": 2`
212+
means 14 of 16 builds succeeded. Which ones is in
213+
`pipelines.<pipeline>.build.<platform>.variants`.
214+
200215
## Full schema reference
201216

202217
The complete annotated layout, including the deep `pipelines` tree, PyTorch/JAX

‎docs/status-json/status_json_reference.jsonc‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
// - Tarball URLs are not enumerated; consumers use the Quartz Python helper
2020
// to construct per-arch tarball filenames from the base URL + version.
2121
{
22-
"schema_version": "2.1",
22+
"schema_version": "2.2",
2323
"release_type": "nightly", // "nightly" | "rc" | "dev"
2424
"rocm_version": "7.13.0a20260408", // the release version; an ASAN document keeps its `.asan` / `+asan` package marker (e.g. "7.13.0a20260408+asan") but is filed under the same folder as the release build
2525
"build_date": "20260408", // the date the owning release orchestrator run was created (a newer run taking over the document restamps it; later child runs never move it); for nightly-bkc this is the bkc run date, not the nightly date the build was cut from
@@ -59,16 +59,16 @@
5959
"artifacts": "https://therock-nightly-artifacts.s3.amazonaws.com/12340000-linux/index.html"
6060
},
6161

62-
// Per-pipeline rollup. Build phases carry a single {status}. Test phases
63-
// carry counters: one count per matrix entry, NOT one per arch. E.g.
64-
// pytorch.test for an arch with a 3 py x 2 torch matrix contributes 6 to
65-
// the counters, not 1.
62+
// Per-pipeline rollup. Build phases carry a worst-of {status}; the
63+
// pytorch / jax build also carries counters, one per py x framework
64+
// version build. Test phases carry counters: one count per matrix entry,
65+
// NOT one per arch.
6666
"rocm": {
6767
"build": { "status": "success" },
6868
"test": { "success": 1, "failure": 1, "in_progress": 1, "cancelled": 0, "skipped": 0 } // counts of matrix entries across all arches
6969
},
7070
"pytorch": {
71-
"build": { "status": "success" },
71+
"build": { "status": "success", "success": 2, "failure": 0, "in_progress": 0, "cancelled": 0, "skipped": 0 }, // per-build detail is in pipelines.pytorch.build.linux.variants
7272
"test": { "success": 0, "failure": 0, "in_progress": 3, "cancelled": 0, "skipped": 0 },
7373
// Present ONLY when the full PyTorch suite (test_pytorch_wheels_full) ran;
7474
// omitted otherwise. Same counter shape as "test"; kept separate so the
@@ -101,7 +101,7 @@
101101
"test": { "success": 0, "failure": 0, "in_progress": 1, "cancelled": 0, "skipped": 0 }
102102
},
103103
"pytorch": {
104-
"build": { "status": "in_progress" },
104+
"build": { "status": "in_progress", "success": 0, "failure": 0, "in_progress": 1, "cancelled": 0, "skipped": 0 },
105105
"test": { "success": 0, "failure": 0, "in_progress": 1, "cancelled": 0, "skipped": 0 }
106106
}
107107
// jax, native_packages omitted - not supported on windows

‎scripts/consumer/tests/read_status_json_test.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def test_keeps_double_slash_inside_strings(self):
7878

7979
def test_reference_parses(self):
8080
data = _load_reference()
81-
self.assertEqual(data["schema_version"], "2.1")
81+
self.assertEqual(data["schema_version"], "2.2")
8282

8383

8484
class StatusEnumTest(unittest.TestCase):
@@ -138,7 +138,7 @@ def test_release_metadata(self):
138138
self.assertEqual(self.status.rocm_version, "7.13.0a20260408")
139139
self.assertEqual(self.status.build_date, "20260408")
140140
self.assertEqual(self.status.release_type, "nightly")
141-
self.assertEqual(self.status.schema_version, "2.1")
141+
self.assertEqual(self.status.schema_version, "2.2")
142142

143143
def test_build_provenance(self):
144144
self.assertEqual(self.status.build_variant, "release")

‎scripts/receive_therock/tests/therock_status_document_test.py‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1080,11 +1080,12 @@ def test_to_dict_keeps_zero_counts_in_summary() -> None:
10801080
# --- schema_version migration -----------------------------------------------
10811081

10821082

1083-
def test_from_dict_restamps_older_minor_to_current() -> None:
1084-
# An on-disk doc from an older minor (2.0, written before the current bump)
1083+
@pytest.mark.parametrize("older", ["2.0", "2.1"])
1084+
def test_from_dict_restamps_older_minor_to_current(older: str) -> None:
1085+
# An on-disk doc from an older minor (written before the current bump)
10851086
# reads successfully and is restamped to the current version, so the next
10861087
# write upgrades the file in place. New fields fall back to their defaults.
1087-
doc = StatusDocument.from_dict({"schema_version": "2.0", "rocm_version": "7.0.0"})
1088+
doc = StatusDocument.from_dict({"schema_version": older, "rocm_version": "7.0.0"})
10881089
assert doc.schema_version == SCHEMA_VERSION
10891090
assert doc.to_dict()["schema_version"] == SCHEMA_VERSION
10901091

‎scripts/receive_therock/tests/therock_summary_test.py‎

Lines changed: 81 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
import sys
1414
from pathlib import Path
1515

16+
import pytest
17+
1618
SCRIPT_DIR = Path(__file__).resolve().parents[1]
1719
if str(SCRIPT_DIR) not in sys.path:
1820
sys.path.insert(0, str(SCRIPT_DIR))
@@ -818,7 +820,7 @@ def test_test_rollup_aggregates_across_leaves_and_cells() -> None:
818820

819821
def test_build_and_test_coexist_on_one_pipeline_rollup() -> None:
820822
# A pipeline with both a build leaf and test leaves carries both rollups:
821-
# build collapses to a status, test counts cells.
823+
# a single-run build carries only its status, while test counts cells.
822824
doc = StatusDocument()
823825
_freeze(doc, "linux", ["gfx942"])
824826
doc.upsert_leaf("linux", "", "rocm", "build", _leaf(status=Status.success))
@@ -829,6 +831,84 @@ def test_build_and_test_coexist_on_one_pipeline_rollup() -> None:
829831
assert rocm.test.success == 1
830832

831833

834+
@pytest.mark.parametrize("pipeline", ["pytorch", "jax"])
835+
def test_matrix_build_counts_each_cell(pipeline: str) -> None:
836+
# Each python x framework version builds and uploads on its own, so the
837+
# build carries per-cell counts next to its worst-of status: one failed
838+
# cell reads `failure` while every recorded cell remains visible in its
839+
# corresponding counter.
840+
doc = StatusDocument()
841+
_freeze(doc, "linux", ["gfx942"])
842+
doc.upsert_leaf(
843+
"linux",
844+
"",
845+
pipeline,
846+
"build",
847+
_leaf(
848+
variants=[
849+
_variant(matrix={"py": "3.11"}, status=Status.success),
850+
_variant(matrix={"py": "3.12"}, status=Status.success),
851+
_variant(matrix={"py": "3.13"}, status=Status.failure),
852+
_variant(matrix={"py": "3.14"}, status=Status.in_progress),
853+
_variant(matrix={"py": "3.15"}, status=Status.cancelled),
854+
_variant(matrix={"py": "3.16"}, status=Status.skipped),
855+
]
856+
),
857+
)
858+
rebuild_summary(doc)
859+
build = getattr(doc.summary.linux, pipeline).build
860+
assert build.status is Status.failure
861+
assert (
862+
build.success,
863+
build.failure,
864+
build.in_progress,
865+
build.cancelled,
866+
build.skipped,
867+
) == (2, 1, 1, 1, 1)
868+
869+
870+
def test_matrix_build_counts_are_emitted_on_disk() -> None:
871+
doc = StatusDocument()
872+
_freeze(doc, "linux", ["gfx942"])
873+
doc.upsert_leaf(
874+
"linux",
875+
"",
876+
"pytorch",
877+
"build",
878+
_leaf(
879+
variants=[
880+
_variant(matrix={"py": "3.11"}, status=Status.success),
881+
_variant(matrix={"py": "3.12"}, status=Status.failure),
882+
]
883+
),
884+
)
885+
rebuild_summary(doc)
886+
assert doc.to_dict()["summary"]["linux"]["pytorch"]["build"] == {
887+
"status": "failure",
888+
"success": 1,
889+
"failure": 1,
890+
"in_progress": 0,
891+
"cancelled": 0,
892+
"skipped": 0,
893+
}
894+
895+
896+
def test_single_run_and_unreported_builds_carry_no_counts() -> None:
897+
# rocm and native rpm/deb are single-run builds; an unreported pytorch / jax
898+
# build is a placeholder. None of them has cells to count.
899+
doc = StatusDocument()
900+
_freeze(doc, "linux", ["gfx942"])
901+
doc.upsert_leaf("linux", "", "rocm", "build", _leaf(status=Status.success))
902+
doc.upsert_leaf("", "", "native_packages", "rpm", _leaf(status=Status.success))
903+
rebuild_summary(doc)
904+
linux = doc.to_dict()["summary"]["linux"]
905+
assert linux["rocm"]["build"] == {"status": "success"}
906+
assert linux["native_packages"]["rpm"] == {"status": "success"}
907+
assert linux["native_packages"]["deb"] == {"status": "in_progress"}
908+
assert linux["pytorch"]["build"] == {"status": "in_progress"}
909+
assert linux["jax"]["build"] == {"status": "in_progress"}
910+
911+
832912
def test_test_only_pipeline_rollup_does_not_leave_build_in_progress() -> None:
833913
# Delegated framework releases can report platform test leaves without a
834914
# matching build leaf for that same platform. The mandatory build projection

‎scripts/receive_therock/therock_status_document.py‎

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
│ ├── status
1616
│ ├── architectures
1717
│ ├── urls
18-
│ ├── <rocm|pytorch|jax> -> build {status} + test {status counts}
18+
│ ├── <rocm|pytorch|jax> -> build {status [+ status counts for pytorch/jax]}
19+
│ │ + test {status counts}
1920
│ └── native_packages
2021
│ └── <rpm|deb> -> {status}
2122
└── pipelines detail tree (typed; absent slots -> null)
@@ -58,7 +59,7 @@
5859

5960
from pydantic import BaseModel, Field, model_serializer, model_validator
6061

61-
SCHEMA_VERSION: Final = "2.1"
62+
SCHEMA_VERSION: Final = "2.2"
6263

6364
JSONValue = str | int | float | bool | None | dict[str, "JSONValue"] | list["JSONValue"]
6465
JSONDict = dict[str, JSONValue]
@@ -456,9 +457,14 @@ def merge_matrix_test_leaf(existing: "RunLeaf | None", new: "RunLeaf") -> "RunLe
456457

457458

458459
class BuildRollup(BaseModel):
459-
"""A build phase rolled up to a single status (variants collapse into it)."""
460+
"""A build phase rolled up to a single worst-of `status`."""
460461

461462
status: Status = Status.in_progress
463+
success: int | None = None
464+
failure: int | None = None
465+
in_progress: int | None = None
466+
cancelled: int | None = None
467+
skipped: int | None = None
462468

463469

464470
class TestRollup(BaseModel):
@@ -562,7 +568,7 @@ class StatusDocument(BaseModel):
562568
# Timestamps stay `str`: they are emitted ISO-8601 with a `Z` suffix, which
563569
# Pydantic's native `datetime` does not round-trip (it renders `+00:00`).
564570
# `build_date` is a compact `YYYYMMDD` string, not a date.
565-
schema_version: Literal["2.1"] = SCHEMA_VERSION
571+
schema_version: Literal["2.2"] = SCHEMA_VERSION
566572
release_type: ReleaseType | None = None
567573
rocm_version: str = ""
568574
build_date: str = ""

‎scripts/receive_therock/therock_summary.py‎

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -240,10 +240,10 @@ def _unstarted_pipeline_status(
240240
def _pipeline_rollup(
241241
pipe: Pipeline, platform: str, seen_statuses: list[Status]
242242
) -> PipelineRollup | None:
243-
"""Roll one pipeline up: build collapses to a status, test to per-status
244-
counts. Returns `None` when this platform has neither a build nor a test
245-
leaf, so the pipeline is dropped from the projection instead of emitting a
246-
placeholder."""
243+
"""Roll one pipeline up: build keeps its worst-of status and matrix-cell
244+
counts when present, while test keeps per-status counts. Returns `None`
245+
when this platform has neither a build nor a test leaf, so the pipeline is
246+
dropped from the projection instead of emitting a placeholder."""
247247
build_leaf = pipe.build.get(platform)
248248
arch_map = pipe.test.get(platform)
249249
full_arch_map = pipe.test_full.get(platform)
@@ -252,7 +252,7 @@ def _pipeline_rollup(
252252
rollup = PipelineRollup()
253253
if build_leaf is not None:
254254
seen_statuses.append(build_leaf.status)
255-
rollup.build = BuildRollup(status=build_leaf.status)
255+
rollup.build = _build_rollup(build_leaf)
256256
test_status_start = len(seen_statuses)
257257
if arch_map:
258258
rollup.test = _test_rollup(arch_map.values(), seen_statuses)
@@ -300,6 +300,23 @@ def _native_rollup(
300300
)
301301

302302

303+
def _build_rollup(leaf: RunLeaf) -> BuildRollup:
304+
"""The build leaf's worst-of status, plus per-status counts over its matrix
305+
cells when it fanned out (pytorch / jax). A single-run build carries no
306+
counts."""
307+
if not leaf.variants:
308+
return BuildRollup(status=leaf.status)
309+
counter = Counter(v.status for v in leaf.variants)
310+
return BuildRollup(
311+
status=leaf.status,
312+
success=counter[Status.success],
313+
failure=counter[Status.failure],
314+
in_progress=counter[Status.in_progress],
315+
cancelled=counter[Status.cancelled],
316+
skipped=counter[Status.skipped],
317+
)
318+
319+
303320
def _test_rollup(leaves: Iterable[RunLeaf], seen_statuses: list[Status]) -> TestRollup:
304321
"""Per-status counts across every test leaf and matrix cell of a phase."""
305322
counter: Counter[Status] = Counter()

0 commit comments

Comments
 (0)