This is an automated email from the ASF dual-hosted git repository.

chia7712 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 ffb4a169 [YUNIKORN-2405] Rename "allocationid" and "allocationUid" to 
"allocationId" (#796)
ffb4a169 is described below

commit ffb4a169f8c2391f7b6751bef4a927a61702114f
Author: Ryan Lo <[email protected]>
AuthorDate: Sat Feb 10 22:45:03 2024 +0800

    [YUNIKORN-2405] Rename "allocationid" and "allocationUid" to "allocationId" 
(#796)
    
    Closes: #796
    
    Signed-off-by: Chia-Ping Tsai <[email protected]>
---
 pkg/scheduler/objects/node.go   |  4 ++--
 pkg/scheduler/partition.go      | 18 +++++++++---------
 pkg/scheduler/partition_test.go | 28 ++++++++++++++--------------
 3 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/pkg/scheduler/objects/node.go b/pkg/scheduler/objects/node.go
index 724880f7..7c5b8b92 100644
--- a/pkg/scheduler/objects/node.go
+++ b/pkg/scheduler/objects/node.go
@@ -360,8 +360,8 @@ func (sn *Node) ReplaceAllocation(allocationID string, 
replace *Allocation, delt
        sn.availableResource.SubFrom(delta)
        if !before.FitIn(sn.allocatedResource) {
                log.Log(log.SchedNode).Warn("unexpected increase in node usage 
after placeholder replacement",
-                       zap.String("placeholder allocationid", allocationID),
-                       zap.String("allocation allocationid", 
replace.GetAllocationID()),
+                       zap.String("placeholder allocationId", allocationID),
+                       zap.String("allocation allocationId", 
replace.GetAllocationID()),
                        zap.Stringer("delta", delta))
        }
 }
diff --git a/pkg/scheduler/partition.go b/pkg/scheduler/partition.go
index 018b8288..5300faf3 100644
--- a/pkg/scheduler/partition.go
+++ b/pkg/scheduler/partition.go
@@ -867,8 +867,8 @@ func (pc *PartitionContext) tryPlaceholderAllocate() 
*objects.Allocation {
                log.Log(log.SchedPartition).Info("scheduler replace placeholder 
processed",
                        zap.String("appID", alloc.GetApplicationID()),
                        zap.String("allocationKey", alloc.GetAllocationKey()),
-                       zap.String("allocationid", alloc.GetAllocationID()),
-                       zap.String("placeholder released allocationid", 
alloc.GetFirstRelease().GetAllocationID()))
+                       zap.String("allocationId", alloc.GetAllocationID()),
+                       zap.String("placeholder released allocationId", 
alloc.GetFirstRelease().GetAllocationID()))
                // pass the release back to the RM via the cluster context
                return alloc
        }
@@ -931,7 +931,7 @@ func (pc *PartitionContext) allocate(alloc 
*objects.Allocation) *objects.Allocat
        log.Log(log.SchedPartition).Info("scheduler allocation processed",
                zap.String("appID", alloc.GetApplicationID()),
                zap.String("allocationKey", alloc.GetAllocationKey()),
-               zap.String("allocationid", alloc.GetAllocationID()),
+               zap.String("allocationId", alloc.GetAllocationID()),
                zap.Stringer("allocatedResource", alloc.GetAllocatedResource()),
                zap.Bool("placeholder", alloc.IsPlaceholder()),
                zap.String("targetNode", alloc.GetNodeID()))
@@ -1149,11 +1149,11 @@ func (pc *PartitionContext) addAllocation(alloc 
*objects.Allocation) error {
                return fmt.Errorf("partition %s is stopped cannot add new 
allocation %s", pc.Name, alloc.GetAllocationKey())
        }
 
-       // We must not generate a new allocationid for it, we directly use the 
allocationid reported by shim
-       // to track this allocation, a missing allocationid is a broken 
allocation
+       // We must not generate a new allocationId for it, we directly use the 
allocationId reported by shim
+       // to track this allocation, a missing allocationId is a broken 
allocation
        if alloc.GetAllocationID() == "" {
                metrics.GetSchedulerMetrics().IncSchedulingError()
-               return fmt.Errorf("failing to restore allocation %s for 
application %s: missing allocationid",
+               return fmt.Errorf("failing to restore allocation %s for 
application %s: missing allocationId",
                        alloc.GetAllocationKey(), alloc.GetApplicationID())
        }
 
@@ -1161,7 +1161,7 @@ func (pc *PartitionContext) addAllocation(alloc 
*objects.Allocation) error {
                zap.String("partitionName", pc.Name),
                zap.String("appID", alloc.GetApplicationID()),
                zap.String("allocKey", alloc.GetAllocationKey()),
-               zap.String("allocationid", alloc.GetAllocationID()))
+               zap.String("allocationId", alloc.GetAllocationID()))
 
        // Check if allocation violates any resource restriction, or allocate 
on a
        // non-existent application or nodes.
@@ -1202,7 +1202,7 @@ func (pc *PartitionContext) addAllocation(alloc 
*objects.Allocation) error {
                zap.String("partitionName", pc.Name),
                zap.String("appID", alloc.GetApplicationID()),
                zap.String("allocKey", alloc.GetAllocationKey()),
-               zap.String("allocationUid", alloc.GetAllocationID()),
+               zap.String("allocationId", alloc.GetAllocationID()),
                zap.Bool("placeholder", alloc.IsPlaceholder()))
        return nil
 }
@@ -1282,7 +1282,7 @@ func (pc *PartitionContext) removeAllocation(release 
*si.AllocationRelease) ([]*
        // temp store for allocations manipulated
        released := make([]*objects.Allocation, 0)
        var confirmed *objects.Allocation
-       // when allocationid is not specified, remove all allocations from the 
app
+       // when allocationId is not specified, remove all allocations from the 
app
        if allocationID == "" {
                log.Log(log.SchedPartition).Info("remove all allocations",
                        zap.String("appID", appID))
diff --git a/pkg/scheduler/partition_test.go b/pkg/scheduler/partition_test.go
index 1d605db3..ccfce2e5 100644
--- a/pkg/scheduler/partition_test.go
+++ b/pkg/scheduler/partition_test.go
@@ -262,15 +262,15 @@ func TestAddNodeWithAllocations(t *testing.T) {
        ask = newAllocationAsk("alloc-1-allocationid", appID1, appRes)
        alloc = objects.NewAllocation(nodeID1, ask)
        assert.Equal(t, alloc.GetAllocationID(), "alloc-1-allocationid-0")
-       // reset allocationid to empty
+       // reset allocationId to empty
        alloc.SetAllocationID("")
        assert.Equal(t, alloc.GetAllocationID(), "")
        allocs = []*objects.Allocation{alloc}
        err = partition.AddNode(node, allocs)
        if err == nil {
-               t.Errorf("add node to partition should have failed 
(allocationid missing)")
+               t.Errorf("add node to partition should have failed 
(allocationId missing)")
        }
-       assert.Equal(t, partition.nodes.GetNodeCount(), 0, "error returned but 
node still added to the partition (allocationid)")
+       assert.Equal(t, partition.nodes.GetNodeCount(), 0, "error returned but 
node still added to the partition (allocationId)")
        assertLimits(t, getTestUserGroup(), nil)
 
        // fix the alloc add the node will work now
@@ -346,7 +346,7 @@ func TestRemoveNodeWithAllocations(t *testing.T) {
        assert.Equal(t, 0, partition.GetTotalNodeCount(), "node list was not 
updated, node was not removed")
        assert.Equal(t, 1, len(released), "node did not release correct 
allocation")
        assert.Equal(t, 0, len(confirmed), "node did not confirm correct 
allocation")
-       assert.Equal(t, released[0].GetAllocationID(), allocAllocationID, 
"allocationid returned by release not the same as on allocation")
+       assert.Equal(t, released[0].GetAllocationID(), allocAllocationID, 
"allocationId returned by release not the same as on allocation")
        assertLimits(t, getTestUserGroup(), resources.Zero)
 
        assert.NilError(t, err, "the event should have been processed")
@@ -404,7 +404,7 @@ func TestRemoveNodeWithPlaceholders(t *testing.T) {
        assert.Equal(t, 0, partition.GetTotalNodeCount(), "node list was not 
updated, node was not removed")
        assert.Equal(t, 1, len(released), "node removal did not release correct 
allocation")
        assert.Equal(t, 0, len(confirmed), "node removal should not have 
confirmed allocation")
-       assert.Equal(t, ph.GetAllocationID(), released[0].GetAllocationID(), 
"allocationid returned by release not the same as the placeholder")
+       assert.Equal(t, ph.GetAllocationID(), released[0].GetAllocationID(), 
"allocationId returned by release not the same as the placeholder")
        assert.Equal(t, 0, partition.getPhAllocationCount(), "number of active 
placeholders")
        allocs = app.GetAllAllocations()
        assert.Equal(t, 0, len(allocs), "expected no allocations for the app")
@@ -813,13 +813,13 @@ func TestRemoveNodeWithReplacement(t *testing.T) {
        assert.Equal(t, 1, len(node2.GetAllAllocations()), "remaining node 
should have allocation")
        assert.Equal(t, 1, len(released), "node removal did not release correct 
allocation")
        assert.Equal(t, 1, len(confirmed), "node removal did not confirm 
correct allocation")
-       assert.Equal(t, ph.GetAllocationID(), released[0].GetAllocationID(), 
"allocationid returned by release not the same as the placeholder")
-       assert.Equal(t, alloc.GetAllocationID(), 
confirmed[0].GetAllocationID(), "allocationid returned by confirmed not the 
same as the real allocation")
+       assert.Equal(t, ph.GetAllocationID(), released[0].GetAllocationID(), 
"allocationId returned by release not the same as the placeholder")
+       assert.Equal(t, alloc.GetAllocationID(), 
confirmed[0].GetAllocationID(), "allocationId returned by confirmed not the 
same as the real allocation")
        assert.Assert(t, resources.IsZero(app.GetPendingResource()), "app 
should not have pending resources")
        assert.Assert(t, !app.IsCompleting(), "app should not be COMPLETING 
after confirming allocation")
        allocs = app.GetAllAllocations()
        assert.Equal(t, 1, len(allocs), "expected one allocation for the app 
(real)")
-       assert.Equal(t, alloc.GetAllocationID(), allocs[0].GetAllocationID(), 
"allocationid for the app is not the same as the real allocation")
+       assert.Equal(t, alloc.GetAllocationID(), allocs[0].GetAllocationID(), 
"allocationId for the app is not the same as the real allocation")
        assert.Equal(t, objects.Allocated, allocs[0].GetResult(), "allocation 
state should be allocated")
        assert.Equal(t, 0, allocs[0].GetReleaseCount(), "real allocation should 
have no releases linked anymore")
        assertLimits(t, getTestUserGroup(), appRes)
@@ -886,7 +886,7 @@ func TestRemoveNodeWithReal(t *testing.T) {
        assert.Assert(t, resources.Equals(app.GetPendingResource(), appRes), 
"app should have updated pending resources")
        allocs = app.GetAllAllocations()
        assert.Equal(t, 1, len(allocs), "expected one allocation for the app 
(placeholder")
-       assert.Equal(t, ph.GetAllocationID(), allocs[0].GetAllocationID(), 
"allocationid for the app is not the same as the real allocation")
+       assert.Equal(t, ph.GetAllocationID(), allocs[0].GetAllocationID(), 
"allocationId for the app is not the same as the real allocation")
        assert.Equal(t, 0, ph.GetReleaseCount(), "no inflight replacements 
linked")
        assertLimits(t, getTestUserGroup(), appRes)
 }
@@ -1174,7 +1174,7 @@ func TestRemoveAppAllocs(t *testing.T) {
        assertLimits(t, getTestUserGroup(), appRes)
 
        ask = newAllocationAsk("alloc-1", appNotRemoved, appRes)
-       allocationid := "alloc-1-0"
+       allocationId := "alloc-1-0"
        alloc = objects.NewAllocation(nodeID1, ask)
        err = partition.addAllocation(alloc)
        assert.NilError(t, err, "add allocation to partition should not have 
failed")
@@ -1202,12 +1202,12 @@ func TestRemoveAppAllocs(t *testing.T) {
        assertLimits(t, getTestUserGroup(), resources.Multiply(appRes, 2))
        // create a new release with app, existing allocation: should return 1 
alloc
        assert.Equal(t, 2, partition.GetTotalAllocationCount(), "pre-remove 
allocation list incorrect: %v", partition.allocations)
-       release.AllocationID = allocationid
+       release.AllocationID = allocationId
        allocs, _ = partition.removeAllocation(release)
        assert.Equal(t, 1, len(allocs), "removal request for existing 
allocation returned wrong allocations: %v", allocs)
        assert.Equal(t, 1, partition.GetTotalAllocationCount(), "allocation 
removal requests removed more than expected: %v", partition.allocations)
        assertLimits(t, getTestUserGroup(), resources.Multiply(appRes, 1))
-       // create a new release with app, no allocationid: should return last 
left alloc
+       // create a new release with app, no allocationId: should return last 
left alloc
        release.AllocationID = ""
        allocs, _ = partition.removeAllocation(release)
        assert.Equal(t, 1, len(allocs), "removal request for existing 
allocation returned wrong allocations: %v", allocs)
@@ -2173,7 +2173,7 @@ func setupPreemptionForRequiredNode(t *testing.T) 
(*PartitionContext, *objects.A
        assert.Equal(t, alloc.GetApplicationID(), appID1, "expected application 
app-1 to be allocated")
        assert.Equal(t, alloc.GetAllocationKey(), allocID, "expected ask 
alloc-1 to be allocated")
        assertUserGroupResourceMaxLimits(t, getTestUserGroup(), 
resources.NewResourceFromMap(map[string]resources.Quantity{"vcore": 8000}), 
getExpectedQueuesLimitsForPreemptionWithRequiredNode())
-       allocationid := alloc.GetAllocationID()
+       allocationId := alloc.GetAllocationID()
 
        // required node set on ask
        ask2 := newAllocationAsk(allocID2, appID1, res)
@@ -2210,7 +2210,7 @@ func setupPreemptionForRequiredNode(t *testing.T) 
(*PartitionContext, *objects.A
        release := &si.AllocationRelease{
                PartitionName:   partition.Name,
                ApplicationID:   appID1,
-               AllocationID:    allocationid,
+               AllocationID:    allocationId,
                TerminationType: si.TerminationType_PREEMPTED_BY_SCHEDULER,
        }
        releases, _ := partition.removeAllocation(release)


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to