-
-
Notifications
You must be signed in to change notification settings - Fork 313
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support launching spot nodes of recent instance types #295
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -206,31 +206,30 @@ func (r *region) determineInstanceTypeInformation(cfg *Config) { | |
price.spot = make(spotPriceMap) | ||
price.ebsSurcharge = it.Pricing[r.name].EBSSurcharge | ||
|
||
// if at this point the instance price is still zero, then that | ||
// particular instance type doesn't even exist in the current | ||
// region, so we don't even need to create an empty spot pricing | ||
// data structure for it | ||
if price.onDemand > 0 { | ||
// for each instance type populate the HW spec information | ||
info = instanceTypeInformation{ | ||
instanceType: it.InstanceType, | ||
vCPU: it.VCPU, | ||
memory: it.Memory, | ||
GPU: it.GPU, | ||
pricing: price, | ||
virtualizationTypes: it.LinuxVirtualizationTypes, | ||
hasEBSOptimization: it.EBSOptimized, | ||
} | ||
if price.onDemand == 0 { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm aware it's unlikely to happen, but maybe switching to Also according to the previous method's behaviour, shouldn't this be followed by an There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should never be negative, the check is for the zero value in case we're missing the data. I'll revisit the if logic on Friday. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree with @xlr-8's question and suggestion. |
||
logger.Printf("Missing on-demand price information for %s, "+ | ||
"we won't be able to replace on-demand nodes of this instance type\n", | ||
it.InstanceType) | ||
} | ||
|
||
if it.Storage != nil { | ||
info.hasInstanceStore = true | ||
info.instanceStoreDeviceSize = it.Storage.Size | ||
info.instanceStoreDeviceCount = it.Storage.Devices | ||
info.instanceStoreIsSSD = it.Storage.SSD | ||
} | ||
debug.Println(info) | ||
r.instanceTypeInformation[it.InstanceType] = info | ||
info = instanceTypeInformation{ | ||
instanceType: it.InstanceType, | ||
vCPU: it.VCPU, | ||
memory: it.Memory, | ||
GPU: it.GPU, | ||
pricing: price, | ||
virtualizationTypes: it.LinuxVirtualizationTypes, | ||
hasEBSOptimization: it.EBSOptimized, | ||
} | ||
|
||
if it.Storage != nil { | ||
info.hasInstanceStore = true | ||
info.instanceStoreDeviceSize = it.Storage.Size | ||
info.instanceStoreDeviceCount = it.Storage.Devices | ||
info.instanceStoreIsSSD = it.Storage.SSD | ||
} | ||
debug.Println(info) | ||
r.instanceTypeInformation[it.InstanceType] = info | ||
} | ||
// this is safe to do once outside of the loop because the call will only | ||
// return entries about the available instance types, so no invalid instance | ||
|
@@ -261,18 +260,16 @@ func (r *region) requestSpotPrices() error { | |
|
||
instType, az := *priceInfo.InstanceType, *priceInfo.AvailabilityZone | ||
|
||
// failure to parse this means that the instance is not available on the | ||
// spot market | ||
price, err := strconv.ParseFloat(*priceInfo.SpotPrice, 64) | ||
if err != nil { | ||
logger.Println(r.name, "Instance type ", instType, | ||
"is not available on the spot market") | ||
"Coudln't parse spot price, may not be available on the spot market") | ||
lenucksi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
continue | ||
} | ||
|
||
if r.instanceTypeInformation[instType].pricing.spot == nil { | ||
logger.Println(r.name, "Instance data missing for", instType, "in", az, | ||
"skipping because this region is currently not supported") | ||
logger.Println(r.name, "Spot pricing data missing for", instType, "in", az, | ||
"this instance type may not available on the spot market here") | ||
continue | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why switching this one to
Printf
but leaving the other asPrintln
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had a larger local patch in which I wanted to print on the same line the reason why the comparison failed: CPU, memory, storage, etc.
I failed to do that cleanly for now, so I reverted most of that but this hunk was missed.