Skip to content

Retry a throttled CreateFleet only when its other errors are pool-scoped - #740

Open
hehe7318 wants to merge 2 commits into
aws:developfrom
hehe7318:wip/throttling-pool-level-retry
Open

hehe7318 wants to merge 2 commits into
aws:developfrom
hehe7318:wip/throttling-pool-level-retry

Conversation

@hehe7318

@hehe7318 hehe7318 commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Description of changes

When a CreateFleet response that launched nothing carries RequestLimitExceeded next to other real errors, retrying the throttling only helps if the pools EC2 did not get to try can still serve the batch. That holds when every other error is confined to one instance type and subnet pool: a capacity shortage, an unsupported type in one AZ, a full or missing subnet, an AZ that lacks the requested volume type or is temporarily unavailable. Any other error, such as an account quota or a permission problem, would fail the retry on every pool alike, so it is now reported immediately instead of waiting for the rate limit to refill while the instances already launched for the job sit idle.

The pool-scoped set reuses EC2_ICE_ERROR_CODES and adds six subnet and AZ level codes. Codes outside the set, including unknown ones, are not retried: the batch fails with that code, as it did before the throttling fix minus the invented insufficient capacity. Responses without RequestLimitExceeded are unchanged.

Reference

This is a follow-up PR of #734: Fix EC2 throttling during computenode launch is not retried and is reported as ICE when using multi InstanceTypes or SubnetIds

Tests

  • E2E test run on a 3.16.1 cluster with 2 instance types × 2 subnets, feeding synthetic CreateFleet responses through the slurm_plugin.overrides hook: throttling alone was retried and launched as before, while throttling next to an injected VcpuLimitExceeded was not retried — the nodes went DOWN with (Code:VcpuLimitExceeded), the job was requeued without an insufficient-capacity fail-over and completed on its next resume.
  • The VcpuLimitExceeded entry was injected rather than produced by EC2; that a single response can carry several real errors, with the rate limit being the last pool tried, was confirmed with the EC2 Fleet team.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

When a CreateFleet response that launched nothing carries RequestLimitExceeded next to other
real errors, retrying the throttling only helps if the pools EC2 did not get to try can still
serve the batch. That holds when every other error is confined to one instance type and subnet
pool: a capacity shortage, an unsupported type in one AZ, a full or missing subnet, an AZ that
lacks the requested volume type or is temporarily unavailable. Any other error, such as an
account quota or a permission problem, would fail the retry on every pool alike, so it is now
reported immediately instead of waiting for the rate limit to refill while the instances already
launched for the job sit idle.

The pool-scoped set reuses EC2_ICE_ERROR_CODES and adds six subnet and AZ level codes. Codes
outside the set, including unknown ones, are not retried: the batch fails with that code, as it
did before the throttling fix minus the invented insufficient capacity. Responses without
RequestLimitExceeded are unchanged.
@codecov

codecov Bot commented Sep 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.05%. Comparing base (2d57ec3) to head (68687a3).
⚠️ Report is 4 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #740      +/-   ##
===========================================
- Coverage    91.06%   91.05%   -0.01%     
===========================================
  Files           20       20              
  Lines         3213     3210       -3     
===========================================
- Hits          2926     2923       -3     
  Misses         287      287              
Flag Coverage Δ
unittests 91.05% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@gmarciani

gmarciani commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

At first I thought this fix deserves an entry in the changelog. However it seems to me it is included in the line below:
as it is a fix of #734

Fix an issue where EC2 throttling during compute node launch is not retried and is reported as insufficient capacity when using Multiple Instance Types or multiple subnets.

Just double check this is intentional

| {
"InsufficientFreeAddressesInSubnet",
"InvalidSubnetID.NotFound",
"InvalidSubnet",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've never seen this error code. Always seen something like InvalidSubnetSOMETHING.
Where did we get this error code?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I got it from EC2 public doc:
https://docs.aws.amazon.com/ec2/latest/devguide/errors-overview.html
Search InvalidSubnet in it. And you get:

InvalidSubnet:
The specified subnet ID is not valid or does not exist.

# fail the compute resource over.
# A single cause is normally left. Should there be several, throttling is retried only when every
# other cause is confined to a pool, since the throttled pools can then still serve the batch once the
# rate limit refills. Any other cause would fail the retry on every pool alike and is reported instead.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you specify an example in the comment of an error that when mixed with the throttling will not trigger a retry?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added:

# A single cause is normally left. Should there be several, throttling is retried only when every
# other cause is confined to a pool, since the throttled pools can then still serve the batch once the
# rate limit refills. Any other cause would fail the retry on every pool alike and is reported instead.
# For example:
# - [RequestLimitExceeded, InsufficientInstanceCapacity] -> retry, other pools can still serve the batch
# - [RequestLimitExceeded, VcpuLimitExceeded] -> report VcpuLimitExceeded, a retry hits the same limit

@gmarciani

Copy link
Copy Markdown
Contributor

The current change is basically fixing a missed part in #734.
If this is the case, please link that PR in the description so that we can have the full picture in future

@hehe7318

hehe7318 commented Sep 16, 2026

Copy link
Copy Markdown
Contributor Author

At first I thought this fix deserves an entry in the changelog. However it seems to me it is included in the line below: as it is a fix of #734

Fix an issue where EC2 throttling during compute node launch is not retried and is reported as insufficient capacity when using Multiple Instance Types or multiple subnets.

Just double check this is intentional

Yes, it's intentional, the new changes don't change the changelog wording.

@hehe7318

hehe7318 commented Sep 16, 2026

Copy link
Copy Markdown
Contributor Author

Linked: the Reference section of the description now points to #734.

…ome: throttling next to InsufficientInstanceCapacity is retried, throttling next to VcpuLimitExceeded is not.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants