Skip to content

Commit 07a4e81

Browse files
baogorekclaude
andcommitted
Use modal deploy + spawn to decouple pipeline from GitHub runner
modal run --detach streams logs and dies when the runner timeout fires, killing the pipeline. Instead, deploy the app to Modal (making it persistent) and spawn run_pipeline as a fire-and-forget call. The GitHub Actions step finishes in under a minute while the pipeline runs for 10+ hours on Modal untethered. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 4991b1e commit 07a4e81

1 file changed

Lines changed: 22 additions & 12 deletions

File tree

.github/workflows/pipeline.yaml

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,19 +40,29 @@ jobs:
4040
- name: Install Modal
4141
run: pip install modal
4242

43-
- name: Launch pipeline on Modal
43+
- name: Deploy and launch pipeline on Modal
4444
env:
4545
MODAL_TOKEN_ID: ${{ secrets.MODAL_TOKEN_ID }}
4646
MODAL_TOKEN_SECRET: ${{ secrets.MODAL_TOKEN_SECRET }}
4747
run: |
48-
ARGS="--action run --branch main"
49-
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
50-
ARGS="$ARGS --gpu ${{ inputs.gpu }}"
51-
ARGS="$ARGS --epochs ${{ inputs.epochs }}"
52-
ARGS="$ARGS --national-epochs ${{ inputs.national_epochs }}"
53-
ARGS="$ARGS --num-workers ${{ inputs.num_workers }}"
54-
if [ "${{ inputs.skip_national }}" = "true" ]; then
55-
ARGS="$ARGS --skip-national"
56-
fi
57-
fi
58-
modal run --detach modal_app/pipeline.py::main $ARGS
48+
modal deploy modal_app/pipeline.py
49+
50+
GPU="${{ inputs.gpu || 'T4' }}"
51+
EPOCHS="${{ inputs.epochs || '1000' }}"
52+
NATIONAL_EPOCHS="${{ inputs.national_epochs || '4000' }}"
53+
NUM_WORKERS="${{ inputs.num_workers || '8' }}"
54+
SKIP_NATIONAL="${{ inputs.skip_national || 'false' }}"
55+
56+
python -c "
57+
import modal
58+
run_pipeline = modal.Function.from_name('policyengine-us-data-pipeline', 'run_pipeline')
59+
fc = run_pipeline.spawn(
60+
branch='main',
61+
gpu='${GPU}',
62+
epochs=int('${EPOCHS}'),
63+
national_epochs=int('${NATIONAL_EPOCHS}'),
64+
num_workers=int('${NUM_WORKERS}'),
65+
skip_national='${SKIP_NATIONAL}' == 'true',
66+
)
67+
print(f'Pipeline spawned. Monitor on the Modal dashboard.')
68+
"

0 commit comments

Comments
 (0)