2929jobs :
3030 pipeline :
3131 runs-on : ubuntu-latest
32- timeout-minutes : 10
32+ timeout-minutes : 30
3333 steps :
3434 - uses : actions/checkout@v4
3535
@@ -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