Merge pull request #635 from PolicyEngine/fix/pipeline-workflow-timeout #2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Run Pipeline | |
| on: | |
| push: | |
| branches: [main] | |
| workflow_dispatch: | |
| inputs: | |
| gpu: | |
| description: "GPU type for regional calibration" | |
| default: "T4" | |
| type: string | |
| epochs: | |
| description: "Epochs for regional calibration" | |
| default: "1000" | |
| type: string | |
| national_epochs: | |
| description: "Epochs for national calibration" | |
| default: "4000" | |
| type: string | |
| num_workers: | |
| description: "Number of parallel H5 workers" | |
| default: "8" | |
| type: string | |
| skip_national: | |
| description: "Skip national calibration/H5" | |
| default: false | |
| type: boolean | |
| jobs: | |
| pipeline: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.13" | |
| - name: Install Modal | |
| run: pip install modal | |
| - name: Deploy and launch pipeline on Modal | |
| env: | |
| MODAL_TOKEN_ID: ${{ secrets.MODAL_TOKEN_ID }} | |
| MODAL_TOKEN_SECRET: ${{ secrets.MODAL_TOKEN_SECRET }} | |
| run: | | |
| modal deploy modal_app/pipeline.py | |
| GPU="${{ inputs.gpu || 'T4' }}" | |
| EPOCHS="${{ inputs.epochs || '1000' }}" | |
| NATIONAL_EPOCHS="${{ inputs.national_epochs || '4000' }}" | |
| NUM_WORKERS="${{ inputs.num_workers || '8' }}" | |
| SKIP_NATIONAL="${{ inputs.skip_national || 'false' }}" | |
| python -c " | |
| import modal | |
| run_pipeline = modal.Function.from_name('policyengine-us-data-pipeline', 'run_pipeline') | |
| fc = run_pipeline.spawn( | |
| branch='main', | |
| gpu='${GPU}', | |
| epochs=int('${EPOCHS}'), | |
| national_epochs=int('${NATIONAL_EPOCHS}'), | |
| num_workers=int('${NUM_WORKERS}'), | |
| skip_national='${SKIP_NATIONAL}' == 'true', | |
| ) | |
| print(f'Pipeline spawned. Monitor on the Modal dashboard.') | |
| " |