Skip to content

Fix spot instance detection for AWS Batch cost estimation#6722

Merged
bentsherman merged 2 commits intomasterfrom
pricemodel-fix
Jan 14, 2026
Merged

Fix spot instance detection for AWS Batch cost estimation#6722
bentsherman merged 2 commits intomasterfrom
pricemodel-fix

Conversation

@robsyme
Copy link
Collaborator

@robsyme robsyme commented Jan 14, 2026

Summary

Fix incorrect priceModel detection for AWS Batch tasks where spot instances were always reported as standard, causing inflated cost estimates in Seqera Platform.

Problem

The getPrice() method in AwsBatchHelper compared the instanceLifecycle() enum directly to a string:

instance.instanceLifecycle()=='spot'  // always false

With @CompileStatic, this enum-to-string comparison always returns false, so all instances defaulted to PriceModel.standard.

Solution

Replace the string comparison with direct enum comparison:

instance.instanceLifecycle() == InstanceLifecycleType.SPOT

Test

Added AwsBatchHelperTest covering spot, scheduled, and on-demand (null) cases.

The getPrice() method compared instanceLifecycle() enum to a string,
which always returned false due to type mismatch in @CompileStatic.
This caused all spot instances to be incorrectly reported as standard,
inflating cost estimates in Seqera Platform.

Changed to proper enum comparison: instanceLifecycle() == InstanceLifecycleType.SPOT

Added unit test to prevent regression.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Rob Syme <rob.syme@gmail.com>
@netlify
Copy link

netlify bot commented Jan 14, 2026

Deploy Preview for nextflow-docs-staging ready!

Name Link
🔨 Latest commit 5ef597a
🔍 Latest deploy log https://app.netlify.com/projects/nextflow-docs-staging/deploys/6967a58f78dd6f0009f1a682
😎 Deploy Preview https://deploy-preview-6722--nextflow-docs-staging.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Member

@pditommaso pditommaso left a comment

Choose a reason for hiding this comment

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

Wow tricky!

@bentsherman
Copy link
Member

@pditommaso you think this is worth backporting?

@pditommaso
Copy link
Member

pditommaso commented Jan 14, 2026

Yes, definitively

@bentsherman bentsherman merged commit 29356f6 into master Jan 14, 2026
23 checks passed
@bentsherman bentsherman deleted the pricemodel-fix branch January 14, 2026 14:29
@robsyme
Copy link
Collaborator Author

robsyme commented Jan 14, 2026

I did not know that @CompileStatic would mess up the comparison. You learn something every day :D

Thanks team.

@bentsherman
Copy link
Member

I'm surprised as well, I would expect Groovy to catch the type mismatch. But the Groovy type checker isn't perfect, it has some small holes

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.

3 participants