Skip to content

Make execute_sample non-preemptible - #15

Draft
kevintli wants to merge 1 commit into
devin/1790783613-miles-lora-kaiming-initfrom
devin/1790812059-execute-sample-nonpreemptible
Draft

kevintli wants to merge 1 commit into
devin/1790783613-miles-lora-kaiming-initfrom
devin/1790812059-execute-sample-nonpreemptible

Conversation

@kevintli

Copy link
Copy Markdown

Summary

execute_sample is the CPU-only relay between the frontend and the SGLang sampler pool. It holds up to 128 in-flight sample inputs per container. Because it is a regular Modal Function, it is preemptible by default, and we see it preempted often: 8 times in one day on a single frontend, per the Container terminated due to preemption log. In one sec-search-rl run, a preemption that hit mid-batch was followed by 2 sample calls that never resolved and never sent traffic to the sampler, which stalled the training batch. We haven't proven a causal link.

 @app.function(
     image=image,
     min_containers=0,
     timeout=60 * 60,
     retries=2,
+    nonpreemptible=True,
     secrets=[...],
 )
 @modal.concurrent(max_inputs=128, target_inputs=16)
 async def execute_sample(task: dict) -> dict:

Tests: pytest shows the same results as the base branch. tests/scoped/test_lifecycle.py::test_owned_children_stop_before_parent fails 4 times on the base branch as well, and the torch-dependent modules can't be collected without torch. ruff check and ruff format --check pass on the changed file.

Link to Devin session: https://modal.devinenterprise.com/sessions/f53cfabb210146de8f0338fe388d7973
Open in Devin Desktop: https://modal.devinenterprise.com/desktop/session/f53cfabb210146de8f0338fe388d7973?variant=devin
Requested by: @kevintli

@devin-ai-integration

Copy link
Copy Markdown

I'll fix CI failures and address comments from users with write access that start with 'Devin'.

  • Disable automatic comment, CI, and merge conflict monitoring

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration
devin-ai-integration Bot force-pushed the devin/1790812059-execute-sample-nonpreemptible branch from 229e428 to 5b8cf8f Compare September 30, 2026 23:52
@devin-ai-integration
devin-ai-integration Bot added this pull request to stack #13 September 30, 2026 23:53
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.

1 participant