Repository navigation
fix(launch): retry DescribeInstances on post-RunInstances NotFound (#78) - #81
Merged
Merged
Conversation
EC2 RunInstances and DescribeInstances are eventually consistent: a successful RunInstances followed by an immediate DescribeInstances on the new ID can return InvalidInstanceID.NotFound (HTTP 400) for a few seconds while EC2 propagates the instance. spawn treated that as fatal and exited 1 — even though the instance launched and ran — leaking it and failing the caller (nf-spawn aborts the Nextflow run). Reproduces reliably on the nested-launch path (instance → spawn launch) where there's no TUI delay to mask it. Fix: DescribeInstanceWithRetry retries InvalidInstanceID.NotFound (and the equivalent empty-result race) with capped backoff (1s,2s,4s,8s… ~30s) before giving up; a genuinely missing instance still surfaces an error, and any other error returns immediately. isInstanceNotFound classifies via smithy.APIError with a message fallback. Applied to: - GetInstancePublicIP / GetInstanceState (the --wait-for-running=false path used by nested/nf-spawn launches goes straight to GetInstancePublicIP). - WaitForRunning now absorbs the propagation window before the SDK running-waiter, which does NOT retry a NotFound 400 on its own. - The queue connect-details path (separate *ec2.Client) reuses the exported helper. Tests: isInstanceNotFound classifier (smithy + string fallback + negatives); DescribeInstanceWithRetry happy path + bounded-context exhaustion against the substrate emulator. Bump CLI version 0.37.1 → 0.37.2. Fixes #78. Refs nf-spawn#34.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #78 (blocking nf-spawn): EC2
RunInstancesandDescribeInstancesare eventually consistent. A successfulRunInstancesfollowed by an immediateDescribeInstanceson the new ID can returnInvalidInstanceID.NotFound(HTTP 400) for a few seconds while EC2 propagates the instance. spawn treated that as fatal → exited 1 even though the instance launched and ran, leaking it and failing the caller (nf-spawn aborts the Nextflow run). Reproduces reliably on the nested-launch path (instance →spawn launch) where there's no TUI delay to mask it.Fix
DescribeInstanceWithRetryretriesInvalidInstanceID.NotFound(and the equivalent empty-result race) with capped backoff (1s, 2s, 4s, 8s… ~30s); a genuinely missing instance still errors, and any other error returns immediately.isInstanceNotFoundclassifies viasmithy.APIErrorwith a message fallback.GetInstancePublicIP/GetInstanceState(the--wait-for-running=falsenested/nf-spawn path goes straight toGetInstancePublicIP),WaitForRunning(absorbs the window before the SDK running-waiter, which does not retry a NotFound 400 itself), and the queue connect-details path (reuses the exported helper).Tests
isInstanceNotFoundclassifier — smithy APIError, string fallback, negatives.DescribeInstanceWithRetry— happy path + bounded-context exhaustion against the substrate emulator.make checkgreen.Release
CLI-only fix; bumps version 0.37.1 → 0.37.2. Will tag after merge so nf-spawn can pick it up.
Fixes #78. Refs spore-host/nf-spawn#34.