Skip to content

Commit 2c946ea

Browse files
committed
[CI] Run nightly calibration with new model
This turn the old calibration workflow into a reusable workflow, which can be used by multiple model runs.
1 parent a95e916 commit 2c946ea

File tree

2 files changed

+49
-17
lines changed

2 files changed

+49
-17
lines changed

.github/workflows/calibrations.yaml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: "Calibrations (nightly)"
2+
3+
on:
4+
schedule:
5+
- cron: 31 2 * * *
6+
7+
jobs:
8+
name: "Calibration for model ${{ matrix.model }}"
9+
version-matrix:
10+
strategy:
11+
fail-fast: false
12+
matrix:
13+
model: [mode1, mode2]
14+
uses: ./.github/workflows/calibration_common.yaml
15+
with:
16+
model: ${{ matrix.model }}
17+
commit: ${{ github.sha }}
18+
secrets: inherit

.github/workflows/calibration.yaml .github/workflows/calibrations_common.yaml

+31-17
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,41 @@
1-
name: Calibration
1+
name: "Calibration (reusable)"
22

33
on:
4+
workflow_call:
5+
inputs:
6+
commit:
7+
description: '40-character commit hash'
8+
required: true
9+
default: ''
10+
type: string
11+
model:
12+
description: 'Model'
13+
required: true
14+
default: ''
15+
type: string
416
workflow_dispatch:
517
inputs:
618
commit:
719
description: '40-character commit hash'
820
required: true
9-
default: ""
21+
default: ''
1022
type: string
11-
schedule:
12-
- cron: 31 2 * * *
23+
model:
24+
description: 'Model'
25+
required: true
26+
default: ''
27+
type: choice
28+
options:
29+
- 'mode1'
30+
- 'mode2'
1331

1432
env:
1533
REPO_PATH: /mnt/tlo/TLOmodel
1634
OUTPUT_ROOT: /mnt/tlodev2stg/tlo-dev-fs-2/task-runner/output
1735
RUNS_NUMBER: 10
1836
PYTHON_VER: 3.11
19-
RUN_NAME: 021_long_run_all_diseases_run
20-
PROCESS_NAME: 022_long_run_all_diseases_process
37+
RUN_NAME: 021_long_run_all_diseases_${{ inputs.model }}_run
38+
PROCESS_NAME: 022_long_run_all_diseases_${{ inputs.model }}_process
2139

2240
jobs:
2341

@@ -27,7 +45,7 @@ jobs:
2745
# `actions/checkout` workflow.
2846
setup:
2947
name: Setup
30-
runs-on: [tlo-dev-vm-1]
48+
runs-on: [tlo-dev-vm-3]
3149
strategy:
3250
fail-fast: false
3351
outputs:
@@ -43,17 +61,13 @@ jobs:
4361
- name: Generate environment variables
4462
id: vars
4563
run: |
46-
if [[ ${{ github.event_name }} == 'workflow_dispatch' ]] && [[ -n "${{ inputs.commit }}" ]]; then
47-
SHA=${{ inputs.commit }}
48-
else
49-
SHA=${{ github.sha }}
50-
fi
51-
ENV="/mnt/tlo/env-${SHA}"
64+
SHA=${{ inputs.commit }}
65+
ENV="/mnt/tlo/env-${{ inputs.model }}-${SHA}"
5266
if [[ -d "${ENV}" ]]; then
5367
echo "Virtual environment directory ${ENV} already exists, leaving..."
5468
exit 1
5569
fi
56-
WORKTREE_PATH="/mnt/tlo/${SHA}"
70+
WORKTREE_PATH="/mnt/tlo/${{ inputs.model }}-${SHA}"
5771
if [[ -d "${WORKTREE_PATH}" ]]; then
5872
echo "Worktree directory ${WORKTREE_PATH} already exists, leaving..."
5973
exit 1
@@ -134,7 +148,7 @@ jobs:
134148
tasks:
135149
needs: setup
136150
name: Run task ${{ matrix.index }}
137-
runs-on: [tlo-dev-vm-1, tasks] # Use only runners dedicated to running the tasks.
151+
runs-on: [tlo-dev-vm-3, tasks, ${{ inputs.model }}] # Use only runners dedicated to running the tasks.
138152
timeout-minutes: 5760 # = 4 * 24 * 60 minutes = 4 days
139153
strategy:
140154
fail-fast: false
@@ -159,7 +173,7 @@ jobs:
159173
postprocess:
160174
name: Post processing
161175
needs: [setup, tasks]
162-
runs-on: [tlo-dev-vm-1, postprocess] # Use only the runners dedicated to postprocessing
176+
runs-on: [tlo-dev-vm-3, postprocess] # Use only the runners dedicated to postprocessing
163177
strategy:
164178
fail-fast: false
165179
steps:
@@ -190,7 +204,7 @@ jobs:
190204
# `setup` was successful, to avoid cleaning up existing worktrees and
191205
# environments used by other builds.
192206
if: ${{ always() && needs.setup.result == 'success' }}
193-
runs-on: [tlo-dev-vm-1]
207+
runs-on: [tlo-dev-vm-3]
194208
strategy:
195209
fail-fast: false
196210
steps:

0 commit comments

Comments
 (0)