Repository navigation
Expose the platform ROCm build run ID - #137
Conversation
Consumers need the producing run ID to fetch artifacts for a specific platform. Let them query a successful ROCm build directly from a Quartz pin and pass its ID to TheRock's stage fetcher or installer. Closes #135 Test plan: - python -m unittest scripts.consumer.tests.read_status_json_test Test result: - All 46 consumer tests passed. Generated with Codex
f7d6e30 to
70a10d7
Compare
HereThereBeDragons
left a comment
There was a problem hiding this comment.
thanks. overall looks good. just a couple of questions and suggestions for improvements
| in ROCm/TheRock. Discussion: | ||
| [ROCm/TheRock#3782](https://github.com/ROCm/TheRock/discussions/3782). | ||
| - **[docs/status-json/](docs/status-json/)** - the consumer guide for `status.json`. | ||
| - **[docs/tutorial/fetch-nightly-artifacts.md](docs/tutorial/fetch-nightly-artifacts.md)** - how to fetch ROCm nightly build artifacts. |
There was a problem hiding this comment.
| - **[docs/tutorial/fetch-nightly-artifacts.md](docs/tutorial/fetch-nightly-artifacts.md)** - how to fetch ROCm nightly build artifacts. | |
| - **[docs/tutorial/fetch-artifacts.md](docs/tutorial/fetch-nightly-artifacts.md)** - how to fetch ROCm build artifacts. |
| @@ -0,0 +1,67 @@ | |||
| # Fetch ROCm nightly build artifacts | |||
There was a problem hiding this comment.
rename the file and remove "nightly" fro mthe filename + from this title
this isa applicalble for any of streams quartz provides a status.json for
so just say that as an example we show how to do it for "nightly" stream
| """The detailed pipelines tree as a raw dict (per-arch, per-variant).""" | ||
| return self._data.get("pipelines", {}) | ||
|
|
||
| def rocm_build_run_id(self, platform: str) -> int: |
There was a problem hiding this comment.
lets change this here a bit differently:
for quartz we recommend that users first check the status and then access the variables. so in this case it would be first check if rocm build is success for your preferred platform on summary level. no need to dig into the details.
(rocm.build == success also means that the python packages/tarballs have been successfully uploaded, PR #115 introduces a new rocm.build_artifacts that returns true as soon as the build has finished and only the artifacts but not yet the packages are available; we can change to this as soon as we have merged it)
recommended change of the function body:
(feel free to adapt the error message)
platform_status = self.platform(platform)
build = platform_status.pipeline_build_status("rocm") if platform_status else None
if build != Status.success:
raise ValueError(f"No successful ROCm build for {platform} (status {build!r} - run-id {self.trigger_workflow_run_id})")
return self.trigger_workflow_run_id
expect return type is then int | None
There was a problem hiding this comment.
Agreed. I've let my agent update the accessor locally to check the requested platform's ROCm build status in the summary and return trigger_workflow_run_id on success. We should keep the return type as int so a missing or invalid ID produces a CLI error instead of printing None. The tests will cover both the returned trigger ID and the platform status check.
| default=DEFAULT_SOURCE, | ||
| help="URL or local path to a status.json (default: latest nightly)", | ||
| ) | ||
| parser.add_argument( |
There was a problem hiding this comment.
hadnt thought about going into the direction of this becoming a cli tool, but that is also fine
but i am wondering a bit about the naming. maybe we can change it to --get-run-id or something like this to make it clear? otherwise with --run-id i would not expect "linux" or "windows" as input. and should we also support "both"?
the agent also raised that in the fetch tutorial that might be confusing because therock script expects the runid after --run-id
There was a problem hiding this comment.
No strong feelings. Will rename to --get-run-id.
| |- is_complete True once the build has finished | ||
| |- build_id (rocm_version, build_date) dedup key | ||
| |- raw, pipelines escape hatch to the raw dicts | ||
| |- rocm_build_run_id(platform) successful ROCm build workflow run ID |
There was a problem hiding this comment.
this is not a property function. i am not sure if we should mention it here? as it is more a convenience function
There was a problem hiding this comment.
I think we can keep rocm_build_run_id(platform) in the API overview. The overview already lists methods alongside properties, including platform(name) and tarball_url(...). This entry shows Python callers how to perform the same lookup as --get-run-id.
| bucket. | ||
|
|
||
| **Fetch the dependencies of a build stage.** This example merges the inputs to | ||
| the `math-libs` stage into one prefix. Use one invocation per stage. Stage dependencies come |
There was a problem hiding this comment.
this sentence with "This example merges..." reads very oddly if you are not familiar with the script. maybe you can rephras ehtis a bit?
| TheRock revision recorded in the status document's `therock_commit` field. | ||
|
|
||
| ```bash | ||
| RELEASE_TYPE=nightly python "$tools/artifact_manager.py" fetch --run-id "$run_id" --run-github-repo ROCm/rockrel \ |
There was a problem hiding this comment.
does this work the same for other release types? if not, maybe a small note would be good
There was a problem hiding this comment.
Release type doesn't matter, so no note needed.
| } | ||
| ) | ||
| self.assertEqual(result.returncode, 0, result.stderr) | ||
| self.assertEqual(result.stdout, "102\n") |
There was a problem hiding this comment.
test needs updating
artifact id is not based on linux/windows specific runs. it is the id from the triggering workflow - so should be "trigger_workflow_run_id": 100
(well it is the same id because its all workflow calls)
| destination directory if it exists. Add `--dry-run` to preview the files. | ||
|
|
||
| ```bash | ||
| RELEASE_TYPE=nightly python "$tools/install_rocm_from_artifacts.py" --run-id "$run_id" --run-github-repo ROCm/rockrel \ |
There was a problem hiding this comment.
one discussion with the agent about --run-github-repo. it seems not to be needed?
tracing the call chain on TheRock main:
install_rocm_from_artifacts.py --run-idforwards--run-github-repotoartifact_manager.py fetchfetchcallscreate_backend_from_env(), which callsWorkflowOutputRoot.from_workflow_run()withoutlookup_workflow_run, so no GitHub API callget_artifacts_bucket_config()only reads the repo forRELEASE_TYPE=ci(bucket choice +owner-repo/prefix)
for nightly / prerelease / nightly-bkc the bucket comes from RELEASE_TYPE alone. unless I'm missing a planned change, I'd drop it - otherwise it suggests the repo selects the artifact source (which is also the premise of #136).
There was a problem hiding this comment.
The bucket yes, but the run-id does not and the script calls into GH first... not needed strictly but this is what it is as of today,
There was a problem hiding this comment.
Looked closer. Your reasoning applies to artifact_manager.py fetch, so we can drop the flag from that example. The installer takes a different path through fetch_artifacts.py, which enables the GitHub run lookup and that's what I hit befofe. Verified that the same nightly run returns 404 under ROCm/TheRock and resolves under ROCm/rockrel.
Generated with Codex
|
Thanks for the review @HereThereBeDragons. I rather consider this as a starting point and don't think it must be perfect for the first shot. I addressed you're feedback where I think it is applicable. PTAL. |
HereThereBeDragons
left a comment
There was a problem hiding this comment.
thanks, good for me to merge.
only the change log needs updating.
|
|
||
| ## Unreleased | ||
| ## v1.3.0 - Unreleased | ||
|
|
There was a problem hiding this comment.
### Added missing .sorry i didnt catch that
| `2`. | ||
|
|
||
| ## Unreleased | ||
| ## v1.3.0 - Unreleased |
There was a problem hiding this comment.
## v1.3.0 - 2026-11-19 (tagged `consumer/v1.3.0`)
|
unittest failures are unrelated |
…er bump to v1.4.0) (#138) ## Motivation A GitHub Actions run ID alone is not enough to look up a run or fetch its artifacts; TheRock's tools also need the repository (`--run-github-repo`, which defaults to `$GITHUB_REPOSITORY` or `ROCm/TheRock`). Since #137, consumers can read the run ID of a nightly from Quartz, but they still have to know that nightlies run in `ROCm/rockrel`. This PR records the repository next to the run ID in `status.json` and exposes it through the consumer reader, so consumers no longer need to hardcode it. Closes #136 ## Technical Details status.json (schema 2.2 -> 2.3): - New top-level field `trigger_repository` (for example `ROCm/rockrel`). The setup run and the top-level orchestrator set it together with `trigger_workflow_run_id`, so a newer run replaces both and a stale run changes neither. - Any accepted write restamps an older document to 2.3. When that write upgrades a 2.2 document, the producer also fills in `trigger_repository` from the incoming run. Therefore every 2.3 document carries the key. Producer: - The repository now lives on the classification (`Classification.repository`). `classify(wr, repository)` copies it from the dispatch envelope, so the status writer and future database ingest read it from the same place. Consumer reader (v1.4.0): - `StatusDocument.trigger_repository` returns the recorded `owner/repo`. Schema 2.0 - 2.2 documents do not record it; for them it returns `ROCm/rockrel`, where all of those workflows ran. From 2.3 on, a missing or malformed value raises `ValueError`. - New `--get-repo` CLI option prints the repository. It takes no platform, since the repository belongs to the whole document, and it is mutually exclusive with `--get-run-id`. Docs: - Schema reference, status.json README, and both changelogs are updated. - The fetch-artifacts tutorial resolves `nightly/latest.json` to its dated status document once, reads the run ID and the repository from it, and passes both to TheRock's tools. ## Test Plan - `python -m pytest scripts docs` - Live check against the published nightly: the tutorial commands resolve `nightly/20261124/status.json` and return run ID `45293646167` and repository `ROCm/rockrel` (via the pre-2.3 fallback). ## Test Result - 675 tests passed. `NotifyQuartzWiringTest` fails locally because it reads a local TheRock checkout; it fails the same way on `main` and is unrelated to this change. - New tests cover the repository on owner events, replacement by a newer owner from a different repository, rejection of a stale re-run, the 2.2 -> 2.3 upgrade through both leaf and owner events, and the consumer fallback and error cases. ## Submission Checklist - [x] Look over the contributing guidelines at https://github.com/ROCm/TheRock/blob/main/GOVERNANCE.md#pull-requests. Generated with [Claude Code](https://claude.com/claude-code)
Motivation
Downstream consumers need a GitHub Actions run ID to fetch ROCm build artifacts with TheRock’s tools. This adds
--get-run-id PLATFORMto the Quartz reader.Technical Details
When invoked with
--get-run-id PLATFORM, the reader checks the requested platform's ROCm build status. If the build succeeded, it prints the triggering workflow's run ID. The accompanying tutorial shows how to resolve that ID from a Quartz pin and use it to fetch a build stage's dependencies or assemble a local ROCm installation.Closes #135
Test Plan
Test Result
Submission Checklist
Generated with Codex