-
Notifications
You must be signed in to change notification settings - Fork 56
158 lines (138 loc) · 5.18 KB
/
nightly-pax-test-mgmn.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
name: Nightly Pax MGMN performance test
run-name: Nightly Pax MGMN performance test (${{ github.event_name == 'workflow_run' && format('nightly {0}', github.event.workflow_run.created_at) || github.event_name }})
on:
workflow_run:
workflows: [Nightly Pax build]
types: [completed]
branches: [main]
workflow_dispatch:
inputs:
PAX_IMAGE:
type: string
description: Pax container
default: 'ghcr.io/nvidia/upstream-pax:latest'
required: true
PUBLISH:
type: boolean
description: Publish dated results to tensorboard server?
default: false
required: false
permissions:
contents: read # to fetch code
actions: write # to cancel previous workflows
packages: write # to upload container
issues: write # to create issues
env:
DEFAULT_PAX_IMAGE: 'ghcr.io/nvidia/upstream-pax:latest'
jobs:
metadata:
runs-on: ubuntu-22.04
outputs:
BUILD_DATE: ${{ steps.date.outputs.BUILD_DATE }}
PAX_IMAGE: ${{ steps.image.outputs.PAX_IMAGE }}
PUBLISH: ${{ steps.publish.outputs.PUBLISH }}
steps:
- name: Check if the triggering workflow failed
id: if-upstream-failed
shell: bash -x -e {0}
run: |
echo "UPSTREAM_FAILED=${{ github.event_name == 'workflow_run' && github.event.workflow_run.conclusion != 'success' }}" >> $GITHUB_OUTPUT
- name: Cancel workflow if upstream workflow did not success
if: ${{ steps.if-upstream-failed.outputs.UPSTREAM_FAILED == 'true' }}
run: |
echo "Upstream workflow failed, cancelling this workflow"
curl -X POST -H "Authorization: token ${{ github.token }}" \
-H "Accept: application/vnd.github.v3+json" \
"https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/cancel"
cat # blocks execution in case workflow cancellation takes time
- name: Set build date
id: date
shell: bash -x -e {0}
run: |
BUILD_DATE=$(TZ='US/Los_Angeles' date '+%Y-%m-%d')
echo "BUILD_DATE=${BUILD_DATE}" >> $GITHUB_OUTPUT
- name: Set docker image
id: image
shell: bash -x -e {0}
run: |
PAX_IMAGE=${{ inputs.PAX_IMAGE }}
PAX_IMAGE=${PAX_IMAGE:-${{ env.DEFAULT_PAX_IMAGE }}}
echo "PAX_IMAGE=${PAX_IMAGE}" >> $GITHUB_OUTPUT
- name: Set result publishing flags
id: publish
shell: bash -x -e {0}
run: |
echo "PUBLISH=${{ github.event_name == 'workflow_run' || inputs.PUBLISH == 'true' }}" >> $GITHUB_OUTPUT
run-jobs:
needs: metadata
uses: ./.github/workflows/_test_pax.yaml
with:
PAX_IMAGE: ${{ needs.metadata.outputs.PAX_IMAGE }}
secrets: inherit
tensorboard-upload:
needs: [metadata, run-jobs]
runs-on: ubuntu-22.04
steps:
- name: Setup SSH agent
uses: webfactory/ssh-agent@v0.8.0
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Setup SSH known hosts
id: ssh-known-hosts
run: |
mkdir -p ~/.ssh
cat >> ~/.ssh/known_hosts << EOF
${{ vars.SSH_KNOWN_HOSTS }}
EOF
chmod 600 ~/.ssh/known_hosts
echo "FILE=$(realpath ~/.ssh/known_hosts)" >> $GITHUB_OUTPUT
- name: Setup SSH config
id: ssh-config
run: |
mkdir -p ~/.ssh
cat >> ~/.ssh/config << EOF
${{ vars.SSH_CONFIG }}
EOF
chmod 600 ~/.ssh/config
- name: Create dated folder and generate TensorBoard query URL
id: mkdir
shell: bash -x -e {0}
run: |
FOLDER="${{ needs.metadata.outputs.BUILD_DATE }}/PAX"
# copy folder
ssh -T tensorboard mkdir -p /tensorboard-logs/${FOLDER}
ssh -T tensorboard rsync -rt /tensorboard-logs/${GITHUB_RUN_ID}/ /tensorboard-logs/${FOLDER}/
# generate query URL
(
cat << EOF
## PAX MGMN nightly training: ${{ needs.metadata.outputs.BUILD_DATE }}
[view metrics](https://${{ vars.HOSTNAME_TENSORBOARD }}/#scalars®exInput=$(jq -nr --arg url "${FOLDER}" '$url|@uri')&_smoothingWeight=0&tagFilter=seqs_per)
EOF
) | tee $GITHUB_STEP_SUMMARY
publish-verified-image:
needs: [metadata, run-jobs]
if: needs.metadata.outputs.PUBLISH == 'true' && needs.run-jobs.outputs.TEST_STATUS == 'success'
uses: ./.github/workflows/_publish_container.yaml
secrets: inherit
with:
SOURCE_IMAGE: ${{ needs.metadata.outputs.PAX_IMAGE }}
TARGET_IMAGE: upstream-pax
TARGET_TAGS: |
type=raw,value=latest-verified,priority=1000
failure-triage:
needs: [metadata, run-jobs]
if: needs.run-jobs.outputs.TEST_STATUS != 'success'
uses: ./.github/workflows/_triage.yaml
secrets: inherit
with:
BROKEN_IMAGE: ${{ needs.metadata.outputs.PAX_IMAGE }}
BASE_IMAGE: ghcr.io/nvidia/upstream-pax:latest-verified
REPO_DIRS: "/opt/paxml /opt/praxis"
FILE_ISSUE: true
finalize:
if: "!cancelled()"
needs: [metadata, run-jobs]
uses: ./.github/workflows/_finalize.yaml
with:
PUBLISH_BADGE: ${{ needs.metadata.outputs.PUBLISH }}
secrets: inherit