xref: /aosp_15_r20/external/pytorch/tools/stats/README.md (revision da0073e96a02ea20f0ac840b70461e3646d07c45)
1# PyTorch CI Stats
2
3We track various stats about each CI job.
4
51. Jobs upload their artifacts to an intermediate data store (either GitHub
6   Actions artifacts or S3, depending on what permissions the job has). Example:
7   https://github.com/pytorch/pytorch/blob/a9f6a35a33308f3be2413cc5c866baec5cfe3ba1/.github/workflows/_linux-build.yml#L144-L151
82. When a workflow completes, a `workflow_run` event [triggers
9   `upload-test-stats.yml`](https://github.com/pytorch/pytorch/blob/d9fca126fca7d7780ae44170d30bda901f4fe35e/.github/workflows/upload-test-stats.yml#L4).
103. `upload-test-stats` downloads the raw stats from the intermediate data store
11   and uploads them as JSON to Rockset, our metrics backend.
12
13```mermaid
14graph LR
15    J1[Job with AWS creds<br>e.g. linux, win] --raw stats--> S3[(AWS S3)]
16    J2[Job w/o AWS creds<br>e.g. mac] --raw stats--> GHA[(GH artifacts)]
17
18    S3 --> uts[upload-test-stats.yml]
19    GHA --> uts
20
21    uts --json--> R[(Rockset)]
22```
23
24Why this weird indirection? Because writing to Rockset requires special
25permissions which, for security reasons, we do not want to give to pull request
26CI. Instead, we implemented GitHub's [recommended
27pattern](https://securitylab.github.com/research/github-actions-preventing-pwn-requests/)
28for cases like this.
29
30For more details about what stats we export, check out
31[`upload-test-stats.yml`](https://github.com/pytorch/pytorch/blob/d9fca126fca7d7780ae44170d30bda901f4fe35e/.github/workflows/upload-test-stats.yml)
32