Fixing code that assigns a GPU limit for a workflow.

- This GPU assignment works for cron created workflows as well.
This commit is contained in:
Aleksandr Melnikov
2020-09-25 10:38:21 -07:00
parent dca6db842c
commit e7cef240c4
2 changed files with 4 additions and 15 deletions

2
go.mod
View File

@@ -43,4 +43,4 @@ require (
k8s.io/apimachinery v0.16.7-beta.0
k8s.io/client-go v0.16.4
sigs.k8s.io/yaml v1.2.0
)
)

View File

@@ -286,20 +286,9 @@ func (c *Client) injectContainerResourceQuotas(wf *wfv1.Workflow, template *wfv1
},
}
if gpu > 0 {
//todo disable this, not working with gpu nodes
resourceLimitsRaw := map[string]interface{}{}
resourceLimitsRaw[gpuManufacturer] = gpu
var resourceListGpu corev1.ResourceList
marshal, err := yaml.Marshal(resourceLimitsRaw)
if err != nil {
return err
}
err = yaml.Unmarshal(marshal, &resourceListGpu)
if err != nil {
return err
}
resourceList.Limits = resourceListGpu
stringGpu := strconv.FormatInt(gpu, 10)
resourceList.Limits = make(map[corev1.ResourceName]resource.Quantity)
resourceList.Limits[corev1.ResourceName(gpuManufacturer)] = resource.MustParse(stringGpu)
}
if template.Container != nil {
template.Container.Resources = resourceList