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

Port task instance types to runner #742

Merged
merged 4 commits into from
Mar 2, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
28 changes: 25 additions & 3 deletions iterative/kubernetes/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"log"
"net/http"
"os"
"regexp"
"strconv"
"time"

Expand Down Expand Up @@ -391,9 +392,13 @@ func getInstanceType(instanceType string, instanceGPU string) (map[string]map[st
"memory": {"amount": "512Gi"},
}

if val, ok := instanceTypes[instanceType+"+"+instanceGPU]; ok {
return val, nil
} else if val, ok := instanceTypes[instanceType]; ok && instanceGPU == "" {
size := instanceType

if instanceGPU != "" {
size += "+"+instanceGPU
}

if val, ok := instanceTypes[size]; ok {
return val, nil
} else if val, ok := instanceTypes[instanceType]; ok {
// Allow users to specify custom accelerator selectors.
Expand All @@ -408,6 +413,23 @@ func getInstanceType(instanceType string, instanceGPU string) (map[string]map[st
}, nil
}


if match := regexp.MustCompile(`^(\d+)-(\d+)(?:\+([^*]+)\*([1-9]\d*))?$`).FindStringSubmatch(size); match != nil {
dacbd marked this conversation as resolved.
Show resolved Hide resolved
return map[string]map[string]string{
"accelerator": {
"count": match[4],
"model": match[3],
"type": "nvidia.com/gpu",
},
"cores": {
"count": match[1],
},
"memory": {
"amount": match[2] + "M",
},
}, nil
}

return nil, fmt.Errorf("invalid instance type")
}

Expand Down