From 7e081eb7e0fcb4c1f2315cceb7b79b7cad4a639c Mon Sep 17 00:00:00 2001 From: Helio Machado <0x2b3bfa0+git@googlemail.com> Date: Wed, 2 Feb 2022 15:34:24 +0100 Subject: [PATCH] Allow custom machine+gpu*count on runner cloud=gcp --- iterative/gcp/provider.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/iterative/gcp/provider.go b/iterative/gcp/provider.go index 7de6cb21..b7934790 100644 --- a/iterative/gcp/provider.go +++ b/iterative/gcp/provider.go @@ -441,7 +441,18 @@ func getInstanceType(instanceType string, instanceGPU string) (map[string]map[st }, } - if val, ok := instanceTypes[instanceType+"+"+instanceGPU]; ok { + match := regexp.MustCompile(`^([^+]+)\+([^*]+)\*([1-9]\d*)?$`).FindStringSubmatch(instanceType) + if match != nil { + return map[string]map[string]string{ + "accelerator": { + "count": match[3], + "type": match[2], + }, + "machine": { + "type": match[1], + }, + }, nil + } else if val, ok := instanceTypes[instanceType+"+"+instanceGPU]; ok { return val, nil } else if val, ok := instanceTypes[instanceType]; ok && instanceGPU == "" { return val, nil