scheduler: fix a bug where we subtract reserved node resources twice (#23386)

Fixes a bug in the nodeResources.Comparable method, where CPU resources were
accidentally offset with reserved resources, whereas functions that use this
field expect total CPU resources.
This commit is contained in:
Piotr Kazmierczak
2024-06-21 13:22:59 +00:00
committed by GitHub
parent c84b4ad67b
commit 8f80bd505f
3 changed files with 5 additions and 1 deletions

3
.changelog/23386.txt Normal file
View File

@@ -0,0 +1,3 @@
```release-note:bug
scheduler: Fix a bug where reserved resources are not calculated correctly
```

View File

@@ -105,6 +105,7 @@ func node2k() *Node {
Grade: numalib.Performance,
BaseSpeed: 1000,
}},
OverrideWitholdCompute: 1000, // set by client reserved field
},
},
Memory: NodeMemoryResources{

View File

@@ -3191,7 +3191,7 @@ func (n *NodeResources) Comparable() *ComparableResources {
c := &ComparableResources{
Flattened: AllocatedTaskResources{
Cpu: AllocatedCpuResources{
CpuShares: int64(n.Processors.Topology.UsableCompute()),
CpuShares: int64(n.Processors.Topology.TotalCompute()),
ReservedCores: reservableCores,
},
Memory: AllocatedMemoryResources{