Repository navigation
fix(launch): single launches carry --spot-max-price and refuse --vpc without --subnet-id (#1388, #1389) - #1402
Merged
Merged
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
…without --subnet-id (#1388, #1389) buildLaunchConfig now sets SpotMaxPrice from --spot-max-price (beating a truffle-piped price), so single launches, job arrays and MPI cohorts send MaxPrice; the sweep-only copy in sweepBaseConfig is removed. --vpc without --subnet-id is refused at the top of runLaunch, before any AWS call and every dispatch (single, Windows, dry-run, job array, MPI, batch queue), with a backstop in buildLaunchConfig. It used to land in the default VPC. Fixes #1388 Fixes #1389
…pc alone still refused (#1389) GetSubnetForAZ now wraps Client.SubnetInAZ: of the subnets in the VPC and AZ, the most AvailableIpAddressCount, ties to the lowest ID (was Subnets[0]). A --vpc --az launch with no subnet resolves it in the pre-flight, prints 'using subnet <id> (<az>, <n> free IPs) in <vpc>', and launches there, so multi-card EFA with --vpc --az keeps working. --vpc without --az is refused before any AWS call, now offering --az; the batch queue resolves no subnet and still needs --subnet-id. Sweeps unchanged. CHANGELOG: #1389 moved under Changed.
scttfrdmn
force-pushed
the
fix/1388-1389-single-launch-spot-vpc
branch
from
October 28, 2026 21:57
81bcd25 to
5504065
Compare
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.
Fixes #1388
Fixes #1389
#1388:
--spot-max-priceon a single launch (Fixed)buildLaunchConfignow setsSpotMaxPricefrom--spot-max-price, after the truffle-input block, so the flag beats a piped price. Every non-sweep launch builds its config here: flags, pipe mode, and the job array and MPI cohorts, which copy that config. All of them now sendSpotOptions.MaxPrice, and--dry-runshows(max $X/hr). The sweep-only copy insweepBaseConfig(#1392) is removed because sweeps get the value from the same place. The sweep flag-table entry (viaConfig) is unchanged and still checked byTestSweepFlagRulesHoldAgainstTheCode. Detached members (#1353) take it fromconfig.SpotMaxPricethroughLaunchSettings. The batch queue already read it.task runtakes neither flag.#1389:
--vpcneeds--subnet-idor--az(Changed)GetSubnetForAZnow wraps the newClient.SubnetInAZ. It filters DescribeSubnets byvpc-idandavailability-zone(it already filtered by both). Of the subnets returned, it picks the one with the mostAvailableIpAddressCount, with ties going to the lowest subnet ID. Before, it tookSubnets[0]. If the VPC has no subnet in that AZ, the error names both the AZ and the VPC.--fsx-create, multi-card EFA and the headlesspkg/launcherFSx path all use this choice.--vpc --azwith no subnet. The pre-flight (ensureAMIAndPreflightstep 0a, so every single launch, Linux or Windows, job array, MPI and--dry-run) callsresolveVPCSubnet. That resolves the subnet, printsusing subnet <id> (<az>, <n> free IPs) in <vpc>, and setsconfig.SubnetIDbefore anything is created. RunInstances, the FSx and the EFA interfaces then use that subnet.--vpcwith no--azand no subnet is refused at the top ofrunLaunch, before any AWS call. The message ends with "or pass --az to let spawn pick a subnet in that VPC". The batch queue resolves no subnet, so it refuses even with--az, and its message leaves out the--azhint. A backstop inbuildLaunchConfigrefuses a config that has a VPC and neither a subnet nor an AZ.LaunchSettings, and a row can overrideazper member. Resolving there would mean a lookup for each (region, az) pair, threaded into each row's settings. That isn't cheap or consistent across the foreground and detached paths, so I left it alone.Gates (each watched failing against a revert that compiles)
pkg/awsTestSubnetInAZPicksMostFreeThenLowestIDruns every rotation of the subnet list, with decoys in another AZ and another VPC. The cmd testTestPreflightResolvesVPCAZToASubnet(linux and windows) uses the real client against a fake EC2.chose subnet-0ccc/subnet-0zzz, wantsubnet-0bbb), and so does the EFA test.--vpc --azresolves and launches there:TestPreflightResolvesVPCAZToASubnetfails when theresolveVPCSubnetcall is removed from the pre-flight (SubnetID "", no calls).TestResolveVPCSubnetchecks the exact printed line and that nothing is looked up when a subnet is given or there is no VPC.pkg/awsTestLaunch_MultiEFAVPCAndAZUsesTheChosenSubnetrunsClient.Launchwith a VPC, an AZ and no subnet. Both interfaces must get the chosen subnet; it fails on the first-listed revert.TestLaunch_SubnetIDReachesRunInstancescovers a plain launch.--vpcalone refused with zero calls:TestVPCWithoutSubnetIsRefusedBeforeAnyAWSCallhas seven cases: linux, windows, dry-run, job array, mpi, batch queue, and batch queue with--az.1 AWS call(s): [GetCallerIdentity]).--az:batch_queue_with_azfails.--spot-max-price:TestSingleSpotLaunchCarriesSpotMaxPricefails on revert (MaxPrice ""and"0.5000"), as doesTestSweepFlagRulesHoldAgainstTheCode/spot-max-price.Checks
From /private/tmp:
make check,make lint(0 issues) andsemgrep scan --config=auto --error .pass.api/public-surface.txtis regenerated with additions only (SubnetChoice,Client.SubnetInAZ).make cli-iam-actionsreports no change. Help text is unchanged. No AWS calls were made.