-
Notifications
You must be signed in to change notification settings - Fork 5
170 lines (162 loc) · 5.53 KB
/
cml.yml
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
name: CML
on:
workflow_dispatch:
inputs:
deploy_debug_enabled:
description: "Run the deployment with tmate.io debugging enabled"
required: true
type: boolean
default: false
model_debug_enabled:
description: "Run the model with tmate.io debugging enabled"
required: true
type: boolean
default: false
end_debug_enabled:
description: "Run tmate.io debugging at the end of the workflow"
required: true
type: boolean
default: false
force_retraining:
description: "Force retraining in model execution"
required: true
type: boolean
default: false
force_postprocessing:
description: "Force postprocessing in model execution"
required: true
type: boolean
default: false
force_summarize:
description: "Force summarization in model execution"
required: true
type: boolean
default: false
force_all:
description: "Force all steps in model execution"
required: true
type: boolean
default: false
push:
branches:
- "exp*"
paths:
- "pyrovelocity/**"
- "reproducibility/figures/*.py"
- "reproducibility/figures/dvc.*"
- "reproducibility/figures/config.yaml"
# Review/set variables via gh CLI:
#
# gh secret list --repo=$(GH_REPO)
# gh secret set PERSONAL_ACCESS_TOKEN --repo="$(GH_REPO)" --body="$(GH_PAT)"
#
# see also:
# https://cml.dev/doc/self-hosted-runners?tab=GitHub#personal-access-token
# test machine: n1-standard-32+nvidia-tesla-t4*1
# large machine: n1-standard-64+nvidia-tesla-t4*4
# large machine: a2-highgpu-2g+nvidia-tesla-a100*2
env:
REPO_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
GOOGLE_APPLICATION_CREDENTIALS_DATA: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS_DATA }}
GCP_SERVICE_ACCOUNT: ${{ secrets.GCP_SERVICE_ACCOUNT }}
MLFLOW_TRACKING_PASSWORD: ${{ secrets.MLFLOW_TRACKING_PASSWORD }}
MLFLOW_TRACKING_URI: ${{ secrets.MLFLOW_TRACKING_URI }}
MLFLOW_TRACKING_USERNAME: ${{ secrets.MLFLOW_TRACKING_USERNAME }}
TF_LOG_PROVIDER: DEBUG
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: iterative/setup-cml@v1
- name: Setup tmate debug session
uses: mxschmitt/action-tmate@v3
if: ${{ inputs.deploy_debug_enabled }}
- name: Deploy cloud runner
run: |
GCP_ZONES=( "us-central1-b" "us-central1-f"
"us-central1-a" "us-central1-c"
"us-east1-b"
"us-west1-b" "us-west4-b" )
for trial in {1..3}; do
for zone in "${GCP_ZONES[@]}"; do
echo "Trial $trial in zone $zone"
cml runner launch \
--labels=cml-gpu \
--reuse-idle \
--cloud=gcp \
--cloud-type=n1-highmem-96+nvidia-tesla-t4*4 \
--cloud-gpu=tesla \
--cloud-hdd-size=500 \
--cloud-region="$zone" \
--cloud-permission-set="${GCP_SERVICE_ACCOUNT},scopes=storage-rw" \
&& break 2
done
done
pipeline:
needs: deploy
runs-on: [self-hosted, cml-gpu]
timeout-minutes: 1440
container:
image: ghcr.io/pinellolab/pyrovelocity:master
options: --gpus all
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up python
id: setup-python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
- name: Setup tmate debug session
uses: mxschmitt/action-tmate@v3
if: ${{ inputs.model_debug_enabled }}
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install -E dev -E plotting --no-interaction --no-root
- name: Install project
run: poetry install -E dev -E plotting --no-interaction
- name: CML setup
run: cml ci
- name: Setup rclone
run: |
sudo -v ; curl https://rclone.org/install.sh | sudo bash
which rclone
sudo apt-get update && sudo apt-get install tree
which tree
mkdir -p $HOME/.config/rclone/
echo '${{ secrets.RCLONE_CONF }}' > $HOME/.config/rclone/rclone.conf
- name: Run experiment and submit report
run: |
source .venv/bin/activate
FLAGS=""
if [ "${{ github.event.inputs.force_retraining }}" = "true" ]; then
FLAGS="${FLAGS} -ft"
fi
if [ "${{ github.event.inputs.force_postprocessing }}" = "true" ]; then
FLAGS="${FLAGS} -fp"
fi
if [ "${{ github.event.inputs.force_summarize }}" = "true" ]; then
FLAGS="${FLAGS} -fs"
fi
if [ "${{ github.event.inputs.force_all }}" = "true" ]; then
FLAGS="${FLAGS} -f"
fi
./.github/pipeline.sh ${FLAGS}
shell: bash
- name: Setup tmate debug session
uses: mxschmitt/action-tmate@v3
if: ${{ inputs.end_debug_enabled }}