Make Github Run ID selection stricter, update docs - #170
Conversation
| --json 'createdAt,databaseId' \ | ||
| --jq 'sort_by(.createdAt) | reverse | .[0] | .databaseId')} |
There was a problem hiding this comment.
See "How I tested this" in the PR description.
In short, gh run list does not make any strong guarantees about sorting, so just saying "choose the first element in the returned list" is not safe.
docs on gh run list: https://cli.github.com/manual/gh_run_list
| --commit "${RAPIDS_SHA}" \ | ||
| --workflow "${RAPIDS_BUILD_WORKFLOW_NAME:-build.yaml}" \ | ||
| --event "workflow_dispatch" \ | ||
| --created "${RAPIDS_NIGHTLY_DATE}" \ |
There was a problem hiding this comment.
Proposing here that we remove --created from the call for nightly runs.
From the docs in gh run list --help:
FLAGS
...
--created date Filter runs by the date it was created
...
Using this flag creates an awkward association between the time when a workflow is scheduled and the nightly date it is "for".
Imagine this sequence:
rmmnightly build job starts at2025-05-10T05:00:00Z- ... builds for all dependencies between
rmmandcumlrun... cumlnightly build job starts at2025-05-10T23:59:59Z(almost 19 hours later)cumlnightly test job starts at2025-05-11T01:00:00Z(the next day)
I think in that case, the test run would fail to download artifacts here:
Because RAPIDS_NIGHTLY_DATE on the test run would be 2025-05-11, but the latest nightly artifacts were generated by a workflow run that started on 2025-05-10.
Is this likely? I don't know.
On the most recent run, it took about 3 hours from when rmm-build began to when cuml-tests began
rmm-build: (started at 2025-05-08T05:04:06, click here for logs)cuml-tests: (started at 2025-05-08T07:45:10, click here for logs)
Situations where we could encounter this problem:
- builds take much longer than that run (e.g. because of a high rate of
sccachemisses) - we change the nightly pipeline to be triggered later than 5am UTC (code link)
- build parallelism is worsened by some change in the dependency graph (e.g.,
cugraphadding a build-time dependency oncuml)
I cannot think of any situation where "get the artifacts from the latest nightly run for this specific branch + commit" would produce the wrong behavior, so even if we think the scenario I described above is unlikely, I still think we should remove --created here because it's possible.
There was a problem hiding this comment.
Thanks for reading through it!
| --commit "${RAPIDS_SHA}" \ | ||
| --workflow "${RAPIDS_BUILD_WORKFLOW_NAME:-build.yaml}" \ | ||
| --event "workflow_dispatch" \ | ||
| --created "${RAPIDS_NIGHTLY_DATE}" \ |
I've been using `rapids-get-pr-artifact` a lot recently, for rapidsai/build-planning#257 Today, one of my PRs for that briefly caused `cudf` to briefly exceed its GitHub API limits: NVIDIA/cudf#21671 (comment) This proposes some fixes to `rapids-get-pr-artifact` in the future: * error out of a unique GitHub Actions run ID can't be determined from the inputs - *(instead of passing an empty string to `gh run download`, which causes it to page over **all CI runs GitHub's history retains**)* * limit initial search for runs to just `pr.yaml` workflow - *(optionally overridable by env variable `RAPIDS_BUILD_WORKFLOW_NAME`)* These should make `rapids-get-pr-artifact` faster and, more importantly, use many fewer GitHub API calls. ## Notes for Reviewers ### Haven't I seen this before? Yep! Similar changes were made in `rapids-github-run-id`: * #193 * #170 `rapids-get-pr-artifact` doesn't use `rapids-github-run-id` because its behavior of "use environment variable `GITHUB_RUN_ID` if it's available" is undesirable when you're trying to workflow runs in a repo other than the one `rapids-get-pr-artifact` is currently running in. ### How I tested this Tested on NVIDIA/cudf#21671, with NVIDIA/cudf@c058c43 Authors: - James Lamb (https://github.com/jameslamb) Approvers: - Gil Forsyth (https://github.com/gforsyth) URL: #249
Contributes to https://github.com/rapidsai/build-infra/issues/237
Proposes the following changes to scripts involved in handling GitHub Actions artifacts:
rapids-github-run-id, implements explicit sorting to get the latest run--createdfromrapids-github-run-idcode for nightly buildsrapids-github-run-idandrapids-prompt-local-repo-configNotes for Reviewers
How I tested this
Looked for a repo that doesn't get a lot of commits, so I could test that case where one query with
gh run listwas likely to return multiple runs for the same commit.Chose this
cugraph-gnncommit: rapidsai/cugraph-gnn@33bccfeSure enough, there were multiple runs for it.
Output:
In this case, run
14878118285is the latest, and so the one we want.Tested that that's what is returned:
I've also tested this in an
rmmPR: rapidsai/rmm#1909Look at the most recent run from there: https://github.com/rapidsai/rmm/actions/runs/14914562796/job/41897151092?pr=1909
The run ID (
14914562796) in theconda-cpp-testslogs matches the one in the job URL... so I think it's finding the right thing, at least for PRs.