fix(lib-cloudinfo): type CloudProduct.gpusPerVm as Float to keep fractional-GPU counts#98
Merged
Merged
Conversation
…tional-GPU counts CloudInfo reports fractional GPU counts for fractional-GPU instance families (e.g. AWS g6f.2xlarge reports gpusPerVm=0.25). The Integer field truncated these to 0 on JSON decode, making genuine GPU instances indistinguishable from CPU-only ones for consumers that check gpusPerVm > 0. Type gpusPerVm as Float (consistent with memPerVm/onDemandPrice) so fractional counts survive; > 0 then correctly flags any accelerator. Fixes #97 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
jordeu
reviewed
Jul 24, 2026
jordeu
approved these changes
Jul 24, 2026
…pe change - VERSION 1.2.2 -> 2.0.0 (breaking Integer->Float on published getter/setter) - changelog entry flagged BREAKING - README dependency snippet -> 2.0.0 - test: pin encode direction (whole counts serialise as 8.0) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
What this changes
Types
CloudProduct.gpusPerVmasFloatinstead ofInteger.CloudInfo reports fractional GPU counts for fractional-GPU instance families — e.g. AWS
g6f.2xlargereportsgpusPerVm=0.25(fractional NVIDIA L4). Decoding0.25into anIntegerfield truncated it to0(JacksonACCEPT_FLOAT_AS_INT), so a genuine GPU instance became indistinguishable from a CPU-only one for any consumer checkinggpusPerVm > 0. The neighbouring fractional fields (memPerVm,onDemandPrice) are alreadyFloat;gpusPerVmwas the anomaly.With
Float, fractional counts survive and> 0correctly flags any accelerator.Evidence (live CloudInfo,
amazon/compute/us-east-1)g6f.2xlarge0.25g6f.large0.125gr6f.4xlarge0.5g6.2xlarge1Tests
Added
CloudProductTestcases asserting a fractionalgpusPerVmsurvives JSON decode (0.25stays0.25,> 0), plus whole/absent values../gradlew :lib-cloudinfo:testpasses.Downstream note
This is a breaking type change for consumers that auto-unbox
getGpusPerVm()toint(notablysched), which need a matching follow-up to consumeFloatand treat> 0as GPU.AcceleratorFeatures.hasGpu(features)(token-based) is unaffected.Closes #97
Impact context
Downstream in
sched, the truncation letg6f.2xlargebe mixed into a CPU-only task's instance pool, contributing to a spot stock-out (seqeralabs/sched#789).🤖 Generated with Claude Code