Skip to content

Use modal deploy + spawn to decouple pipeline from GitHub runner#635

Merged
juaristi22 merged 2 commits intomainfrom
fix/pipeline-workflow-timeout
Mar 26, 2026
Merged

Use modal deploy + spawn to decouple pipeline from GitHub runner#635
juaristi22 merged 2 commits intomainfrom
fix/pipeline-workflow-timeout

Conversation

@baogorek
Copy link
Collaborator

@baogorek baogorek commented Mar 26, 2026

Summary

modal run --detach streams logs to the GitHub Actions runner and dies when the runner timeout fires, killing the Modal pipeline mid-run. The pipeline takes 10+ hours, well past GitHub's 6-hour max.

Fix: Deploy the app to Modal (making it persistent), then .spawn() the run_pipeline function as a fire-and-forget call. The GitHub Actions step finishes in under a minute while the pipeline runs on Modal untethered for as long as it needs (up to Modal's 24-hour function timeout).

Fixes #636

Before

modal run --detach modal_app/pipeline.py::main $ARGS
# CLI streams logs → runner timeout kills pipeline

After

modal deploy modal_app/pipeline.py
# App is now persistent on Modal

python -c "run_pipeline.spawn(branch='main', ...)"
# Fire-and-forget → step exits immediately

Test plan

  • Merge and verify the GitHub Actions step completes in ~1 minute
  • Verify the pipeline appears and runs on the Modal dashboard

🤖 Generated with Claude Code

@baogorek baogorek force-pushed the fix/pipeline-workflow-timeout branch from f8bf5e5 to 3fe6df0 Compare March 26, 2026 00:23
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>
@baogorek baogorek force-pushed the fix/pipeline-workflow-timeout branch from 3fe6df0 to 07a4e81 Compare March 26, 2026 00:35
@baogorek baogorek changed the title Bump pipeline workflow timeout from 10m to 6h Use modal deploy + spawn to decouple pipeline from GitHub runner Mar 26, 2026
@juaristi22 juaristi22 self-requested a review March 26, 2026 08:02
- local test took ~22mins to deploy, should be subsequently faster but want to have some headroom
Copy link
Collaborator

@juaristi22 juaristi22 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested the deploy + spawn approach locally and it works correctly:

  1. modal deploy modal_app/pipeline.py — app registered successfully as policyengine-us-data-pipeline
  2. run_pipeline.spawn(...) — returned immediately with a function call ID, pipeline running on Modal independently

Minor note: The deploy step took ~22 minutes locally (first-time image build). The workflow timeout-minutes is currently set to 10, which would kill the deploy before it reaches the spawn call — the same failure mode as the original issue. Should bump to 30 to handle worst-case deploy times (subsequent deploys will be faster due to Modal image caching, but first deploys or cache misses need headroom).

Copy link
Collaborator

@juaristi22 juaristi22 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix looks correct — deploy + spawn approach works as expected. Tested locally end-to-end. Just needs the timeout bump to 30 minutes.

@juaristi22 juaristi22 merged commit 243fdeb into main Mar 26, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pipeline workflow killed by GitHub Actions timeout — modal run --detach does not survive runner cancellation

2 participants