Repository navigation
Closed
Description
Summary
spawn has the scaffolding to launch into an EC2 Capacity Reservation / Capacity Block for ML, but none of it is connected — the flags, the config field, and the truffle hand-off all exist, yet the value never reaches RunInstances. Launching into a reservation is currently impossible.
What exists but is dead
- Flags defined, never read:
cmd/launch.go:237--use-reservation(bool),cmd/launch.go:238--reservation-id(string), bound touseReservation/reservationID(cmd/launch.go:71-72). Those variables appear only at declaration + flag binding — never consumed. - Config field defined, never populated/used:
LaunchConfig.ReservationID(pkg/aws/client.go:127, "On-Demand Capacity Reservation ID to target"). - truffle hand-off exists but is dropped:
TruffleInput.ReservationID(pkg/input/parser.go:26, JSONreservation_id) is parsed, but the truffle-input → config copy incmd/launch.go(~2019-2029) copies only InstanceType/Region/AZ/Spot — neverReservationID. - RunInstances never sets it:
pkg/aws/client.go(~330-462) setsInstanceMarketOptionsfor Spot only (MarketType: MarketTypeSpot, line 436). It never setsCapacityReservationSpecification, and neverMarketType: capacity-block.
What launching into a reservation requires
Two distinct cases — both need wiring:
- On-Demand Capacity Reservation (ODCR) or an open Capacity Block you own: set
RunInstancesInput.CapacityReservationSpecification.CapacityReservationTarget.CapacityReservationId = <id>. - Consuming a Capacity Block for ML: Capacity Blocks additionally require
InstanceMarketOptions.MarketType = "capacity-block"(and the instance must land in the reservation's specific AZ — the reservation is AZ-pinned, so spawn must place the instance there, tying into the [FSx] --fsx-create ignores --az: filesystem always lands in subnets[0], not the pinned AZ #208 AZ-co-location work).
Proposal
- Make
--reservation-id(and a--capacity-block/ market-type signal) actually flow: flag →LaunchConfig.ReservationID(+ aCapacityBlock boolor market-type field) →RunInstances. - Copy
ReservationIDfrom truffle input in the launch path (close the dropped hand-off). - In
RunInstances: when a reservation id is set, buildCapacityReservationSpecification; when it's a Capacity Block, also setInstanceMarketOptions.MarketType = capacity-block. Pin the instance to the reservation's AZ (reuse the [FSx] --fsx-create ignores --az: filesystem always lands in subnets[0], not the pinned AZ #208 subnet-for-AZ resolution). - Guardrails: a reservation is AZ- and instance-type-specific; validate/derive the AZ from the reservation rather than letting
--azconflict. Spot + capacity-block are mutually exclusive market options — reject the combination.
Out of scope
- Purchasing a Capacity Block (the paid write op) is a separate issue (per the maintainer decision, purchase lives in spawn — filed separately). This issue is launch into an already-reserved block/reservation.
- Discovering offerings is truffle's job (filed on truffle).
Tests / docs
- Unit test that
RunInstancesInputcarriesCapacityReservationSpecification(andMarketType=capacity-blockfor CB) when set, and does not when unset (back-compat). - Test the truffle-input → config
ReservationIDcopy (currently silently dropped — mirrors the lagotto#19 "snake_case keys dropped" class of bug). - README + CHANGELOG.
Refs
#208 (FSx/instance AZ co-location — reservations are AZ-pinned, same mechanism), truffle Capacity Blocks discovery issue, spawn Capacity Block purchase issue.
Metadata
Metadata
Assignees
Labels
No labels
Activity
feat: spawn capacity-block purchase with three typed gates + dry-run (#…
chore(release): v0.62.0