Skip to content

Auto-cancel jobs stuck as RUNNABLE - #547

Merged
victorlin merged 3 commits into
masterfrom
victorlin/auto-cancel
Oct 15, 2026
Merged

victorlin merged 3 commits into
masterfrom
victorlin/auto-cancel

Conversation

@victorlin

@victorlin victorlin commented Oct 9, 2026 •

Copy link
Copy Markdown
Member

This PR closes #546 by implementing solutions 2 and 3 described in the issue.

Scenario 1: User stays attached

Job gets auto-canceled when AWS Batch updates the status reason as "misconfiguration". Example output:

$ nextstrain build --aws-batch --aws-batch-queue nextstrain-job-queue-test --cpus 100 .
…
Job now RUNNABLE
Job is stuck in RUNNABLE. Reason: MISCONFIGURATION:JOB_RESOURCE_REQUIREMENT - The job resource requirement (vCPU/memory/GPU) is higher than that can be met by the CE(s) attached to the job queue.
Automatically canceling stuck job…
Job FAILED after 3.3 minutes (Canceled by Nextstrain CLI due to reason: MISCONFIGURATION:JOB_RESOURCE_REQUIREMENT - The job resource requirement (vCPU/memory/GPU) is higher than that can be met by the CE(s) attached to the job queue.)

Requested resources of 100 CPUs and/or 7400 MiB memory are likely beyond the limits of the largest instance size allowed by the job queue.

Try adjusting your requested resources or the job queue in AWS.

Scenario 2: User detaches after submitting

Job queue has jobStateTimeLimitActions configured so it auto-cancels after 10 minutes. Upon reattaching, we see the helpful message. Example:

$ nextstrain build --aws-batch --attach d0e071b3-c262-4f32-a7b8-a82d8c2eac99 --no-download .
Attaching to Nextstrain AWS Batch Job ID: d0e071b3-c262-4f32-a7b8-a82d8c2eac99
Job is FAILED
Job FAILED after 18.6 minutes (Canceled by JobStateTimeLimit action due to reason: MISCONFIGURATION:JOB_RESOURCE_REQUIREMENT)

Requested resources of 100 CPUs and/or 7400 MiB memory are likely beyond the limits of the largest instance size allowed by the job queue.

Try adjusting your requested resources or the job queue in AWS.

Checklist

@victorlin victorlin self-assigned this Oct 9, 2026
@victorlin victorlin linked an issue Oct 9, 2026 that may be closed by this pull request
This prevents jobs from being stuck as RUNNABLE indefinitely due to
misconfiguration.
@victorlin
victorlin force-pushed the victorlin/auto-cancel branch from a2b2047 to d4dfd6d Compare October 9, 2026 22:38
This is useful both in absence of and in addition to any job state
limits set on the job queue.

Stopped job handling now considers auto-canceled jobs in addition to
user-sent interrupts.
Even with auto-canceling mitigations in place, the failed status reason
can be cryptic to users. Provide more context and a hint to next steps.
@victorlin
victorlin force-pushed the victorlin/auto-cancel branch from d4dfd6d to 4729e3f Compare October 14, 2026 23:23
@victorlin

Copy link
Copy Markdown
Member Author

I'll plan to merge and release this tomorrow.

@victorlin
victorlin merged commit 483e63f into master Oct 15, 2026
51 checks passed
@victorlin
victorlin deleted the victorlin/auto-cancel branch October 15, 2026 20:19
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.

AWS Batch job stuck as RUNNABLE

1 participant