Repository navigation
Merged
Conversation
This was referenced Oct 15, 2026
…gion streaming (#956) buildStageRunInstancesInput handled efa_enabled by adding the cluster placement group only, so stage instances got an ENA interface. It now attaches pkg/aws.EFANetworkInterface, the interface `spawn launch --efa` builds (extracted from client.go, behaviour unchanged there), with the pipeline's group on the interface, since RunInstances rejects instance-level SecurityGroupIds alongside NetworkInterfaces. EFA needs a group admitting all traffic from itself: the pipeline group is now created in every EFA stage's region, streaming or not, and in such a region carries an all-traffic self rule (still nothing open to an address range). `spawn pipeline launch` checks each EFA stage's type with ValidateInstanceTypeForEFAInRegion (EC2 DescribeInstanceTypes; no truffle EFA capability exists to reuse) before it creates anything. ml-training.json's p3.8xlarge has no EFA; it uses p3dn.24xlarge. Cross-region streaming cannot connect: each region has its own default VPC and pipeline group, peer discovery publishes private IPs, and nothing peers the VPCs. Building that (peering, or public ingress for the peers' addresses) is not a small change, so Validate rejects a stream-mode data_input whose source stage is in another region, with an error naming both regions and pointing at s3 mode. Stage regions are compared through Stage.EffectiveRegion (DefaultStageRegion, now shared with the orchestrator). Each guard watched failing against a compiling revert. (#956)
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.
Fixes #956
Stacked on #980 (fix/944). This PR's base is
fix/944. Merge in order: #931, #942, #957, #972, #980, then this.Cost safety. Found by reading the code, then tested with fakes. No AWS resources were created, nothing was launched and nothing was deployed. Every test run used no AWS credentials (see spawn#968).
1.
efa_enabledattaches no EFAWhat was wrong.
buildStageRunInstancesInputhandledefa_enabledby adding the cluster placement group only. The instances got an ENA interface, andfi_info -p efafound nothing. EFA also needs a security group that admits all traffic from itself. The pipeline group was created only for streaming pipelines, and opened only tcp 50000-60000 and 22.What changed.
pkg/aws.EFANetworkInterface: the primary interface, typeefa, public IP, deleted on termination.spawn launch --efabuilds. It is extracted fromclient.go, so that path is unchanged, as the issue suggested.SecurityGroupIds, because RunInstances rejects instance-level groups alongsideNetworkInterfaces. The test asserts both.spawn pipeline launchchecks every EFA stage's type with the existingValidateInstanceTypeForEFAInRegion(EC2DescribeInstanceTypesin the stage's region), before it creates anything. Otherwise a bad type would fail mid-pipeline, after earlier stages had been billed.cmd/), so this uses the EC2 API thatspawn launch --efaalready uses.ec2:DescribeInstanceTypes.ml-training.jsonusedp3.8xlarge, which has no EFA, so the check would have refused it. It now usesp3dn.24xlarge.2. Cross-region streaming: rejected at validation
Why reject, not support.
Since pipeline: streaming security group and EFA placement group are created in the Lambda's region, not the stages' region #929, each region has its own pipeline group, whose ingress references itself.
The stages run in each region's default VPC, and peer discovery publishes private IPs.
Making a cross-region stream connect would need one of:
Either is a networking feature with its own security review, not a fix. Before pipeline: streaming security group and EFA placement group are created in the Lambda's region, not the stages' region #929 such a pipeline failed at launch anyway, so rejecting it is the honest, small option.
What changed.
Pipeline.Validate, used byspawn pipeline validateandlaunch, rejects astream-modedata_inputwhosesource_stageis in another region. The error names both stages and regions and says to use"mode": "s3"or one region.Stage.EffectiveRegion(), so a stage with no region counts as us-east-1.pipeline.DefaultStageRegionis now the orchestrator'sdefaultStageRegiontoo, so the two cannot disagree.Docs.
examples/streaming/README.mddocuments the same-region requirement, the 50000-60000 port range, and whatefa_enablednow does. Its "See Also" pointed at twodocs/pages that do not exist. It now points atexamples/pipelines/README.md.Tests (each watched failing against a revert that compiles)
TestEFAStageIsLaunchedWithAnEFAInterfaceTestEFAStageIsLaunchedWithAnEFAInterfaceTestEFARegionGroupAdmitsAllTrafficFromItself,TestNonEFAGroupDoesNotAdmitAllTrafficTestEFAStageIsLaunchedWithAnEFAInterface,TestEFARegionGroupAdmitsAllTrafficFromItselfTestValidateRejectsCrossRegionStreamingRegioncompare (""vsus-east-1)TestValidateAllowsSameRegionStreamingAndCrossRegionS3TestLaunchChecksEFAStagesBeforeCreatingAnythingTestLaunchRunsTheEFACheckFirstTestEFANetworkInterfacecovers the shared helper.TestNetworkResourcesAreCreatedAndUsedInEachStagesRegionnow reads an EFA stage's groups from its interface.api/public-surface.txtwas regenerated withmake api-snapshot. It is an addition only (EFANetworkInterface), recorded under CHANGELOGAdded.make check: all pass except the known Docker-onlyTestGenerateWrapper_ChownFixesCrossUIDStickyUnlink_Docker.make check-nested: clean.go test -count=1 ./lambda/pipeline-orchestrator/ ./pkg/pipeline/ ./pkg/aws/: pass.Deploy
spawn-pipeline-orchestrator(make -C lambda/pipeline-orchestrator deploy). It needs no new IAM:ec2:RunInstanceson*covers the network interface, and the security group calls were already granted.Caveats
spawn launch --efa. Multi-card types (p4d, p5) need one EFA interface per card for full bandwidth. That is a limitation of the shared helper, not new here.fi_info -p efareports a provider also depends on the AMI having the EFA driver. Stages without anamiuse the recommended AMI, which may not include it.