Skip to content
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

Ajay tripathy fix historical #67

Merged
merged 6 commits into from
May 1, 2019
Merged

Conversation

AjayTripathy
Copy link
Contributor

@AjayTripathy AjayTripathy commented May 1, 2019

Fixes #62 -- mostly. If the node has disappeared, you would need to examine the pricing data from the emitted /metrics endpoint.

Also adds better GPU support.

for k, key := range inputKeys {
if key.GPUType() == gpuType {
if region == strings.Split(k, ",")[0] {
klog.V(3).Infof("MATCHED GPU TO NODE in region " + region)
Copy link

Choose a reason for hiding this comment

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

.Infof("...", region)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

main.go Outdated
w.Write(wrapData(data, err))
err = p.Cloud.DownloadPricingData()
if err != nil {
klog.V(1).Infof("Error redownloading data on config update")
Copy link

Choose a reason for hiding this comment

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

Please don't swallow errors -- the first thing anyone who sees this message will want to know is what was the error while redownloading ...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

provIdRx := regexp.MustCompile("(Nvidia Tesla [^ ]+) ")
for matchnum, group := range provIdRx.FindStringSubmatch(product.Description) {
if matchnum == 1 {
gpuType = strings.ToLower(strings.Join(strings.Split(group, " "), "-"))
Copy link

Choose a reason for hiding this comment

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

for your consideration, it's quite strange to use a regex, with a grouping construct, and then use some split-join magic to extract the thing one actually cares about from that string

@@ -435,6 +520,11 @@ func (gcp *gcpKey) Features() string {
} else {
usageType = "ondemand"
}

if _, ok := gcp.Labels["cloud.google.com/gke-accelerator"]; ok {
Copy link

Choose a reason for hiding this comment

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

Making this a constant would likely go a long way toward avoiding updated-in-one-place-but-not-the-other bugs

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@@ -76,6 +76,8 @@ type AWSProductAttributes struct {
UsageType string `json:"usagetype"`
OperatingSystem string `json:"operatingSystem"`
PreInstalledSw string `json:"preInstalledSw"`
InstanceFamily string `json:"instanceFamily"`
GPU string `json:gpu`
Copy link

Choose a reason for hiding this comment

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

It would be outstanding if this carried some godoc, since GPU of type string could be anything

Same thing fro its GPU string friend in the GCP version below

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@AjayTripathy AjayTripathy merged commit e2c1d5a into master May 1, 2019
@AjayTripathy AjayTripathy deleted the AjayTripathy-fix-historical branch May 1, 2019 22:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Containers that are no longer running may be missing node prices
2 participants