-
Notifications
You must be signed in to change notification settings - Fork 104
257 lines (217 loc) · 7.63 KB
/
cache-probe.yaml
File metadata and controls
257 lines (217 loc) · 7.63 KB
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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
name: Cache Probe
on:
push:
branches:
- agent/cache-probe-*
workflow_dispatch:
permissions:
contents: read
packages: write
jobs:
cw-cluster-start:
name: CW Cluster Start (${{ matrix.mode }})
runs-on: ubuntu-latest
timeout-minutes: 120
strategy:
fail-fast: false
matrix:
mode: [verbose]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
- name: Install dependencies
run: uv sync --all-packages --extra=cpu --no-default-groups
- name: Write CoreWeave kubeconfig
run: |
mkdir -p ~/.kube
echo "${{ secrets.CW_KUBECONFIG }}" > ~/.kube/coreweave-iris
chmod 600 ~/.kube/coreweave-iris
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Inspect buildx builder
run: docker buildx inspect | tee builder-inspect.txt
- name: Start CoreWeave cluster
id: start
shell: bash
run: |
set -euo pipefail
if [[ "${{ matrix.mode }}" == "verbose" ]]; then
export BUILDKIT_PROGRESS=plain
iris_args=(-v)
else
iris_args=()
fi
start_ts=$(date +%s)
.venv/bin/iris "${iris_args[@]}" --config=lib/iris/examples/coreweave.yaml cluster start 2>&1 | tee cluster-start.log
end_ts=$(date +%s)
echo "elapsed_seconds=$((end_ts - start_ts))" >> "$GITHUB_OUTPUT"
env:
R2_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
R2_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
- name: Summarize cluster-start logs
if: always()
shell: bash
env:
ELAPSED_SECONDS: ${{ steps.start.outputs.elapsed_seconds }}
run: |
set -euo pipefail
log_file=cluster-start.log
line_count=0
cached_count=0
done_count=0
if [[ -f "$log_file" ]]; then
line_count=$(wc -l < "$log_file" | tr -d ' ')
cached_count=$(grep -c ' CACHED' "$log_file" || true)
done_count=$(grep -cE '^#.* DONE( |$)' "$log_file" || true)
fi
{
echo "## CW cluster start: ${{ matrix.mode }}"
echo
echo "- elapsed_seconds: ${ELAPSED_SECONDS:-unknown}"
echo "- log_lines: ${line_count}"
echo "- cached_lines: ${cached_count}"
echo "- done_lines: ${done_count}"
echo "- step_outcome: ${{ steps.start.outcome }}"
} >> "$GITHUB_STEP_SUMMARY"
- name: Upload cluster-start logs
if: always()
uses: actions/upload-artifact@v4
with:
name: cw-cluster-start-${{ matrix.mode }}-${{ github.run_id }}-${{ github.run_attempt }}
path: |
builder-inspect.txt
cluster-start.log
if-no-files-found: warn
- name: Stop CoreWeave cluster
if: always()
continue-on-error: true
run: .venv/bin/iris --config=lib/iris/examples/coreweave.yaml cluster stop
env:
R2_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
R2_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
seed-iris-task:
name: Seed iris-task (${{ matrix.mode }})
runs-on: ubuntu-latest
timeout-minutes: 45
strategy:
fail-fast: false
matrix:
mode: [noinline, inline]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Seed cache image
shell: bash
run: |
set -euo pipefail
cache_ref="ghcr.io/marin-community/iris-task:cache-probe-${{ github.run_id }}-${{ github.run_attempt }}-${{ matrix.mode }}"
extra_args=()
if [[ "${{ matrix.mode }}" == "inline" ]]; then
extra_args+=(--cache-to type=inline)
fi
docker buildx build \
--platform linux/amd64 \
--progress plain \
--build-arg "IRIS_GIT_HASH=$(git rev-parse --short HEAD)" \
--tag "$cache_ref" \
"${extra_args[@]}" \
--push \
-f lib/iris/Dockerfile.task \
.
{
echo "## Seed iris-task: ${{ matrix.mode }}"
echo
echo "- cache_ref: $cache_ref"
} >> "$GITHUB_STEP_SUMMARY"
measure-iris-task:
name: Measure iris-task (${{ matrix.mode }})
runs-on: ubuntu-latest
timeout-minutes: 45
needs: seed-iris-task
strategy:
fail-fast: false
matrix:
mode: [noinline, inline]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Inspect buildx builder
run: docker buildx inspect | tee builder-inspect.txt
- name: Measure cache reuse
id: measure
shell: bash
run: |
set -euo pipefail
cache_ref="ghcr.io/marin-community/iris-task:cache-probe-${{ github.run_id }}-${{ github.run_attempt }}-${{ matrix.mode }}"
probe_tag="iris-task:probe-${{ matrix.mode }}"
start_ts=$(date +%s)
docker buildx build \
--platform linux/amd64 \
--progress plain \
--build-arg "IRIS_GIT_HASH=$(git rev-parse --short HEAD)" \
--tag "$probe_tag" \
--cache-from "type=registry,ref=$cache_ref" \
--output "type=docker,name=$probe_tag" \
-f lib/iris/Dockerfile.task \
. \
2>&1 | tee measure.log
end_ts=$(date +%s)
echo "elapsed_seconds=$((end_ts - start_ts))" >> "$GITHUB_OUTPUT"
- name: Summarize measurement logs
if: always()
shell: bash
env:
ELAPSED_SECONDS: ${{ steps.measure.outputs.elapsed_seconds }}
run: |
set -euo pipefail
line_count=0
cached_count=0
done_count=0
if [[ -f measure.log ]]; then
line_count=$(wc -l < measure.log | tr -d ' ')
cached_count=$(grep -c ' CACHED' measure.log || true)
done_count=$(grep -cE '^#.* DONE( |$)' measure.log || true)
fi
{
echo "## Measure iris-task: ${{ matrix.mode }}"
echo
echo "- cache_ref: ghcr.io/marin-community/iris-task:cache-probe-${{ github.run_id }}-${{ github.run_attempt }}-${{ matrix.mode }}"
echo "- elapsed_seconds: ${ELAPSED_SECONDS:-unknown}"
echo "- log_lines: ${line_count}"
echo "- cached_lines: ${cached_count}"
echo "- done_lines: ${done_count}"
echo "- step_outcome: ${{ steps.measure.outcome }}"
} >> "$GITHUB_STEP_SUMMARY"
- name: Upload measurement logs
if: always()
uses: actions/upload-artifact@v4
with:
name: iris-task-measure-${{ matrix.mode }}-${{ github.run_id }}-${{ github.run_attempt }}
path: |
builder-inspect.txt
measure.log
if-no-files-found: warn