This is an automated email from the ASF dual-hosted git repository.
pbacsko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/yunikorn-core.git
The following commit(s) were added to refs/heads/master by this push:
new 59bcf6fe [YUNIKORN-3125] Show allocation name and resource usage in
the core when handling non-YK pods (#1030)
59bcf6fe is described below
commit 59bcf6fe405c165a80271b1fd8b778ab897eb354
Author: Peter Bacsko <[email protected]>
AuthorDate: Thu Sep 25 10:24:46 2025 +0200
[YUNIKORN-3125] Show allocation name and resource usage in the core when
handling non-YK pods (#1030)
Closes: #1030
Signed-off-by: Peter Bacsko <[email protected]>
---
pkg/scheduler/objects/allocation.go | 4 ++++
pkg/scheduler/objects/allocation_test.go | 2 ++
pkg/scheduler/partition.go | 17 ++++++++++++-----
pkg/scheduler/utilities_test.go | 1 +
4 files changed, 19 insertions(+), 5 deletions(-)
diff --git a/pkg/scheduler/objects/allocation.go
b/pkg/scheduler/objects/allocation.go
index 0ef05222..2bcd7c2b 100644
--- a/pkg/scheduler/objects/allocation.go
+++ b/pkg/scheduler/objects/allocation.go
@@ -593,3 +593,7 @@ func (a *Allocation) IsForeign() bool {
func (a *Allocation) IsPreemptable() bool {
return a.preemptable
}
+
+func (a *Allocation) GetAllocationName() string {
+ return a.tags[siCommon.DomainYuniKorn+siCommon.KeyPodName]
+}
diff --git a/pkg/scheduler/objects/allocation_test.go
b/pkg/scheduler/objects/allocation_test.go
index 6917acac..4012f26b 100644
--- a/pkg/scheduler/objects/allocation_test.go
+++ b/pkg/scheduler/objects/allocation_test.go
@@ -419,6 +419,7 @@ func TestNewAllocFromSI(t *testing.T) {
assert.NilError(t, err, "Resource creation failed")
tags := make(map[string]string)
tags[siCommon.CreationTime] = strconv.FormatInt(past, 10)
+ tags[siCommon.DomainYuniKorn+siCommon.KeyPodName] = "testpod"
allocSI := &si.Allocation{
AllocationKey: "ask-1",
NodeID: "node-1",
@@ -446,6 +447,7 @@ func TestNewAllocFromSI(t *testing.T) {
assert.Assert(t, !alloc.IsAllowPreemptSelf(), "ask should not have
allow-preempt-self set")
assert.Assert(t, alloc.IsAllowPreemptOther(), "ask should have
allow-preempt-other set")
assert.Assert(t, reflect.DeepEqual(alloc.tags, alloc.GetTagsClone()))
+ assert.Equal(t, alloc.GetAllocationName(), "testpod")
allocSI.Originator = false
allocSI.PreemptionPolicy.AllowPreemptSelf = true
diff --git a/pkg/scheduler/partition.go b/pkg/scheduler/partition.go
index 49a2fa2a..8fb88419 100644
--- a/pkg/scheduler/partition.go
+++ b/pkg/scheduler/partition.go
@@ -1330,22 +1330,27 @@ func (pc *PartitionContext)
handleForeignAllocation(allocationKey, applicationID
exists := pc.getOrStoreForeignAlloc(alloc)
if !exists {
- log.Log(log.SchedPartition).Info("handling new foreign
allocation",
+ log.Log(log.SchedPartition).Info("adding new foreign
allocation",
zap.String("partitionName", pc.Name),
zap.String("nodeID", nodeID),
- zap.String("allocationKey", allocationKey))
+ zap.String("name", alloc.GetAllocationName()),
+ zap.String("allocationKey", allocationKey),
+ zap.Stringer("allocated resource",
alloc.GetAllocatedResource()))
node.AddAllocation(alloc)
return false, true, nil
}
- log.Log(log.SchedPartition).Info("handling foreign allocation update",
+ log.Log(log.SchedPartition).Info("updating foreign allocation",
zap.String("partitionName", pc.Name),
zap.String("appID", applicationID),
- zap.String("allocationKey", allocationKey))
+ zap.String("name", alloc.GetAllocationName()),
+ zap.String("allocationKey", allocationKey),
+ zap.Stringer("new allocated resource",
alloc.GetAllocatedResource()))
prev := node.UpdateForeignAllocation(alloc)
if prev == nil {
log.Log(log.SchedPartition).Warn("BUG: previous allocation not
found during update",
- zap.String("allocationKey", allocationKey))
+ zap.String("allocationKey", allocationKey),
+ zap.String("name", alloc.GetAllocationName()))
}
return false, false, nil
@@ -1599,11 +1604,13 @@ func (pc *PartitionContext)
removeForeignAllocation(allocID string) {
node := pc.GetNode(nodeID)
if node == nil {
log.Log(log.SchedPartition).Debug("Node not found for foreign
allocation",
+ zap.String("name", alloc.GetAllocationName()),
zap.String("allocationID", allocID),
zap.String("nodeID", nodeID))
return
}
log.Log(log.SchedPartition).Info("Removing foreign allocation",
+ zap.String("name", alloc.GetAllocationName()),
zap.String("allocationID", allocID),
zap.String("nodeID", nodeID))
node.RemoveAllocation(allocID)
diff --git a/pkg/scheduler/utilities_test.go b/pkg/scheduler/utilities_test.go
index 95ec88f0..be557b11 100644
--- a/pkg/scheduler/utilities_test.go
+++ b/pkg/scheduler/utilities_test.go
@@ -631,6 +631,7 @@ func newForeignAllocation(allocKey, nodeID string,
allocated *resources.Resource
AllocationKey: allocKey,
AllocationTags: map[string]string{
siCommon.Foreign: siCommon.AllocTypeDefault,
+ siCommon.DomainYuniKorn + siCommon.KeyPodName: "pod-" +
allocKey,
},
NodeID: id,
ResourcePerAlloc: allocated.ToProto(),
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]