-
Notifications
You must be signed in to change notification settings - Fork 13
478 lines (420 loc) · 18.3 KB
/
test_cloud_runner.yml
File metadata and controls
478 lines (420 loc) · 18.3 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
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
name: test_cloud_runner
on:
workflow_dispatch:
inputs:
fre-workflows-repo:
description: "If using fork: Input fork name (example: singhd789/fre-workflows). Leave empty if not using a fork."
required: false
type: string
fre-workflows-branch:
description: 'If on fork: Input branch you are using on your fork.'
required: false
default: 'main'
type: string
fre-cli-repo:
description: 'NOAA-GFDL/fre-cli repo'
required: true
type: choice
default: 'NOAA-GFDL/fre-cli'
options:
- 'NOAA-GFDL/fre-cli'
fre-cli-branch:
description: 'Input which fre-cli branch to check out'
required: true
default: 'main'
type: string
push:
branches:
- main # triggers pipeline on push to main
# cancel running jobs if theres a newer push
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test-cloud:
runs-on: self-hosted
steps:
- name: Checkout fre-workflows fork if specified
if: ${{ github.event.inputs.fre-workflows-repo != ''}}
uses: actions/checkout@v4
with:
repository: ${{ github.event.inputs.fre-workflows-repo }}
ref: ${{ github.event.inputs.fre-workflows-branch }}
- name: Checkout fre-workflows repository if no fork specified
if: ${{ github.event.inputs.fre-workflows-repo == ''}}
uses: actions/checkout@v4
- name: Checkout fre-cli
uses: actions/checkout@v4
with:
repository: ${{ github.event.inputs.fre-cli-repo }}
ref: ${{ github.event.inputs.fre-cli-branch }}
path: './fre-cli'
submodules: true
- name: Display fre-workflow and fre-cli repos and branches
run: |
# fre-workflows repo and branch
echo "fre-workflows repo: $(git remote -v)"
echo "fre-workflows branch: $(git branch)"
# fre-cli repo and branch
cd fre-cli
echo "fre-cli repo: $(git remote -v)"
echo "fre-cli branch: $(git branch)"
cd -
- name: Run ppp-container
run: |
# Print pwd then run script
echo "Currently in:"
cwd=$(pwd)
echo $cwd
gridspec_file=c96_OM4_025_grid_No_mg_drag_v20160808.tar
bind_paths="--bind /contrib-efs/container-test/ppp-setup/:/mnt:rw
--bind /contrib2-bucket/c96L65_am5f11d12r0_amip/history:/mnt/history:ro
--bind /contrib-efs/container-test/c96_grid/${gridspec_file}:/mnt/${gridspec_file}:ro"
## TO-DO: figure out pulling container instead
container_path=/contrib-efs/container-test/fre-2025.04.sif
runscript_path=${cwd}/for_gh_runner/runscript.sh
singularity exec --writable-tmpfs ${bind_paths} ${container_path} ${runscript_path}
# Can potentially do this to get list of tasks
#task_list=$(cylc list test_pp__ptest__ttest)
#task1=$(echo $task_list | cut -d ' ' -f1) ....
- name: Upload workflow-run log files
uses: actions/upload-artifact@v4
with:
name: fre-workflow-logs
path: /contrib-efs/container-test/ppp-setup/cylc-run/test_pp__ptest__ttest/log
if-no-files-found: error
- name: Print workflow summary
continue-on-error: true
run: |
num_tasks=$(ls -l /contrib-efs/container-test/ppp-setup/cylc-run/test_pp__ptest__ttest/log/job/????*/*/NN/job | wc -l)
echo "number of tasks launched: ${num_tasks}"
echo ""
echo "here's all the job directories with job scripts:"
ls -l /contrib-efs/container-test/ppp-setup/cylc-run/test_pp__ptest__ttest/log/job/????*/*/NN/job
echo ""
echo "here's all the job scripts for 1980 only:"
ls -l /contrib-efs/container-test/ppp-setup/cylc-run/test_pp__ptest__ttest/log/job/1980*/*/NN/job
echo ""
echo "rose-suite conf for workflow:"
cat /contrib-efs/container-test/ppp-setup/cylc-run/test_pp__ptest__ttest/log/config/*rose-suite.conf
echo ""
- name: Print pp-starter successes or failures
run: |
set +e
# Successes
success=$(grep -E "CYLC_JOB_EXIT=SUCCEEDED" /contrib-efs/container-test/ppp-setup/cylc-run/test_pp__ptest__ttest/log/job/*/pp-starter/0[1-3]/job.status)
exit_status_1=$?
# Failures
failure=$(grep -E "CYLC_JOB_EXIT=ERR" /contrib-efs/container-test/ppp-setup/cylc-run/test_pp__ptest__ttest/log/job/*/pp-starter/0[1-3]/job.status)
exit_status_2=$?
if [ $exit_status_1 -eq 0 ]; then
echo $success | sed 's/ /\n/g' #split string by spaces
elif [ $exit_status_1 -eq 1 ]; then
echo "No succeeded tasks found"
else
echo "WARNING: error with grep execution"
exit 2
fi
if [ $exit_status_2 -eq 0 ]; then
echo "Failures found"
echo $failure | sed 's/ /\n/g' #split string by spaces
exit 1 #exit with error
elif [ $exit_status_2 -eq 1 ]; then
echo "No task failures found."
else
echo "WARNING: error with grep execution"
exit 2
fi
- name: Print stage-history successes or failures
run: |
set +e
# Successes
success=$(grep -E "CYLC_JOB_EXIT=SUCCEEDED" /contrib-efs/container-test/ppp-setup/cylc-run/test_pp__ptest__ttest/log/job/*/stage-history/0[1-3]/job.status)
exit_status_1=$?
# Failures
failure=$(grep -E "CYLC_JOB_EXIT=ERR" /contrib-efs/container-test/ppp-setup/cylc-run/test_pp__ptest__ttest/log/job/*/stage-history/0[1-3]/job.status)
exit_status_2=$?
if [ $exit_status_1 -eq 0 ]; then
echo $success | sed 's/ /\n/g' #split string by spaces
elif [ $exit_status_1 -eq 1 ]; then
echo "No succeeded tasks found"
else
echo "WARNING: error with grep execution"
exit 2
fi
if [ $exit_status_2 -eq 0 ]; then
echo "Failures found"
echo $failure | sed 's/ /\n/g' #split string by spaces
exit 1 #exit with error
elif [ $exit_status_2 -eq 1 ]; then
echo "No task failures found."
else
echo "WARNING: error with grep execution"
exit 2
fi
- name: Print regrid-xy successes or failures
run: |
set +e
# Successes
success=$(grep -E "CYLC_JOB_EXIT=SUCCEEDED" /contrib-efs/container-test/ppp-setup/cylc-run/test_pp__ptest__ttest/log/job/*/regrid-xy*/0[1-3]/job.status)
exit_status_1=$?
# Failures
failure=$(grep -E "CYLC_JOB_EXIT=ERR" /contrib-efs/container-test/ppp-setup/cylc-run/test_pp__ptest__ttest/log/job/*/regrid-xy*/0[1-3]/job.status)
exit_status_2=$?
if [ $exit_status_1 -eq 0 ]; then
echo $success | sed 's/ /\n/g' #split string by spaces
elif [ $exit_status_1 -eq 1 ]; then
echo "No succeeded tasks found"
else
echo "WARNING: error with grep execution"
exit 2
fi
if [ $exit_status_2 -eq 0 ]; then
echo "Failures found"
echo $failure | sed 's/ /\n/g' #split string by spaces
exit 1 #exit with error
elif [ $exit_status_2 -eq 1 ]; then
echo "No task failures found."
else
echo "WARNING: error with grep execution"
exit 2
fi
- name: Print data-catalog-final (FAILURE-GUARDED)
continue-on-error: true
run: |
set +e
# Successes
success=$(grep -E "CYLC_JOB_EXIT=SUCCEEDED" /contrib-efs/container-test/ppp-setup/cylc-run/test_pp__ptest__ttest/log/job/*/data-catalog-final/0[1-3]/job.status)
exit_status_1=$?
# Failures
failure=$(grep -E "CYLC_JOB_EXIT=ERR" /contrib-efs/container-test/ppp-setup/cylc-run/test_pp__ptest__ttest/log/job/*/data-catalog-final/0[1-3]/job.status)
exit_status_2=$?
if [ $exit_status_1 -eq 0 ]; then
echo $success | sed 's/ /\n/g' #split string by spaces
elif [ $exit_status_1 -eq 1 ]; then
echo "No succeeded tasks found"
else
echo "WARNING: error with grep execution"
exit 2
fi
if [ $exit_status_2 -eq 0 ]; then
echo "Failures found"
echo $failure | sed 's/ /\n/g' #split string by spaces
exit 1 #exit with error
elif [ $exit_status_2 -eq 1 ]; then
echo "No task failures found."
else
echo "WARNING: error with grep execution"
exit 2
fi
- name: Print mask-atmos-plevel successes or failures
run: |
set +e
# Successes
success=$(grep -E "CYLC_JOB_EXIT=SUCCEEDED" /contrib-efs/container-test/ppp-setup/cylc-run/test_pp__ptest__ttest/log/job/*/mask-atmos-plevel*/0[1-3]/job.status)
exit_status_1=$?
# Failures
failure=$(grep -E "CYLC_JOB_EXIT=ERR" /contrib-efs/container-test/ppp-setup/cylc-run/test_pp__ptest__ttest/log/job/*/mask-atmos-plevel*/0[1-3]/job.status)
exit_status_2=$?
if [ $exit_status_1 -eq 0 ]; then
echo $success | sed 's/ /\n/g' #split string by spaces
elif [ $exit_status_1 -eq 1 ]; then
echo "No succeeded tasks found"
else
echo "WARNING: error with grep execution"
exit 2
fi
if [ $exit_status_2 -eq 0 ]; then
echo "Failures found"
echo $failure | sed 's/ /\n/g' #split string by spaces
exit 1 #exit with error
elif [ $exit_status_2 -eq 1 ]; then
echo "No task failures found."
else
echo "WARNING: error with grep execution"
exit 2
fi
- name: Print remap-pp-components successes or failures
run: |
set +e
# Successes
success=$(grep -E "CYLC_JOB_EXIT=SUCCEEDED" /contrib-efs/container-test/ppp-setup/cylc-run/test_pp__ptest__ttest/log/job/*/remap-pp-components*/0[1-3]/job.status)
exit_status_1=$?
# Failures
failure=$(grep -E "CYLC_JOB_EXIT=ERR" /contrib-efs/container-test/ppp-setup/cylc-run/test_pp__ptest__ttest/log/job/*/remap-pp-components*/0[1-3]/job.status)
exit_status_2=$?
if [ $exit_status_1 -eq 0 ]; then
echo $success | sed 's/ /\n/g' #split string by spaces
elif [ $exit_status_1 -eq 1 ]; then
echo "No succeeded tasks found"
else
echo "WARNING: error with grep execution"
exit 2
fi
if [ $exit_status_2 -eq 0 ]; then
echo "Failures found"
echo $failure | sed 's/ /\n/g' #split string by spaces
exit 1 #exit with error
elif [ $exit_status_2 -eq 1 ]; then
echo "No task failures found."
else
echo "WARNING: error with grep execution"
exit 2
fi
- name: Print split-netcdf successes or failures
run: |
set +e
# Successes
success=$(grep -E "CYLC_JOB_EXIT=SUCCEEDED" /contrib-efs/container-test/ppp-setup/cylc-run/test_pp__ptest__ttest/log/job/*/split-netcdf*/0[1-3]/job.status)
exit_status_1=$?
# Failures
failure=$(grep -E "CYLC_JOB_EXIT=ERR" /contrib-efs/container-test/ppp-setup/cylc-run/test_pp__ptest__ttest/log/job/*/split-netcdf*/0[1-3]/job.status)
exit_status_2=$?
if [ $exit_status_1 -eq 0 ]; then
echo $success | sed 's/ /\n/g' #split string by spaces
elif [ $exit_status_1 -eq 1 ]; then
echo "No succeeded tasks found"
else
echo "WARNING: error with grep execution"
exit 2
fi
if [ $exit_status_2 -eq 0 ]; then
echo "Failures found"
echo $failure | sed 's/ /\n/g' #split string by spaces
exit 1 #exit with error
elif [ $exit_status_2 -eq 1 ]; then
echo "No task failures found."
else
echo "WARNING: error with grep execution"
exit 2
fi
- name: Print climotology time average successes or failures
run: |
set +e
# Successes
success=$(grep -E "CYLC_JOB_EXIT=SUCCEEDED" /contrib-efs/container-test/ppp-setup/cylc-run/test_pp__ptest__ttest/log/job/*/climo-*/0[1-3]/job.status)
exit_status_1=$?
# Failures
failure=$(grep -E "CYLC_JOB_EXIT=ERR" /contrib-efs/container-test/ppp-setup/cylc-run/test_pp__ptest__ttest/log/job/*/climo-*/0[1-3]/job.status)
exit_status_2=$?
if [ $exit_status_1 -eq 0 ]; then
echo $success | sed 's/ /\n/g' #split string by spaces
elif [ $exit_status_1 -eq 1 ]; then
echo "No succeeded tasks found"
else
echo "WARNING: error with grep execution"
exit 2
fi
if [ $exit_status_2 -eq 0 ]; then
echo "Failures found"
echo $failure | sed 's/ /\n/g' #split string by spaces
exit 1 #exit with error
elif [ $exit_status_2 -eq 1 ]; then
echo "No task failures found."
else
echo "WARNING: error with grep execution"
exit 2
fi
- name: Print combine-climo successes or failures
run: |
set +e
# Successes
success=$(grep -E "CYLC_JOB_EXIT=SUCCEEDED" /contrib-efs/container-test/ppp-setup/cylc-run/test_pp__ptest__ttest/log/job/*/combine-climo-*/0[1-3]/job.status)
exit_status_1=$?
# Failures
failure=$(grep -E "CYLC_JOB_EXIT=ERR" /contrib-efs/container-test/ppp-setup/cylc-run/test_pp__ptest__ttest/log/job/*/combine-climo*/0[1-3]/job.status)
exit_status_2=$?
if [ $exit_status_1 -eq 0 ]; then
echo $success | sed 's/ /\n/g' #split string by spaces
elif [ $exit_status_1 -eq 1 ]; then
echo "No succeeded tasks found"
else
echo "WARNING: error with grep execution"
exit 2
fi
if [ $exit_status_2 -eq 0 ]; then
echo "Failures found"
echo $failure | sed 's/ /\n/g' #split string by spaces
exit 1 #exit with error
elif [ $exit_status_2 -eq 1 ]; then
echo "No task failures found."
else
echo "WARNING: error with grep execution"
exit 2
fi
- name: Print remap-climo successes or failures
run: |
set +e
# Successes
success=$(grep -E "CYLC_JOB_EXIT=SUCCEEDED" /contrib-efs/container-test/ppp-setup/cylc-run/test_pp__ptest__ttest/log/job/*/remap-climo-*/0[1-3]/job.status)
exit_status_1=$?
# Failures
failure=$(grep -E "CYLC_JOB_EXIT=ERR" /contrib-efs/container-test/ppp-setup/cylc-run/test_pp__ptest__ttest/log/job/*/remap-climo-*/0[1-3]/job.status)
exit_status_2=$?
if [ $exit_status_1 -eq 0 ]; then
echo $success | sed 's/ /\n/g' #split string by spaces
elif [ $exit_status_1 -eq 1 ]; then
echo "No succeeded tasks found"
else
echo "WARNING: error with grep execution"
exit 2
fi
if [ $exit_status_2 -eq 0 ]; then
echo "Failures found"
echo $failure | sed 's/ /\n/g' #split string by spaces
exit 1 #exit with error
elif [ $exit_status_2 -eq 1 ]; then
echo "No task failures found."
else
echo "WARNING: error with grep execution"
exit 2
fi
- name: Print clean task successes or failures
run: |
set +e
# Successes
success=$(grep -E "CYLC_JOB_EXIT=SUCCEEDED" /contrib-efs/container-test/ppp-setup/cylc-run/test_pp__ptest__ttest/log/job/*/clean*/0[1-3]/job.status)
exit_status_1=$?
# Failures
failure=$(grep -E "CYLC_JOB_EXIT=ERR" /contrib-efs/container-test/ppp-setup/cylc-run/test_pp__ptest__ttest/log/job/*/clean*/0[1-3]/job.status)
exit_status_2=$?
if [ $exit_status_1 -eq 0 ]; then
echo $success | sed 's/ /\n/g' #split string by spaces
elif [ $exit_status_1 -eq 1 ]; then
echo "No succeeded tasks found"
else
echo "WARNING: error with grep execution"
exit 2
fi
if [ $exit_status_2 -eq 0 ]; then
echo "Failures found"
echo $failure | sed 's/ /\n/g' #split string by spaces
exit 1 #exit with error
elif [ $exit_status_2 -eq 1 ]; then
echo "No task failures found."
else
echo "WARNING: error with grep execution"
exit 2
fi
## Keep in here for now as a just in case reference ##
# - name: Print any succeeded tasks
# run: |
# # List tasks that have succeeded (and completed) in the workflow
# grep -E ":succeeded.*completed" /contrib/container-test/ppp-setup/log.out
#
## maybe, all the printinig above should be continue-on-error for informational purposes
## then, this task does the final determination if things ran right or wrong.
## githubs auto-annotations for warnings etc are good are helping one figure out where to sniff around
# - name: Print any failed tasks
# run: |
# # Search for if there is an ERR status for any task
# if grep -q "failed/ERR" /contrib/container-test/ppp-setup/log.out; then
# echo "Task failures found: CHECK THE LOG FILES UPLOADED AS ARTIFACTS"
# grep "failed/ERR" /contrib/container-test/ppp-setup/log.out
# exit 1
# fi
#
# echo "Workflow ran successfully"
##To-do:
# - figure out if container will be hosted on cloud or somehow pulled from registry
# - examine behavior of runner in draft vs not draft mode