Skip to content

Commit 610c449

Browse files
authored
Allow custom machine+gpu*count on runner cloud=gcp (#380)
1 parent 952f1a9 commit 610c449

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

iterative/gcp/provider.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,18 @@ func getInstanceType(instanceType string, instanceGPU string) (map[string]map[st
441441
},
442442
}
443443

444-
if val, ok := instanceTypes[instanceType+"+"+instanceGPU]; ok {
444+
match := regexp.MustCompile(`^([^+]+)\+([^*]+)\*([1-9]\d*)?$`).FindStringSubmatch(instanceType)
445+
if match != nil {
446+
return map[string]map[string]string{
447+
"accelerator": {
448+
"count": match[3],
449+
"type": match[2],
450+
},
451+
"machine": {
452+
"type": match[1],
453+
},
454+
}, nil
455+
} else if val, ok := instanceTypes[instanceType+"+"+instanceGPU]; ok {
445456
return val, nil
446457
} else if val, ok := instanceTypes[instanceType]; ok && instanceGPU == "" {
447458
return val, nil

0 commit comments

Comments
 (0)