Skip to content

Commit 09f4b94

Browse files
committed
Use matrices
1 parent a22b213 commit 09f4b94

1 file changed

Lines changed: 73 additions & 206 deletions

File tree

.github/workflows/swell-tier2_application_discover.yml

Lines changed: 73 additions & 206 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,40 @@ defaults:
88

99
jobs:
1010

11+
# Define the suite list once
12+
define-matrix:
13+
runs-on: nccs-discover
14+
outputs:
15+
suites: ${{ steps.set-suites.outputs.suites }}
16+
suites_space: ${{ steps.set-suites.outputs.suites_space }}
17+
steps:
18+
- name: Set suite list
19+
id: set-suites
20+
run: |
21+
SUITES='["hofx", "3dfgat_cycle", "3dfgat_atmos"]'
22+
echo "suites=$SUITES" >> $GITHUB_OUTPUT
23+
echo "suites_space=hofx 3dfgat_cycle 3dfgat_atmos" >> $GITHUB_OUTPUT
24+
25+
define-comparison-matrix:
26+
runs-on: nccs-discover
27+
outputs:
28+
comparison_suites: ${{ steps.set-suites.out
29+
comparison_suites_space: ${{ steps.set-comparison-suites.outputs.comparison_suites_space }}
30+
steps:
31+
- name: Set comparison suite list
32+
id: set-comparison-suites
33+
run: |
34+
SUITES='["3dfgat_cycle", "3dfgat_atmos"]'
35+
echo "comparison_suites=$SUITES" >> $GITHUB_OUTPUT
36+
echo "comparison_suites_space=3dfgat_cycle-comparison 3dfgat_atmos-comparison" >> $GITHUB_OUTPUT
37+
1138
# Initialization needed by all the workflows
1239
# ------------------------------------------
1340
swell-tier_2-setup:
1441

1542
runs-on: nccs-discover
1643
timeout-minutes: 30
17-
44+
needs: define-matrix
1845
steps:
1946
- name: validate-workflow
2047
run: |
@@ -99,116 +126,75 @@ jobs:
99126
# ----------------------------------------
100127
# STEP2: RUN TESTING SUITES WITH NEW BUILD
101128
# ----------------------------------------
102-
103-
# Run hofx suite
104-
swell-tier_2-hofx:
105-
129+
swell-tier_2-test:
106130
runs-on: nccs-discover
107131
timeout-minutes: 600
108-
needs: swell-tier_2-build_jedi
132+
needs: [define-matrix, swell-tier_2-setup, swell-tier_2-build_jedi]
133+
strategy:
134+
fail-fast: false
135+
max-parallel: 5
136+
matrix:
137+
suite: ${{ fromJson(needs.define-matrix.outputs.suites) }}
109138

110139
steps:
111-
112-
- name: run-swell-hofx
140+
- name: run-swell-${{ matrix.suite }}
113141
run: |
114-
CI_WORKSPACE=/discover/nobackup/gmao_ci/swell/tier2/${GITHUB_RUN_ID}
115-
SUITE_NAME=hofx
116-
CI_WORKSPACE_JOB=/discover/nobackup/gmao_ci/swell/tier2/${GITHUB_RUN_ID}/${SUITE_NAME}
117-
EXPERIMENT_ID=swell-${SUITE_NAME}-${GITHUB_RUN_ID}
142+
CI_WORKSPACE=${{ env.CI_BASE }}/${GITHUB_RUN_ID}
143+
SUITE_NAME=${{ matrix.suite }}
144+
CI_WORKSPACE_JOB=${CI_WORKSPACE}/${SUITE_NAME}
145+
EXPERIMENT_ID=swell${SUITE_NAME}-${GITHUB_RUN_ID}
118146
119147
mkdir -p $CI_WORKSPACE_JOB
148+
source ${CI_WORKSPACE}/modules
120149
121-
source /discover/nobackup/gmao_ci/swell/tier2/${GITHUB_RUN_ID}/modules
122-
123-
# Get python version
124150
PYVER=$(python3 -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')")
125151
126-
export PATH=$CI_WORKSPACE/swell/bin:$PATH
127-
export PYTHONPATH=${PYTHONPATH}:$CI_WORKSPACE/swell/lib/python$PYVER/site-packages
152+
export PATH=$CI_WORKSPACE/swell/bin:$PATH
153+
export PYTHONPATH=${PYTHONPATH}:$CI_WORKSPACE/swell/lib/python$PYVER/site-packages
128154

129-
echo "experiment_id: $EXPERIMENT_ID" > $CI_WORKSPACE_JOB/${SUITE_NAME}-override.yaml
130-
echo "experiment_root: $CI_WORKSPACE_JOB" >> $CI_WORKSPACE_JOB/${SUITE_NAME}-override.yaml
131-
132-
# Point to the active build
133-
echo "existing_jedi_source_directory: /discover/nobackup/gmao_ci/swell/tier2/${GITHUB_RUN_ID}/build_jedi/jedi_bundle/source" >> $CI_WORKSPACE_JOB/${SUITE_NAME}-override.yaml
134-
echo "existing_jedi_build_directory: /discover/nobackup/gmao_ci/swell/tier2/${GITHUB_RUN_ID}/build_jedi/jedi_bundle/build" >> $CI_WORKSPACE_JOB/${SUITE_NAME}-override.yaml
135-
136-
rm -r -f $HOME/cylc-run/${EXPERIMENT_ID}-suite
155+
cat > $CI_WORKSPACE_JOB/${SUITE_NAME}-override.yaml <<EOF
156+
experiment_id: $EXPERIMENT_ID
157+
experiment_root: $CI_WORKSPACE_JOB
158+
existing_jedi_source_directory: /discover/nobackup/gmao_ci/swell/tier2/${GITHUB_RUN_ID}/build_jedi/jedi_bundle/source"
159+
existing_jedi_build_directory: /discover/nobackup/gmao_ci/swell/tier2/${GITHUB_RUN_ID}/build_jedi/jedi_bundle/build"
160+
EOF
137161

138-
cd $CI_WORKSPACE_JOB
139-
swell create ${SUITE_NAME} -m defaults -p nccs_discover_sles15 -o $CI_WORKSPACE_JOB/${SUITE_NAME}-override.yaml
140-
swell launch $CI_WORKSPACE_JOB/${EXPERIMENT_ID}/${EXPERIMENT_ID}-suite --no-detach --log_path $CI_WORKSPACE_JOB/${EXPERIMENT_ID}
141-
142-
# Move experiment directory on failure
143-
swell-tier_2-hofx-failure:
162+
rm -rf $HOME/cylc-run/${EXPERIMENT_ID}-suite
144163

145-
runs-on: nccs-discover
146-
timeout-minutes: 30
147-
needs: swell-tier_2-hofx
148-
if: failure()
164+
cd $CI_WORKSPACE_JOB
165+
swell create ${SUITE_NAME} -m defaults -p nccs_discover_sles15 -o $CI_WORKSPACE_JOB/${SUITE_NAME}
166+
swell launch $CI_WORKSPACE_JOB/${EXPERIMENT_ID}/${EXPERIMENT_ID}-suite --no-detach --log_path $CI_WORKSPACE_JOB/${EXPERIMENT_ID}
149167

150-
steps:
151-
- name: Fail hold for hofx
168+
- name: Mark failed on failure
169+
if: failure()
152170
run: |
153-
SUITE_NAME=hofx
154-
CI_WORKSPACE_JOB=/discover/nobackup/gmao_ci/swell/tier2/${GITHUB_RUN_ID}/${SUITE_NAME}
155-
mv $CI_WORKSPACE_JOB ${CI_WORKSPACE_JOB}_FAILED
171+
CI_WORKSPACE_JOB=${{ env.CI_BASE }}/${GITHUB_RUN_ID}/${{ matrix.suite }}
172+
mv $CI_WORKSPACE_JOB ${CI_WORKSPACE_JOB}_FAILED || true
156173
157-
# Run 3dfgat_cycle suite
158-
swell-tier_2-3dfgat_cycle:
159174
160-
runs-on: nccs-discover
161-
timeout-minutes: 600
162-
needs: swell-tier_2-build_jedi
163-
164-
steps:
165-
166-
- name: run-swell-3dfgat_cycle
167-
run: |
168-
CI_WORKSPACE=/discover/nobackup/gmao_ci/swell/tier2/${GITHUB_RUN_ID}
169-
SUITE_NAME=3dfgat_cycle
170-
CI_WORKSPACE_JOB=/discover/nobackup/gmao_ci/swell/tier2/${GITHUB_RUN_ID}/${SUITE_NAME}
171-
EXPERIMENT_ID=swell-${SUITE_NAME}-${GITHUB_RUN_ID}
172-
173-
mkdir -p $CI_WORKSPACE_JOB
174-
175-
source /discover/nobackup/gmao_ci/swell/tier2/${GITHUB_RUN_ID}/modules
176-
177-
# Get python version
178-
PYVER=$(python3 -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')")
179-
180-
export PATH=$CI_WORKSPACE/swell/bin:$PATH
181-
export PYTHONPATH=${PYTHONPATH}:$CI_WORKSPACE/swell/lib/python$PYVER/site-packages
182-
183-
echo "experiment_id: $EXPERIMENT_ID" > $CI_WORKSPACE_JOB/${SUITE_NAME}-override.yaml
184-
echo "experiment_root: $CI_WORKSPACE_JOB" >> $CI_WORKSPACE_JOB/${SUITE_NAME}-override.yaml
185-
186-
# Point to the active build
187-
echo "existing_jedi_source_directory: /discover/nobackup/gmao_ci/swell/tier2/${GITHUB_RUN_ID}/build_jedi/jedi_bundle/source" >> $CI_WORKSPACE_JOB/${SUITE_NAME}-override.yaml
188-
echo "existing_jedi_build_directory: /discover/nobackup/gmao_ci/swell/tier2/${GITHUB_RUN_ID}/build_jedi/jedi_bundle/build" >> $CI_WORKSPACE_JOB/${SUITE_NAME}-override.yaml
189-
190-
rm -r -f $HOME/cylc-run/${EXPERIMENT_ID}-suite
191-
192-
cd $CI_WORKSPACE_JOB
193-
swell create ${SUITE_NAME} -m defaults -p nccs_discover_sles15 -o $CI_WORKSPACE_JOB/${SUITE_NAME}-override.yaml
194-
swell launch $CI_WORKSPACE_JOB/${EXPERIMENT_ID}/${EXPERIMENT_ID}-suite --no-detach --log_path $CI_WORKSPACE_JOB/${EXPERIMENT_ID}
195-
196-
swell-tier2-3dfgat_cycle-comparison:
175+
swell-tier2-comparison:
197176

198177
runs-on: nccs-discover
199178
timeout-minutes: 30
200-
needs: swell-tier_2-3dfgat_cycle
179+
needs: [define-comparison-matrix, swell-tier_2-setup, swell-tier_2-test]
180+
strategy:
181+
fail-fast: false
182+
max-parallel: 5
183+
matrix:
184+
suite: ${{ fromJson(needs.define-comparison-matrix.outputs.comparison_suites) }}
201185

202186
steps:
203-
- name: run-swell-3dfgat_cycle-comparison
187+
- name: run-swell-${{ matrix.suite }}-comparison
204188
run: |
205189
206190
CI_WORKSPACE=/discover/nobackup/gmao_ci/swell/tier2/${GITHUB_RUN_ID}
207191
208-
COMPARISON_SUITE=3dfgat_cycle
209-
SUITE_NAME=${COMPARISON_SUITE}-comparison
192+
SUITE_NAME=${{ matrix.suite }}-comparison
210193
211-
CONFIG_NAME=compare_fgat_marine
194+
if [ "${{ matrix.suite }}" = "3dfgat_cycle" ]; then
195+
CONFIG_NAME=compare_fgat_marine
196+
else
197+
CONFIG_NAME=compare_variational_atmosphere
212198
213199
CI_WORKSPACE_JOB=/discover/nobackup/gmao_ci/swell/tier2/${GITHUB_RUN_ID}/${SUITE_NAME}
214200
EXPERIMENT_ID=swell-${SUITE_NAME}-${GITHUB_RUN_ID}
@@ -226,7 +212,7 @@ jobs:
226212
echo "experiment_id: $EXPERIMENT_ID" > $CI_WORKSPACE_JOB/${SUITE_NAME}-override.yaml
227213
echo "experiment_root: $CI_WORKSPACE_JOB" >> $CI_WORKSPACE_JOB/${SUITE_NAME}-override.yaml
228214
229-
echo "publish_directory: ~/swell_publication_location" >> $CI_WORKSPACE_JOB/${SUITE_NAME}-override.yaml
215+
echo "publish_directory: /discover/nobackup/gmao_ci/swell_publication_location" >> $CI_WORKSPACE_JOB/${SUITE_NAME}-override.yaml
230216
231217
COMPARISON_EXP_PATH_1=/discover/nobackup/gmao_ci/swell/tier2/stable/3dfgat_cycle-comparison/swell-3dfgat_cycle-comparison-*/swell-3dfgat_cycle-comparison-*-suite/experiment.yaml
232218
@@ -243,124 +229,6 @@ jobs:
243229
swell create ${CONFIG_NAME} -m defaults -p nccs_discover_sles15 -o $CI_WORKSPACE_JOB/${SUITE_NAME}-override.yaml
244230
swell launch $CI_WORKSPACE_JOB/${EXPERIMENT_ID}/${EXPERIMENT_ID}-suite --no-detach --log_path $CI_WORKSPACE_JOB/${EXPERIMENT_ID}
245231
246-
# Move experiment directory on failure
247-
swell-tier_2-3dfgat_cycle-failure:
248-
249-
runs-on: nccs-discover
250-
timeout-minutes: 30
251-
needs: swell-tier_2-3dfgat_cycle
252-
if: failure()
253-
254-
steps:
255-
- name: Fail hold for 3dfgat_cycle
256-
run: |
257-
SUITE_NAME=3dfgat_cycle
258-
CI_WORKSPACE_JOB=/discover/nobackup/gmao_ci/swell/tier2/${GITHUB_RUN_ID}/${SUITE_NAME}
259-
mv $CI_WORKSPACE_JOB ${CI_WORKSPACE_JOB}_FAILED
260-
261-
# Run 3dfgat_atmos suite
262-
swell-tier_2-3dfgat_atmos:
263-
264-
runs-on: nccs-discover
265-
timeout-minutes: 600
266-
needs: swell-tier_2-build_jedi
267-
268-
steps:
269-
270-
- name: run-swell-3dfgat_atmos
271-
run: |
272-
CI_WORKSPACE=/discover/nobackup/gmao_ci/swell/tier2/${GITHUB_RUN_ID}
273-
SUITE_NAME=3dfgat_atmos
274-
CI_WORKSPACE_JOB=/discover/nobackup/gmao_ci/swell/tier2/${GITHUB_RUN_ID}/${SUITE_NAME}
275-
EXPERIMENT_ID=swell-${SUITE_NAME}-${GITHUB_RUN_ID}
276-
277-
mkdir -p $CI_WORKSPACE_JOB
278-
279-
source /discover/nobackup/gmao_ci/swell/tier2/${GITHUB_RUN_ID}/modules
280-
281-
# Get python version
282-
PYVER=$(python3 -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')")
283-
284-
export PATH=$CI_WORKSPACE/swell/bin:$PATH
285-
export PYTHONPATH=${PYTHONPATH}:$CI_WORKSPACE/swell/lib/python$PYVER/site-packages
286-
287-
echo "experiment_id: $EXPERIMENT_ID" > $CI_WORKSPACE_JOB/${SUITE_NAME}-override.yaml
288-
echo "experiment_root: $CI_WORKSPACE_JOB" >> $CI_WORKSPACE_JOB/${SUITE_NAME}-override.yaml
289-
290-
# Point to the active build
291-
echo "existing_jedi_source_directory: /discover/nobackup/gmao_ci/swell/tier2/${GITHUB_RUN_ID}/build_jedi/jedi_bundle/source" >> $CI_WORKSPACE_JOB/${SUITE_NAME}-override.yaml
292-
echo "existing_jedi_build_directory: /discover/nobackup/gmao_ci/swell/tier2/${GITHUB_RUN_ID}/build_jedi/jedi_bundle/build" >> $CI_WORKSPACE_JOB/${SUITE_NAME}-override.yaml
293-
294-
rm -r -f $HOME/cylc-run/${EXPERIMENT_ID}-suite
295-
296-
cd $CI_WORKSPACE_JOB
297-
swell create ${SUITE_NAME}_tier2 -m defaults -p nccs_discover_sles15 -o $CI_WORKSPACE_JOB/${SUITE_NAME}-override.yaml
298-
swell launch $CI_WORKSPACE_JOB/${EXPERIMENT_ID}/${EXPERIMENT_ID}-suite --no-detach --log_path $CI_WORKSPACE_JOB/${EXPERIMENT_ID}
299-
300-
swell-tier2-3dfgat_atmos-comparison:
301-
302-
runs-on: nccs-discover
303-
timeout-minutes: 30
304-
needs: swell-tier_2-3dfgat_atmos
305-
306-
steps:
307-
- name: run-swell-3dfgat_atmos-comparison
308-
run: |
309-
310-
CI_WORKSPACE=/discover/nobackup/gmao_ci/swell/tier2/${GITHUB_RUN_ID}
311-
312-
COMPARISON_SUITE=3dfgat_atmos
313-
SUITE_NAME=${COMPARISON_SUITE}-comparison
314-
315-
CONFIG_NAME=compare_variational_atmosphere
316-
317-
CI_WORKSPACE_JOB=/discover/nobackup/gmao_ci/swell/tier2/${GITHUB_RUN_ID}/${SUITE_NAME}
318-
EXPERIMENT_ID=swell-${SUITE_NAME}-${GITHUB_RUN_ID}
319-
320-
mkdir -p $CI_WORKSPACE_JOB
321-
322-
source /discover/nobackup/gmao_ci/swell/tier2/${GITHUB_RUN_ID}/modules
323-
324-
# Get python version
325-
PYVER=$(python3 -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')")
326-
327-
export PATH=$CI_WORKSPACE/swell/bin:$PATH
328-
export PYTHONPATH=${PYTHONPATH}:$CI_WORKSPACE/swell/lib/python$PYVER/site-packages
329-
330-
echo "experiment_id: $EXPERIMENT_ID" > $CI_WORKSPACE_JOB/${SUITE_NAME}-override.yaml
331-
echo "experiment_root: $CI_WORKSPACE_JOB" >> $CI_WORKSPACE_JOB/${SUITE_NAME}-override.yaml
332-
echo "publish_directory: ~/swell_publication_location" >> $CI_WORKSPACE_JOB/${SUITE_NAME}-override.yaml
333-
334-
COMPARISON_EXP_PATH_1=/discover/nobackup/gmao_ci/swell/tier2/stable/3dfgat_atmos-comparison/swell-3dfgat_atmos-comparison-*/swell-3dfgat_atmos-comparison-*-suite/experiment.yaml
335-
336-
EXPERIMENT_ID_2=swell-${COMPARISON_SUITE}-${GITHUB_RUN_ID}
337-
COMPARISON_EXP_PATH_2=/discover/nobackup/gmao_ci/swell/tier2/${GITHUB_RUN_ID}/${COMPARISON_SUITE}/${EXPERIMENT_ID_2}/${EXPERIMENT_ID_2}-suite/experiment.yaml
338-
339-
echo "comparison_experiment_paths:" >> $CI_WORKSPACE_JOB/${SUITE_NAME}-override.yaml
340-
echo "- $COMPARISON_EXP_PATH_1" >> $CI_WORKSPACE_JOB/${SUITE_NAME}-override.yaml
341-
echo "- $COMPARISON_EXP_PATH_2" >> $CI_WORKSPACE_JOB/${SUITE_NAME}-override.yaml
342-
343-
rm -r -f $HOME/cylc-run/${EXPERIMENT_ID}-suite
344-
345-
cd $CI_WORKSPACE_JOB
346-
swell create ${CONFIG_NAME} -m defaults -p nccs_discover_sles15 -o $CI_WORKSPACE_JOB/${SUITE_NAME}-override.yaml
347-
swell launch $CI_WORKSPACE_JOB/${EXPERIMENT_ID}/${EXPERIMENT_ID}-suite --no-detach --log_path $CI_WORKSPACE_JOB/${EXPERIMENT_ID}
348-
349-
# Move experiment directory on failure
350-
swell-tier_2-3dfgat_atmos-failure:
351-
352-
runs-on: nccs-discover
353-
timeout-minutes: 30
354-
needs: swell-tier_2-3dfgat_atmos
355-
if: failure()
356-
357-
steps:
358-
- name: Fail hold for 3dfgat_atmos
359-
run: |
360-
SUITE_NAME=3dfgat_atmos
361-
CI_WORKSPACE_JOB=/discover/nobackup/gmao_ci/swell/tier2/${GITHUB_RUN_ID}/${SUITE_NAME}
362-
mv $CI_WORKSPACE_JOB ${CI_WORKSPACE_JOB}_FAILED
363-
364232
# -------------------------------------------------------------
365233
# STEP3: PERFORM UPDATES OF STABLE NIGHTLY POINTER AND CLEAN UP
366234
# -------------------------------------------------------------
@@ -371,7 +239,7 @@ jobs:
371239

372240
runs-on: nccs-discover
373241
timeout-minutes: 30
374-
needs: [swell-tier_2-hofx, swell-tier_2-3dfgat_cycle, swell-tier_2-3dfgat_atmos, swell-tier_2-3dfgat_atmos-comparison, swell-tier_2-3dfgat_cycle-comparison]
242+
needs: [swell-tier_2-test, swell-tier_2-comparison]
375243

376244
steps:
377245
- name: Replace link to stable with link to current run and remove old directory
@@ -401,11 +269,10 @@ jobs:
401269

402270
runs-on: nccs-discover
403271
timeout-minutes: 30
404-
needs: [swell-tier_2-hofx, swell-tier_2-3dfgat_cycle, swell-tier_2-3dfgat_atmos, swell-tier2-3dfgat_cycle-comparison, swell-tier2-3dfgat_atmos-comparison]
272+
needs: [swell-tier_2-test, swell-tier_2-comparison]
405273
if: always() # Always run the clean up, even if failed or cancelled
406274

407275
steps:
408-
409276
- name: Remove the cylc logging directories
410277
run: |
411278
rm -r -f $HOME/cylc-run/swell-hofx-${GITHUB_RUN_ID}-suite

0 commit comments

Comments
 (0)