mirror of
https://github.com/onepanelio/onepanel.git
synced 2025-09-26 17:51:13 +08:00
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:
2
go.mod
2
go.mod
@@ -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
|
||||
)
|
||||
)
|
@@ -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
|
||||
|
Reference in New Issue
Block a user