This is an automated email from the ASF dual-hosted git repository.
mani 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 3ae625bc [YUNIKORN-2211] Replace Allocation uuid with allocationID
(#746)
3ae625bc is described below
commit 3ae625bcfc0772d5d029415a44266a48de5ec4f0
Author: Manikandan R <[email protected]>
AuthorDate: Sun Dec 3 19:40:34 2023 +0530
[YUNIKORN-2211] Replace Allocation uuid with allocationID (#746)
Closes: #746
Signed-off-by: Manikandan R <[email protected]>
---
go.mod | 2 +-
go.sum | 4 +-
pkg/examples/simple_example.go | 4 +-
pkg/scheduler/context.go | 4 +-
pkg/scheduler/health_checker.go | 2 +-
pkg/scheduler/objects/allocation.go | 11 +--
pkg/scheduler/objects/allocation_test.go | 14 +--
pkg/scheduler/objects/application.go | 26 +++---
pkg/scheduler/objects/application_events.go | 4 +-
pkg/scheduler/objects/application_events_test.go | 24 ++---
pkg/scheduler/objects/application_test.go | 58 ++++++-------
pkg/scheduler/objects/node.go | 26 +++---
pkg/scheduler/objects/node_test.go | 4 +-
pkg/scheduler/objects/queue_test.go | 2 +-
pkg/scheduler/objects/utilities_test.go | 14 +--
pkg/scheduler/partition.go | 74 ++++++++--------
pkg/scheduler/partition_test.go | 106 +++++++++++------------
pkg/scheduler/tests/application_tracking_test.go | 6 +-
pkg/scheduler/tests/mock_rm_callback_test.go | 4 +-
pkg/scheduler/tests/mockscheduler_test.go | 4 +-
pkg/scheduler/tests/recovery_test.go | 6 +-
pkg/scheduler/tests/reservation_test.go | 2 +-
pkg/scheduler/tests/smoke_test.go | 10 +--
pkg/webservice/dao/allocation_info.go | 3 +-
pkg/webservice/handlers.go | 3 +-
pkg/webservice/handlers_test.go | 2 +
26 files changed, 209 insertions(+), 210 deletions(-)
diff --git a/go.mod b/go.mod
index 7da143fa..824ce23e 100644
--- a/go.mod
+++ b/go.mod
@@ -22,7 +22,7 @@ module github.com/apache/yunikorn-core
go 1.20
require (
- github.com/apache/yunikorn-scheduler-interface
v0.0.0-20231020041412-6f80d179257c
+ github.com/apache/yunikorn-scheduler-interface
v0.0.0-20231201001639-c81397b31653
github.com/google/btree v1.1.2
github.com/google/go-cmp v0.5.9
github.com/google/uuid v1.3.0
diff --git a/go.sum b/go.sum
index e2f32a27..d9de3a73 100644
--- a/go.sum
+++ b/go.sum
@@ -40,8 +40,8 @@ github.com/alecthomas/template
v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuy
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod
h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod
h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod
h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho=
-github.com/apache/yunikorn-scheduler-interface
v0.0.0-20231020041412-6f80d179257c
h1:KTIC3f+3aQdAo42YRxs27VpDWY6y73bxXpWcAii2IlQ=
-github.com/apache/yunikorn-scheduler-interface
v0.0.0-20231020041412-6f80d179257c/go.mod
h1:3NQfrhroMqU++kDTroBrTyCRKAczwwX//Fkj/ag/rsY=
+github.com/apache/yunikorn-scheduler-interface
v0.0.0-20231201001639-c81397b31653
h1:pUbVmmR+LWuy0L8dGCZNue9UNpWKsY7yFYcCtPtWAic=
+github.com/apache/yunikorn-scheduler-interface
v0.0.0-20231201001639-c81397b31653/go.mod
h1:zDWV5y9Zh9DM1C65RCVXT1nhNNO8kykVW7bzPFamNYw=
github.com/benbjohnson/clock v1.1.0
h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8=
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod
h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
github.com/beorn7/perks v1.0.0/go.mod
h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
diff --git a/pkg/examples/simple_example.go b/pkg/examples/simple_example.go
index 0152034b..dd8db616 100644
--- a/pkg/examples/simple_example.go
+++ b/pkg/examples/simple_example.go
@@ -42,7 +42,7 @@ func (m *exampleRMCallback) UpdateAllocation(response
*si.AllocationResponse) er
m.Lock()
defer m.Unlock()
for _, alloc := range response.New {
- m.Allocations[alloc.UUID] = alloc
+ m.Allocations[alloc.AllocationID] = alloc
if val, ok := m.nodeAllocations[alloc.NodeID]; ok {
val = append(val, alloc)
m.nodeAllocations[alloc.NodeID] = val
@@ -54,7 +54,7 @@ func (m *exampleRMCallback) UpdateAllocation(response
*si.AllocationResponse) er
}
for _, alloc := range response.Released {
- delete(m.Allocations, alloc.UUID)
+ delete(m.Allocations, alloc.AllocationID)
}
return nil
}
diff --git a/pkg/scheduler/context.go b/pkg/scheduler/context.go
index 853f0103..54df9f88 100644
--- a/pkg/scheduler/context.go
+++ b/pkg/scheduler/context.go
@@ -144,7 +144,7 @@ func (cc *ClusterContext) schedule() bool {
metrics.GetSchedulerMetrics().ObserveSchedulingLatency(schedulingStart)
if alloc.GetResult() == objects.Replaced {
// communicate the removal to the RM
- cc.notifyRMAllocationReleased(psc.RmID,
alloc.GetReleasesClone(), si.TerminationType_PLACEHOLDER_REPLACED, "replacing
uuid: "+alloc.GetUUID())
+ cc.notifyRMAllocationReleased(psc.RmID,
alloc.GetReleasesClone(), si.TerminationType_PLACEHOLDER_REPLACED, "replacing
allocationID: "+alloc.GetAllocationID())
} else {
cc.notifyRMNewAllocation(psc.RmID, alloc)
}
@@ -921,7 +921,7 @@ func (cc *ClusterContext) notifyRMAllocationReleased(rmID
string, released []*ob
releaseEvent.ReleasedAllocations =
append(releaseEvent.ReleasedAllocations, &si.AllocationRelease{
ApplicationID: alloc.GetApplicationID(),
PartitionName: alloc.GetPartitionName(),
- UUID: alloc.GetUUID(),
+ AllocationID: alloc.GetAllocationID(),
TerminationType: terminationType,
Message: message,
AllocationKey: alloc.GetAllocationKey(),
diff --git a/pkg/scheduler/health_checker.go b/pkg/scheduler/health_checker.go
index 92a758ce..c7657738 100644
--- a/pkg/scheduler/health_checker.go
+++ b/pkg/scheduler/health_checker.go
@@ -335,7 +335,7 @@ func checkAppAllocations(app *objects.Application, nodes
objects.NodeCollection)
orphanAllocationsOnApp := make([]*objects.Allocation, 0)
for _, alloc := range app.GetAllAllocations() {
if node := nodes.GetNode(alloc.GetNodeID()); node != nil {
- if node.GetAllocation(alloc.GetUUID()) == nil {
+ if node.GetAllocation(alloc.GetAllocationID()) == nil {
orphanAllocationsOnApp =
append(orphanAllocationsOnApp, alloc)
}
} else {
diff --git a/pkg/scheduler/objects/allocation.go
b/pkg/scheduler/objects/allocation.go
index 6d9eeb04..9a3422c4 100644
--- a/pkg/scheduler/objects/allocation.go
+++ b/pkg/scheduler/objects/allocation.go
@@ -155,7 +155,7 @@ func NewAllocationFromSI(alloc *si.Allocation) *Allocation {
allocLog: make(map[string]*AllocationLogEntry),
}
newAlloc := NewAllocation(alloc.NodeID, ask)
- newAlloc.allocationID = alloc.UUID
+ newAlloc.allocationID = alloc.AllocationID
return newAlloc
}
@@ -171,7 +171,7 @@ func (a *Allocation) NewSIFromAllocation() *si.Allocation {
NodeID: a.GetNodeID(),
ApplicationID: a.GetApplicationID(),
AllocationKey: a.GetAllocationKey(),
- UUID: a.GetUUID(),
+ AllocationID: a.GetAllocationID(),
ResourcePerAlloc: a.GetAllocatedResource().ToProto(), // needed
in tests for restore
TaskGroupName: a.GetTaskGroup(),
Placeholder: a.IsPlaceholder(),
@@ -188,7 +188,7 @@ func (a *Allocation) String() string {
if a.result == Reserved || a.result == Unreserved {
allocationID = "N/A"
}
- return fmt.Sprintf("applicationID=%s, uuid=%s, allocationKey=%s,
Node=%s, result=%s", a.applicationID, allocationID, a.allocationKey, a.nodeID,
a.result.String())
+ return fmt.Sprintf("applicationID=%s, allocationID=%s,
allocationKey=%s, Node=%s, result=%s", a.applicationID, allocationID,
a.allocationKey, a.nodeID, a.result.String())
}
// GetAsk returns the ask associated with this allocation
@@ -299,11 +299,6 @@ func (a *Allocation) GetAllocationID() string {
return a.allocationID
}
-// GetUUID returns the allocationID for this allocation
-func (a *Allocation) GetUUID() string {
- return a.allocationID
-}
-
// SetAllocationID set the allocationID for this allocation
// only for tests
func (a *Allocation) SetAllocationID(allocationID string) {
diff --git a/pkg/scheduler/objects/allocation_test.go
b/pkg/scheduler/objects/allocation_test.go
index ba16d402..be218109 100644
--- a/pkg/scheduler/objects/allocation_test.go
+++ b/pkg/scheduler/objects/allocation_test.go
@@ -63,7 +63,7 @@ func TestNewAlloc(t *testing.T) {
alloc.SetInstanceType(instType1)
assert.Equal(t, alloc.GetInstanceType(), instType1, "Instance type not
set as expected")
allocStr := alloc.String()
- expected := "applicationID=app-1, uuid=ask-1-0, allocationKey=ask-1,
Node=node-1, result=Allocated"
+ expected := "applicationID=app-1, allocationID=ask-1-0,
allocationKey=ask-1, Node=node-1, result=Allocated"
assert.Equal(t, allocStr, expected, "Strings should have been equal")
assert.Assert(t, !alloc.IsPlaceholderUsed(), fmt.Sprintf("Alloc should
not be placeholder replacement by default: got %t, expected %t",
alloc.IsPlaceholderUsed(), false))
created := alloc.GetCreateTime()
@@ -91,10 +91,10 @@ func TestNewReservedAlloc(t *testing.T) {
t.Fatal("NewReservedAllocation create failed while it should
not")
}
assert.Equal(t, alloc.GetResult(), Reserved, "NewReservedAlloc should
have Reserved result")
- assert.Equal(t, alloc.GetUUID(), "", "NewReservedAlloc should not have
uuid")
+ assert.Equal(t, alloc.GetAllocationID(), "", "NewReservedAlloc should
not have allocationID")
assert.Assert(t, resources.Equals(alloc.GetAllocatedResource(), res),
"Allocated resource not set correctly")
allocStr := alloc.String()
- expected := "applicationID=app-1, uuid=N/A, allocationKey=ask-1,
Node=node-1, result=Reserved"
+ expected := "applicationID=app-1, allocationID=N/A,
allocationKey=ask-1, Node=node-1, result=Reserved"
assert.Equal(t, allocStr, expected, "Strings should have been equal")
}
@@ -107,10 +107,10 @@ func TestNewUnreservedAlloc(t *testing.T) {
t.Fatal("NewReservedAllocation create failed while it should
not")
}
assert.Equal(t, alloc.GetResult(), Unreserved, "NewReservedAlloc should
have Reserved result")
- assert.Equal(t, alloc.GetUUID(), "", "NewReservedAlloc should not have
uuid")
+ assert.Equal(t, alloc.GetAllocationID(), "", "NewReservedAlloc should
not have allocationID")
assert.Assert(t, resources.Equals(alloc.GetAllocatedResource(), res),
"Allocated resource not set correctly")
allocStr := alloc.String()
- expected := "applicationID=app-1, uuid=N/A, allocationKey=ask-1,
Node=node-1, result=Unreserved"
+ expected := "applicationID=app-1, allocationID=N/A,
allocationKey=ask-1, Node=node-1, result=Unreserved"
assert.Equal(t, allocStr, expected, "Strings should have been equal")
}
@@ -132,7 +132,7 @@ func TestSIFromAlloc(t *testing.T) {
assert.NilError(t, err, "Resource creation failed")
expectedSI := &si.Allocation{
AllocationKey: "ask-1",
- UUID: "ask-1-0",
+ AllocationID: "ask-1-0",
NodeID: "node-1",
ApplicationID: "app-1",
ResourcePerAlloc: res.ToProto(),
@@ -164,7 +164,7 @@ func TestNewAllocFromSI(t *testing.T) {
tags[siCommon.CreationTime] = strconv.FormatInt(past, 10)
allocSI := &si.Allocation{
AllocationKey: "ask-1",
- UUID: "test-uuid",
+ AllocationID: "test-allocationid",
NodeID: "node-1",
ApplicationID: "app-1",
ResourcePerAlloc: res.ToProto(),
diff --git a/pkg/scheduler/objects/application.go
b/pkg/scheduler/objects/application.go
index bb4b4f2e..80c27d1e 100644
--- a/pkg/scheduler/objects/application.go
+++ b/pkg/scheduler/objects/application.go
@@ -1114,7 +1114,7 @@ func (sa *Application)
tryPlaceholderAllocate(nodeIterator func() NodeIterator,
if delta.HasNegativeValue() {
log.Log(log.SchedApplication).Warn("releasing
placeholder: real allocation is larger than placeholder",
zap.Stringer("requested resource",
request.GetAllocatedResource()),
- zap.String("placeholderID",
ph.GetUUID()),
+ zap.String("placeholderID",
ph.GetAllocationID()),
zap.Stringer("placeholder resource",
ph.GetAllocatedResource()))
// release the placeholder and tell the RM
ph.SetReleased(true)
@@ -1476,7 +1476,7 @@ func (sa *Application) tryNode(node *Node, ask
*AllocationAsk) *Allocation {
log.Log(log.SchedApplication).Warn("queue update failed
unexpectedly",
zap.Error(err))
// revert the node update
- node.RemoveAllocation(alloc.GetUUID())
+ node.RemoveAllocation(alloc.GetAllocationID())
return nil
}
// mark this ask as allocated by lowering the repeat
@@ -1639,7 +1639,7 @@ func (sa *Application) addAllocationInternal(info
*Allocation) {
sa.maxAllocatedResource =
resources.ComponentWiseMax(sa.allocatedResource, sa.maxAllocatedResource)
}
sa.appEvents.sendNewAllocationEvent(info)
- sa.allocations[info.GetUUID()] = info
+ sa.allocations[info.GetAllocationID()] = info
}
// Increase user resource usage
@@ -1687,11 +1687,11 @@ func (sa *Application) updatePreemptedResource(info
*Allocation) {
info.GetAllocatedResource(), info.GetBindTime())
}
-func (sa *Application) ReplaceAllocation(uuid string) *Allocation {
+func (sa *Application) ReplaceAllocation(allocationID string) *Allocation {
sa.Lock()
defer sa.Unlock()
// remove the placeholder that was just confirmed by the shim
- ph := sa.removeAllocationInternal(uuid,
si.TerminationType_PLACEHOLDER_REPLACED)
+ ph := sa.removeAllocationInternal(allocationID,
si.TerminationType_PLACEHOLDER_REPLACED)
// this has already been replaced or it is a duplicate message from the
shim
if ph == nil || ph.GetReleaseCount() == 0 {
log.Log(log.SchedApplication).Debug("Unexpected placeholder
released",
@@ -1703,7 +1703,7 @@ func (sa *Application) ReplaceAllocation(uuid string)
*Allocation {
if ph.GetReleaseCount() > 1 {
log.Log(log.SchedApplication).Error("Unexpected release number,
placeholder released, only 1 real allocations processed",
zap.String("applicationID", sa.ApplicationID),
- zap.String("placeholderID", uuid),
+ zap.String("placeholderID", allocationID),
zap.Int("releases", ph.GetReleaseCount()))
}
// update the replacing allocation
@@ -1727,16 +1727,16 @@ func (sa *Application) ReplaceAllocation(uuid string)
*Allocation {
// Remove the Allocation from the application.
// Return the allocation that was removed or nil if not found.
-func (sa *Application) RemoveAllocation(uuid string, releaseType
si.TerminationType) *Allocation {
+func (sa *Application) RemoveAllocation(allocationID string, releaseType
si.TerminationType) *Allocation {
sa.Lock()
defer sa.Unlock()
- return sa.removeAllocationInternal(uuid, releaseType)
+ return sa.removeAllocationInternal(allocationID, releaseType)
}
// Remove the Allocation from the application
// No locking must be called while holding the lock
-func (sa *Application) removeAllocationInternal(uuid string, releaseType
si.TerminationType) *Allocation {
- alloc := sa.allocations[uuid]
+func (sa *Application) removeAllocationInternal(allocationID string,
releaseType si.TerminationType) *Allocation {
+ alloc := sa.allocations[allocationID]
// When app has the allocation, update map, and update allocated
resource of the app
if alloc == nil {
@@ -1801,7 +1801,7 @@ func (sa *Application) removeAllocationInternal(uuid
string, releaseType si.Term
zap.Error(err))
}
}
- delete(sa.allocations, uuid)
+ delete(sa.allocations, allocationID)
sa.appEvents.sendRemoveAllocationEvent(alloc, releaseType)
return alloc
}
@@ -1931,7 +1931,7 @@ func (sa *Application) notifyRMAllocationReleased(rmID
string, released []*Alloc
ApplicationID: alloc.GetApplicationID(),
PartitionName: alloc.GetPartitionName(),
AllocationKey: alloc.GetAllocationKey(),
- UUID: alloc.GetUUID(),
+ AllocationID: alloc.GetAllocationID(),
TerminationType: terminationType,
Message: message,
})
@@ -1973,7 +1973,7 @@ func (sa *Application) notifyRMAllocationAskReleased(rmID
string, released []*Al
func (sa *Application) IsAllocationAssignedToApp(alloc *Allocation) bool {
sa.RLock()
defer sa.RUnlock()
- _, ok := sa.allocations[alloc.GetUUID()]
+ _, ok := sa.allocations[alloc.GetAllocationID()]
return ok
}
diff --git a/pkg/scheduler/objects/application_events.go
b/pkg/scheduler/objects/application_events.go
index 59348dd9..6f209826 100644
--- a/pkg/scheduler/objects/application_events.go
+++ b/pkg/scheduler/objects/application_events.go
@@ -58,7 +58,7 @@ func (evt *applicationEvents) sendNewAllocationEvent(alloc
*Allocation) {
if !evt.eventSystem.IsEventTrackingEnabled() {
return
}
- event := events.CreateAppEventRecord(evt.app.ApplicationID,
common.Empty, alloc.GetUUID(), si.EventRecord_ADD, si.EventRecord_APP_ALLOC,
alloc.GetAllocatedResource())
+ event := events.CreateAppEventRecord(evt.app.ApplicationID,
common.Empty, alloc.GetAllocationID(), si.EventRecord_ADD,
si.EventRecord_APP_ALLOC, alloc.GetAllocatedResource())
evt.eventSystem.AddEvent(event)
}
@@ -89,7 +89,7 @@ func (evt *applicationEvents) sendRemoveAllocationEvent(alloc
*Allocation, termi
eventChangeDetail = si.EventRecord_ALLOC_REPLACED
}
- event := events.CreateAppEventRecord(evt.app.ApplicationID,
common.Empty, alloc.GetUUID(), si.EventRecord_REMOVE, eventChangeDetail,
alloc.GetAllocatedResource())
+ event := events.CreateAppEventRecord(evt.app.ApplicationID,
common.Empty, alloc.GetAllocationID(), si.EventRecord_REMOVE,
eventChangeDetail, alloc.GetAllocatedResource())
evt.eventSystem.AddEvent(event)
}
diff --git a/pkg/scheduler/objects/application_events_test.go
b/pkg/scheduler/objects/application_events_test.go
index e91633d1..827ccd02 100644
--- a/pkg/scheduler/objects/application_events_test.go
+++ b/pkg/scheduler/objects/application_events_test.go
@@ -125,14 +125,14 @@ func TestSendNewAllocationEvent(t *testing.T) {
appEvents.sendNewAllocationEvent(&Allocation{
applicationID: appID0,
allocationKey: aKey,
- allocationID: aUUID,
+ allocationID: aAllocationID,
})
assert.Equal(t, 1, len(mock.events), "event was not generated")
assert.Equal(t, si.EventRecord_APP, mock.events[0].Type, "event type is
not expected")
assert.Equal(t, si.EventRecord_ADD, mock.events[0].EventChangeType,
"event change type is not expected")
assert.Equal(t, si.EventRecord_APP_ALLOC,
mock.events[0].EventChangeDetail, "event change detail is not expected")
assert.Equal(t, appID0, mock.events[0].ObjectID, "event object id is
not expected")
- assert.Equal(t, aUUID, mock.events[0].ReferenceID, "event reference id
is not expected")
+ assert.Equal(t, aAllocationID, mock.events[0].ReferenceID, "event
reference id is not expected")
assert.Equal(t, common.Empty, mock.events[0].Message, "message is not
expected")
}
@@ -188,61 +188,61 @@ func TestSendRemoveAllocationEvent(t *testing.T) {
name: "remove allocation cause of node
removal",
eventSystemMock: newEventSystemMock(),
terminationType:
si.TerminationType_UNKNOWN_TERMINATION_TYPE,
- allocation: &Allocation{applicationID:
appID0, allocationKey: aKey, allocationID: aUUID},
+ allocation: &Allocation{applicationID:
appID0, allocationKey: aKey, allocationID: aAllocationID},
expectedEventCnt: 1,
expectedType: si.EventRecord_APP,
expectedChangeType: si.EventRecord_REMOVE,
expectedChangeDetail: si.EventRecord_ALLOC_NODEREMOVED,
expectedObjectID: appID0,
- expectedReferenceID: aUUID,
+ expectedReferenceID: aAllocationID,
},
{
name: "remove allocation cause of
resource manager cancel",
eventSystemMock: newEventSystemMock(),
terminationType: si.TerminationType_STOPPED_BY_RM,
- allocation: &Allocation{applicationID:
appID0, allocationKey: aKey, allocationID: aUUID},
+ allocation: &Allocation{applicationID:
appID0, allocationKey: aKey, allocationID: aAllocationID},
expectedEventCnt: 1,
expectedType: si.EventRecord_APP,
expectedChangeType: si.EventRecord_REMOVE,
expectedChangeDetail: si.EventRecord_ALLOC_CANCEL,
expectedObjectID: appID0,
- expectedReferenceID: aUUID,
+ expectedReferenceID: aAllocationID,
},
{
name: "remove allocation cause of
timeout",
eventSystemMock: newEventSystemMock(),
terminationType: si.TerminationType_TIMEOUT,
- allocation: &Allocation{applicationID:
appID0, allocationKey: aKey, allocationID: aUUID},
+ allocation: &Allocation{applicationID:
appID0, allocationKey: aKey, allocationID: aAllocationID},
expectedEventCnt: 1,
expectedType: si.EventRecord_APP,
expectedChangeType: si.EventRecord_REMOVE,
expectedChangeDetail: si.EventRecord_ALLOC_TIMEOUT,
expectedObjectID: appID0,
- expectedReferenceID: aUUID,
+ expectedReferenceID: aAllocationID,
},
{
name: "remove allocation cause of
preemption",
eventSystemMock: newEventSystemMock(),
terminationType:
si.TerminationType_PREEMPTED_BY_SCHEDULER,
- allocation: &Allocation{applicationID:
appID0, allocationKey: aKey, allocationID: aUUID},
+ allocation: &Allocation{applicationID:
appID0, allocationKey: aKey, allocationID: aAllocationID},
expectedEventCnt: 1,
expectedType: si.EventRecord_APP,
expectedChangeType: si.EventRecord_REMOVE,
expectedChangeDetail: si.EventRecord_ALLOC_PREEMPT,
expectedObjectID: appID0,
- expectedReferenceID: aUUID,
+ expectedReferenceID: aAllocationID,
},
{
name: "remove allocation cause of
replacement",
eventSystemMock: newEventSystemMock(),
terminationType:
si.TerminationType_PLACEHOLDER_REPLACED,
- allocation: &Allocation{applicationID:
appID0, allocationKey: aKey, allocationID: aUUID},
+ allocation: &Allocation{applicationID:
appID0, allocationKey: aKey, allocationID: aAllocationID},
expectedEventCnt: 1,
expectedType: si.EventRecord_APP,
expectedChangeType: si.EventRecord_REMOVE,
expectedChangeDetail: si.EventRecord_ALLOC_REPLACED,
expectedObjectID: appID0,
- expectedReferenceID: aUUID,
+ expectedReferenceID: aAllocationID,
},
}
for _, testCase := range testCases {
diff --git a/pkg/scheduler/objects/application_test.go
b/pkg/scheduler/objects/application_test.go
index 48c05dec..55cebf30 100644
--- a/pkg/scheduler/objects/application_test.go
+++ b/pkg/scheduler/objects/application_test.go
@@ -857,7 +857,7 @@ func TestAllocations(t *testing.T) {
assert.Equal(t, len(allocs), 3)
assertUserGroupResource(t, getTestUserGroup(), resources.Multiply(res,
3))
// remove one of the 3
- if alloc = app.RemoveAllocation(alloc.GetUUID(),
si.TerminationType_UNKNOWN_TERMINATION_TYPE); alloc == nil {
+ if alloc = app.RemoveAllocation(alloc.GetAllocationID(),
si.TerminationType_UNKNOWN_TERMINATION_TYPE); alloc == nil {
t.Error("returned allocations was nil allocation was not
removed")
}
assertUserGroupResource(t, getTestUserGroup(), resources.Multiply(res,
2))
@@ -1116,7 +1116,7 @@ func TestResourceUsageAggregation(t *testing.T) {
assertUserGroupResource(t, getTestUserGroup(), resources.Multiply(res,
2))
// remove one of the 2
- if alloc = app.RemoveAllocation(alloc.GetUUID(),
si.TerminationType_UNKNOWN_TERMINATION_TYPE); alloc == nil {
+ if alloc = app.RemoveAllocation(alloc.GetAllocationID(),
si.TerminationType_UNKNOWN_TERMINATION_TYPE); alloc == nil {
t.Error("returned allocations was nil allocation was not
removed")
}
assertUserGroupResource(t, getTestUserGroup(), resources.Multiply(res,
1))
@@ -1268,7 +1268,7 @@ func TestReplaceAllocation(t *testing.T) {
t.Fatalf("placeholder allocation not updated as expected: got
%s, expected %s", app.allocatedPlaceholder, res)
}
assertUserGroupResource(t, getTestUserGroup(), res)
- alloc = app.ReplaceAllocation(ph.GetUUID())
+ alloc = app.ReplaceAllocation(ph.GetAllocationID())
assert.Equal(t, alloc, nilAlloc, "placeholder without releases expected
nil to be returned got a real alloc: %s", alloc)
assert.Equal(t, app.placeholderData[""].Replaced, int64(0))
assertUserGroupResource(t, getTestUserGroup(), nil)
@@ -1283,7 +1283,7 @@ func TestReplaceAllocation(t *testing.T) {
realAlloc := newAllocation(appID1, nodeID1, res)
realAlloc.SetResult(Replaced)
ph.AddRelease(realAlloc)
- alloc = app.ReplaceAllocation(ph.GetUUID())
+ alloc = app.ReplaceAllocation(ph.GetAllocationID())
assert.Equal(t, alloc, ph, "returned allocation is not the placeholder")
assert.Assert(t, resources.IsZero(app.allocatedPlaceholder), "real
allocation counted as placeholder")
if !resources.Equals(app.allocatedResource, res) {
@@ -1308,7 +1308,7 @@ func TestReplaceAllocation(t *testing.T) {
realAllocNoAdd := newAllocation(appID1, nodeID1, res)
realAllocNoAdd.SetResult(Replaced)
ph.AddRelease(realAlloc)
- alloc = app.ReplaceAllocation(ph.GetUUID())
+ alloc = app.ReplaceAllocation(ph.GetAllocationID())
assert.Equal(t, alloc, ph, "returned allocation is not the placeholder")
assert.Assert(t, resources.IsZero(app.allocatedPlaceholder), "real
allocation counted as placeholder")
assert.Equal(t, app.placeholderData[""].Replaced, int64(2))
@@ -1357,23 +1357,23 @@ func TestReplaceAllocationTracking(t *testing.T) {
realAlloc1 := newAllocation(appID1, nodeID1, res)
realAlloc1.SetResult(Replaced)
ph1.AddRelease(realAlloc1)
- alloc1 := app.ReplaceAllocation(ph1.GetUUID())
- app.RemoveAllocation(ph1.GetUUID(),
si.TerminationType_PLACEHOLDER_REPLACED)
- assert.Equal(t, ph1.GetUUID(), alloc1.GetUUID())
+ alloc1 := app.ReplaceAllocation(ph1.GetAllocationID())
+ app.RemoveAllocation(ph1.GetAllocationID(),
si.TerminationType_PLACEHOLDER_REPLACED)
+ assert.Equal(t, ph1.GetAllocationID(), alloc1.GetAllocationID())
assert.Equal(t, true, app.HasPlaceholderAllocation())
realAlloc2 := newAllocation(appID1, nodeID1, res)
realAlloc2.SetResult(Replaced)
ph2.AddRelease(realAlloc2)
- alloc2 := app.ReplaceAllocation(ph2.GetUUID())
- app.RemoveAllocation(ph2.GetUUID(),
si.TerminationType_PLACEHOLDER_REPLACED)
- assert.Equal(t, ph2.GetUUID(), alloc2.GetUUID())
+ alloc2 := app.ReplaceAllocation(ph2.GetAllocationID())
+ app.RemoveAllocation(ph2.GetAllocationID(),
si.TerminationType_PLACEHOLDER_REPLACED)
+ assert.Equal(t, ph2.GetAllocationID(), alloc2.GetAllocationID())
assert.Equal(t, true, app.HasPlaceholderAllocation())
realAlloc3 := newAllocation(appID1, nodeID1, res)
realAlloc3.SetResult(Replaced)
ph3.AddRelease(realAlloc3)
- alloc3 := app.ReplaceAllocation(ph3.GetUUID())
- app.RemoveAllocation(ph3.GetUUID(),
si.TerminationType_PLACEHOLDER_REPLACED)
- assert.Equal(t, ph3.GetUUID(), alloc3.GetUUID())
+ alloc3 := app.ReplaceAllocation(ph3.GetAllocationID())
+ app.RemoveAllocation(ph3.GetAllocationID(),
si.TerminationType_PLACEHOLDER_REPLACED)
+ assert.Equal(t, ph3.GetAllocationID(), alloc3.GetAllocationID())
assert.Equal(t, false, app.HasPlaceholderAllocation())
// check placeholder resource usage
@@ -1521,7 +1521,7 @@ func TestTimeoutPlaceholderAllocReleased(t *testing.T) {
for _, event := range events {
if allocRelease, ok :=
event.(*rmevent.RMReleaseAllocationEvent); ok {
assert.Equal(t, len(allocRelease.ReleasedAllocations),
1, "one allocation should have been released")
- assert.Equal(t,
allocRelease.ReleasedAllocations[0].UUID, ph.allocationID, "wrong placeholder
allocation released on timeout")
+ assert.Equal(t,
allocRelease.ReleasedAllocations[0].AllocationID, ph.allocationID, "wrong
placeholder allocation released on timeout")
found = true
}
if _, ok := event.(*rmevent.RMReleaseAllocationAskEvent); ok {
@@ -1560,7 +1560,7 @@ func TestTimeoutPlaceholderCompleting(t *testing.T) {
app.SetState(Running.String())
assertUserGroupResource(t, getTestUserGroup(), resources.Multiply(res,
2))
// remove allocation to trigger state change
- app.RemoveAllocation(alloc.GetUUID(),
si.TerminationType_UNKNOWN_TERMINATION_TYPE)
+ app.RemoveAllocation(alloc.GetAllocationID(),
si.TerminationType_UNKNOWN_TERMINATION_TYPE)
assert.Assert(t, app.IsCompleting(), "App should be in completing state
all allocs have been removed")
assertUserGroupResource(t, getTestUserGroup(), resources.Multiply(res,
1))
// make sure the placeholders time out
@@ -2111,8 +2111,8 @@ func TestAllocationEvents(t *testing.T) { //nolint:funlen
// add + remove
app.AddAllocation(alloc1)
app.AddAllocation(alloc2)
- app.RemoveAllocation(alloc1.GetUUID(), si.TerminationType_STOPPED_BY_RM)
- app.RemoveAllocation(alloc2.GetUUID(),
si.TerminationType_PLACEHOLDER_REPLACED)
+ app.RemoveAllocation(alloc1.GetAllocationID(),
si.TerminationType_STOPPED_BY_RM)
+ app.RemoveAllocation(alloc2.GetAllocationID(),
si.TerminationType_PLACEHOLDER_REPLACED)
noEvents := 0
err = common.WaitFor(10*time.Millisecond, time.Second, func() bool {
noEvents = eventSystem.Store.CountStoredEvents()
@@ -2125,28 +2125,28 @@ func TestAllocationEvents(t *testing.T) {
//nolint:funlen
assert.Equal(t, si.EventRecord_APP, records[1].Type)
assert.Equal(t, si.EventRecord_ADD, records[1].EventChangeType)
assert.Equal(t, si.EventRecord_APP_ALLOC, records[1].EventChangeDetail)
- assert.Equal(t, alloc1.GetUUID(), records[1].ReferenceID)
+ assert.Equal(t, alloc1.GetAllocationID(), records[1].ReferenceID)
assert.Equal(t, "app-1", records[1].ObjectID)
assert.Equal(t, si.EventRecord_APP, records[2].Type)
assert.Equal(t, si.EventRecord_ADD, records[2].EventChangeType)
assert.Equal(t, si.EventRecord_APP_ALLOC, records[2].EventChangeDetail)
- assert.Equal(t, alloc2.GetUUID(), records[2].ReferenceID)
+ assert.Equal(t, alloc2.GetAllocationID(), records[2].ReferenceID)
assert.Equal(t, "app-1", records[2].ObjectID)
assert.Equal(t, si.EventRecord_APP, records[3].Type)
assert.Equal(t, si.EventRecord_REMOVE, records[3].EventChangeType)
assert.Equal(t, si.EventRecord_ALLOC_CANCEL,
records[3].EventChangeDetail)
- assert.Equal(t, alloc1.GetUUID(), records[3].ReferenceID)
+ assert.Equal(t, alloc1.GetAllocationID(), records[3].ReferenceID)
assert.Equal(t, "app-1", records[3].ObjectID)
assert.Equal(t, si.EventRecord_APP, records[4].Type)
assert.Equal(t, si.EventRecord_REMOVE, records[4].EventChangeType)
assert.Equal(t, si.EventRecord_ALLOC_REPLACED,
records[4].EventChangeDetail)
- assert.Equal(t, alloc2.GetUUID(), records[4].ReferenceID)
+ assert.Equal(t, alloc2.GetAllocationID(), records[4].ReferenceID)
assert.Equal(t, "app-1", records[4].ObjectID)
// add + replace
alloc1.placeholder = true
app.AddAllocation(alloc1)
- app.ReplaceAllocation(alloc1.GetUUID())
+ app.ReplaceAllocation(alloc1.GetAllocationID())
noEvents = 0
err = common.WaitFor(10*time.Millisecond, time.Second, func() bool {
noEvents = eventSystem.Store.CountStoredEvents()
@@ -2158,12 +2158,12 @@ func TestAllocationEvents(t *testing.T) {
//nolint:funlen
assert.Equal(t, si.EventRecord_APP, records[0].Type)
assert.Equal(t, si.EventRecord_ADD, records[0].EventChangeType)
assert.Equal(t, si.EventRecord_APP_ALLOC, records[0].EventChangeDetail)
- assert.Equal(t, alloc1.GetUUID(), records[0].ReferenceID)
+ assert.Equal(t, alloc1.GetAllocationID(), records[0].ReferenceID)
assert.Equal(t, "app-1", records[0].ObjectID)
assert.Equal(t, si.EventRecord_APP, records[1].Type)
assert.Equal(t, si.EventRecord_REMOVE, records[1].EventChangeType)
assert.Equal(t, si.EventRecord_ALLOC_REPLACED,
records[1].EventChangeDetail)
- assert.Equal(t, alloc1.GetUUID(), records[0].ReferenceID)
+ assert.Equal(t, alloc1.GetAllocationID(), records[0].ReferenceID)
assert.Equal(t, "app-1", records[0].ObjectID)
// add + remove all
@@ -2181,12 +2181,12 @@ func TestAllocationEvents(t *testing.T) {
//nolint:funlen
assert.Equal(t, si.EventRecord_APP, records[0].Type)
assert.Equal(t, si.EventRecord_ADD, records[0].EventChangeType)
assert.Equal(t, si.EventRecord_APP_ALLOC, records[0].EventChangeDetail)
- assert.Equal(t, alloc1.GetUUID(), records[0].ReferenceID)
+ assert.Equal(t, alloc1.GetAllocationID(), records[0].ReferenceID)
assert.Equal(t, "app-1", records[0].ObjectID)
assert.Equal(t, si.EventRecord_APP, records[1].Type)
assert.Equal(t, si.EventRecord_ADD, records[1].EventChangeType)
assert.Equal(t, si.EventRecord_APP_ALLOC, records[1].EventChangeDetail)
- assert.Equal(t, alloc2.GetUUID(), records[1].ReferenceID)
+ assert.Equal(t, alloc2.GetAllocationID(), records[1].ReferenceID)
assert.Equal(t, "app-1", records[1].ObjectID)
assert.Equal(t, si.EventRecord_APP, records[2].Type)
assert.Equal(t, si.EventRecord_REMOVE, records[2].EventChangeType)
@@ -2198,8 +2198,8 @@ func TestAllocationEvents(t *testing.T) { //nolint:funlen
assert.Equal(t, si.EventRecord_ALLOC_CANCEL,
records[3].EventChangeDetail)
refIdsRemoved[records[3].ReferenceID]++
assert.Equal(t, "app-1", records[3].ObjectID)
- assert.Equal(t, 1, refIdsRemoved[alloc1.GetUUID()])
- assert.Equal(t, 1, refIdsRemoved[alloc2.GetUUID()])
+ assert.Equal(t, 1, refIdsRemoved[alloc1.GetAllocationID()])
+ assert.Equal(t, 1, refIdsRemoved[alloc2.GetAllocationID()])
}
func TestPlaceholderLargerEvent(t *testing.T) {
diff --git a/pkg/scheduler/objects/node.go b/pkg/scheduler/objects/node.go
index 5794c313..1803c9d9 100644
--- a/pkg/scheduler/objects/node.go
+++ b/pkg/scheduler/objects/node.go
@@ -208,13 +208,13 @@ func (sn *Node) refreshAvailableResource() {
}
}
-// Return the allocation based on the uuid of the allocation.
+// Return the allocation based on the allocationID of the allocation.
// returns nil if the allocation is not found
-func (sn *Node) GetAllocation(uuid string) *Allocation {
+func (sn *Node) GetAllocation(allocationID string) *Allocation {
sn.RLock()
defer sn.RUnlock()
- return sn.allocations[uuid]
+ return sn.allocations[allocationID]
}
// Get a copy of the allocations on this node
@@ -298,14 +298,14 @@ func (sn *Node) FitInNode(resRequest *resources.Resource)
bool {
// Returns nil if the allocation was not found and no changes are made. If the
allocation
// is found the Allocation removed is returned. Used resources will decrease
available
// will increase as per the allocation removed.
-func (sn *Node) RemoveAllocation(uuid string) *Allocation {
+func (sn *Node) RemoveAllocation(allocationID string) *Allocation {
defer sn.notifyListeners()
sn.Lock()
defer sn.Unlock()
- alloc := sn.allocations[uuid]
+ alloc := sn.allocations[allocationID]
if alloc != nil {
- delete(sn.allocations, uuid)
+ delete(sn.allocations, allocationID)
sn.allocatedResource.SubFrom(alloc.GetAllocatedResource())
sn.availableResource.AddTo(alloc.GetAllocatedResource())
sn.nodeEvents.sendAllocationRemovedEvent(alloc.allocationKey,
alloc.allocatedResource)
@@ -328,7 +328,7 @@ func (sn *Node) AddAllocation(alloc *Allocation) bool {
// check if this still fits: it might have changed since pre-check
res := alloc.GetAllocatedResource()
if sn.availableResource.FitIn(res) {
- sn.allocations[alloc.GetUUID()] = alloc
+ sn.allocations[alloc.GetAllocationID()] = alloc
sn.allocatedResource.AddTo(res)
sn.availableResource.SubFrom(res)
sn.nodeEvents.sendAllocationAddedEvent(alloc.allocationKey, res)
@@ -340,23 +340,23 @@ func (sn *Node) AddAllocation(alloc *Allocation) bool {
// ReplaceAllocation replaces the placeholder with the real allocation on the
node.
// The delta passed in is the difference in resource usage between placeholder
and real allocation.
// It should always be a negative value or zero: it is a decrease in usage or
no change
-func (sn *Node) ReplaceAllocation(uuid string, replace *Allocation, delta
*resources.Resource) {
+func (sn *Node) ReplaceAllocation(allocationID string, replace *Allocation,
delta *resources.Resource) {
defer sn.notifyListeners()
sn.Lock()
defer sn.Unlock()
- replace.SetPlaceholderCreateTime(sn.allocations[uuid].GetCreateTime())
- delete(sn.allocations, uuid)
+
replace.SetPlaceholderCreateTime(sn.allocations[allocationID].GetCreateTime())
+ delete(sn.allocations, allocationID)
replace.SetPlaceholderUsed(true)
- sn.allocations[replace.GetUUID()] = replace
+ sn.allocations[replace.GetAllocationID()] = replace
before := sn.allocatedResource.Clone()
// The allocatedResource and availableResource should be updated in the
same way
sn.allocatedResource.AddTo(delta)
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 uuid", uuid),
- zap.String("allocation uuid", replace.GetUUID()),
+ zap.String("placeholder allocationid", allocationID),
+ zap.String("allocation allocationid",
replace.GetAllocationID()),
zap.Stringer("delta", delta))
}
}
diff --git a/pkg/scheduler/objects/node_test.go
b/pkg/scheduler/objects/node_test.go
index bd103651..3e99dbd5 100644
--- a/pkg/scheduler/objects/node_test.go
+++ b/pkg/scheduler/objects/node_test.go
@@ -719,7 +719,7 @@ func TestNodeEvents(t *testing.T) {
node.AddAllocation(&Allocation{
allocatedResource:
resources.NewResourceFromMap(map[string]resources.Quantity{"cpu": 1, "memory":
1}),
allocationKey: aKey,
- allocationID: "uuid-0",
+ allocationID: "allocationid-0",
})
assert.Equal(t, 1, len(mockEvents.events))
event = mockEvents.events[0]
@@ -728,7 +728,7 @@ func TestNodeEvents(t *testing.T) {
assert.Equal(t, si.EventRecord_NODE_ALLOC, event.EventChangeDetail)
mockEvents.Reset()
- node.RemoveAllocation("uuid-0")
+ node.RemoveAllocation("allocationid-0")
event = mockEvents.events[0]
assert.Equal(t, si.EventRecord_NODE, event.Type)
assert.Equal(t, si.EventRecord_REMOVE, event.EventChangeType)
diff --git a/pkg/scheduler/objects/queue_test.go
b/pkg/scheduler/objects/queue_test.go
index d50a8e03..f1cfa172 100644
--- a/pkg/scheduler/objects/queue_test.go
+++ b/pkg/scheduler/objects/queue_test.go
@@ -2656,7 +2656,7 @@ func TestQueueRunningAppsForSingleAllocationApp(t
*testing.T) {
_, err = app.updateAskRepeatInternal(ask, -1)
assert.NilError(t, err, "failed to decrease pending resources")
- app.RemoveAllocation(alloc.GetUUID(), si.TerminationType_STOPPED_BY_RM)
+ app.RemoveAllocation(alloc.GetAllocationID(),
si.TerminationType_STOPPED_BY_RM)
assert.Equal(t, app.CurrentState(), Completing.String(), "app state
should be completing")
assert.Equal(t, leaf.runningApps, uint64(0), "leaf should have 0 app
running")
}
diff --git a/pkg/scheduler/objects/utilities_test.go
b/pkg/scheduler/objects/utilities_test.go
index 91a16a6b..bb2a6311 100644
--- a/pkg/scheduler/objects/utilities_test.go
+++ b/pkg/scheduler/objects/utilities_test.go
@@ -35,13 +35,13 @@ import (
)
const (
- appID0 = "app-0"
- appID1 = "app-1"
- appID2 = "app-2"
- aKey = "alloc-1"
- aUUID = "alloc-uuid-1"
- nodeID1 = "node-1"
- instType1 = "itype-1"
+ appID0 = "app-0"
+ appID1 = "app-1"
+ appID2 = "app-2"
+ aKey = "alloc-1"
+ aAllocationID = "alloc-allocationid-1"
+ nodeID1 = "node-1"
+ instType1 = "itype-1"
)
// Create the root queue, base for all testing
diff --git a/pkg/scheduler/partition.go b/pkg/scheduler/partition.go
index 25d7f32b..16cad537 100644
--- a/pkg/scheduler/partition.go
+++ b/pkg/scheduler/partition.go
@@ -391,7 +391,7 @@ func (pc *PartitionContext) removeApplication(appID string)
[]*objects.Allocatio
// track the number of allocations
pc.updateAllocationCount(-len(allocations))
for _, alloc := range allocations {
- currentUUID := alloc.GetUUID()
+ currentAllocationID := alloc.GetAllocationID()
node := pc.GetNode(alloc.GetNodeID())
if node == nil {
log.Log(log.SchedPartition).Warn("unknown node:
not found in active node list",
@@ -399,10 +399,10 @@ func (pc *PartitionContext) removeApplication(appID
string) []*objects.Allocatio
zap.String("nodeID", alloc.GetNodeID()))
continue
}
- if nodeAlloc := node.RemoveAllocation(currentUUID);
nodeAlloc == nil {
+ if nodeAlloc :=
node.RemoveAllocation(currentAllocationID); nodeAlloc == nil {
log.Log(log.SchedPartition).Warn("unknown
allocation: not found on the node",
zap.String("appID", appID),
- zap.String("allocationId", currentUUID),
+ zap.String("allocationId",
currentAllocationID),
zap.String("nodeID", alloc.GetNodeID()))
}
}
@@ -688,7 +688,7 @@ func (pc *PartitionContext) removeNodeAllocations(node
*objects.Node) ([]*object
confirmed := make([]*objects.Allocation, 0)
// walk over all allocations still registered for this node
for _, alloc := range node.GetAllAllocations() {
- allocID := alloc.GetUUID()
+ allocID := alloc.GetAllocationID()
// since we are not locking the node and or application we
could have had an update while processing
// note that we do not return the allocation if the app or
allocation is not found and assume that it
// was already removed
@@ -728,14 +728,14 @@ func (pc *PartitionContext) removeNodeAllocations(node
*objects.Node) ([]*object
if err != nil {
log.Log(log.SchedPartition).Warn("unexpected failure during queue update:
replacing placeholder",
zap.String("appID", alloc.GetApplicationID()),
-
zap.String("placeholderID", alloc.GetUUID()),
-
zap.String("allocationID", release.GetUUID()),
+
zap.String("placeholderID", alloc.GetAllocationID()),
+
zap.String("allocationID", release.GetAllocationID()),
zap.Error(err))
}
log.Log(log.SchedPartition).Warn("replacing placeholder: placeholder is larger
than real allocation",
-
zap.String("allocationID", release.GetUUID()),
+
zap.String("allocationID", release.GetAllocationID()),
zap.Stringer("requested
resource", release.GetAllocatedResource()),
-
zap.String("placeholderID", alloc.GetUUID()),
+
zap.String("placeholderID", alloc.GetAllocationID()),
zap.Stringer("placeholder resource", alloc.GetAllocatedResource()))
}
// track what we confirm on the other
node to confirm it in the shim and get is bound
@@ -746,7 +746,7 @@ func (pc *PartitionContext) removeNodeAllocations(node
*objects.Node) ([]*object
zap.String("nodeID",
node.NodeID),
zap.String("allocationId",
allocID),
zap.String("replacement
nodeID", release.GetNodeID()),
- zap.String("replacement
allocationId", release.GetUUID()))
+ zap.String("replacement
allocationId", release.GetAllocationID()))
continue
}
askAlloc = release
@@ -761,7 +761,7 @@ func (pc *PartitionContext) removeNodeAllocations(node
*objects.Node) ([]*object
zap.String("appID",
askAlloc.GetApplicationID()),
zap.String("allocationKey",
askAlloc.GetAsk().GetAllocationKey()),
zap.String("nodeID", node.NodeID),
- zap.String("replacement allocationId",
askAlloc.GetUUID()))
+ zap.String("replacement allocationId",
askAlloc.GetAllocationID()))
} else {
log.Log(log.SchedPartition).Error("node
removal: repeat update failure for inflight replacement",
zap.String("appID",
askAlloc.GetApplicationID()),
@@ -863,8 +863,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("uuid", alloc.GetUUID()),
- zap.String("placeholder released uuid",
alloc.GetFirstRelease().GetUUID()))
+ 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
}
@@ -927,7 +927,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("uuid", alloc.GetUUID()),
+ zap.String("allocationid", alloc.GetAllocationID()),
zap.Stringer("allocatedResource", alloc.GetAllocatedResource()),
zap.Bool("placeholder", alloc.IsPlaceholder()),
zap.String("targetNode", alloc.GetNodeID()))
@@ -1145,11 +1145,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 uuid for it, we directly use the uuid
reported by shim
- // to track this allocation, a missing uuid is a broken allocation
- if alloc.GetUUID() == "" {
+ // 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 uuid",
+ return fmt.Errorf("failing to restore allocation %s for
application %s: missing allocationid",
alloc.GetAllocationKey(), alloc.GetApplicationID())
}
@@ -1157,7 +1157,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("uuid", alloc.GetUUID()))
+ zap.String("allocationid", alloc.GetAllocationID()))
// Check if allocation violates any resource restriction, or allocate
on a
// non-existent application or nodes.
@@ -1198,7 +1198,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.GetUUID()),
+ zap.String("allocationUid", alloc.GetAllocationID()),
zap.Bool("placeholder", alloc.IsPlaceholder()))
return nil
}
@@ -1259,13 +1259,13 @@ func (pc *PartitionContext) removeAllocation(release
*si.AllocationRelease) ([]*
return nil, nil
}
appID := release.ApplicationID
- uuid := release.GetUUID()
+ allocationID := release.GetAllocationID()
app := pc.getApplication(appID)
// no app nothing to do everything should already be clean
if app == nil {
log.Log(log.SchedPartition).Info("Application not found while
releasing allocation",
zap.String("appID", appID),
- zap.String("allocationId", uuid),
+ zap.String("allocationId", allocationID),
zap.Stringer("terminationType",
release.TerminationType))
return nil, nil
}
@@ -1278,26 +1278,26 @@ func (pc *PartitionContext) removeAllocation(release
*si.AllocationRelease) ([]*
// temp store for allocations manipulated
released := make([]*objects.Allocation, 0)
var confirmed *objects.Allocation
- // when uuid is not specified, remove all allocations from the app
- if uuid == "" {
+ // 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))
released = append(released, app.RemoveAllAllocations()...)
} else {
- // if we have an uuid the termination type is important
+ // if we have an allocationID the termination type is important
if release.TerminationType ==
si.TerminationType_PLACEHOLDER_REPLACED {
log.Log(log.SchedPartition).Info("replacing placeholder
allocation",
zap.String("appID", appID),
- zap.String("allocationId", uuid))
- if alloc := app.ReplaceAllocation(uuid); alloc != nil {
+ zap.String("allocationId", allocationID))
+ if alloc := app.ReplaceAllocation(allocationID); alloc
!= nil {
released = append(released, alloc)
}
} else {
log.Log(log.SchedPartition).Info("removing allocation
from application",
zap.String("appID", appID),
- zap.String("allocationId", uuid),
+ zap.String("allocationId", allocationID),
zap.Stringer("terminationType",
release.TerminationType))
- if alloc := app.RemoveAllocation(uuid,
release.TerminationType); alloc != nil {
+ if alloc := app.RemoveAllocation(allocationID,
release.TerminationType); alloc != nil {
released = append(released, alloc)
}
}
@@ -1323,7 +1323,7 @@ func (pc *PartitionContext) removeAllocation(release
*si.AllocationRelease) ([]*
if node == nil {
log.Log(log.SchedPartition).Warn("node not found while
releasing allocation",
zap.String("appID", appID),
- zap.String("allocationId", alloc.GetUUID()),
+ zap.String("allocationId",
alloc.GetAllocationID()),
zap.String("nodeID", alloc.GetNodeID()))
continue
}
@@ -1339,29 +1339,29 @@ func (pc *PartitionContext) removeAllocation(release
*si.AllocationRelease) ([]*
// total tracked. The total will later be
deducted from the queue usage.
total.SubFrom(delta)
log.Log(log.SchedPartition).Warn("replacing
placeholder: placeholder is larger than real allocation",
- zap.String("allocationID",
confirmed.GetUUID()),
+ zap.String("allocationID",
confirmed.GetAllocationID()),
zap.Stringer("requested resource",
confirmed.GetAllocatedResource()),
- zap.String("placeholderID",
alloc.GetUUID()),
+ zap.String("placeholderID",
alloc.GetAllocationID()),
zap.Stringer("placeholder resource",
alloc.GetAllocatedResource()))
}
// replacements could be on a different node and
different size handle all cases
if confirmed.GetNodeID() == alloc.GetNodeID() {
// this is the real swap on the node, adjust
usage if needed
- node.ReplaceAllocation(alloc.GetUUID(),
confirmed, delta)
+ node.ReplaceAllocation(alloc.GetAllocationID(),
confirmed, delta)
} else {
// we have already added the real allocation to
the new node, just remove the placeholder
- node.RemoveAllocation(alloc.GetUUID())
+ node.RemoveAllocation(alloc.GetAllocationID())
}
log.Log(log.SchedPartition).Info("replacing placeholder
allocation on node",
zap.String("nodeID", alloc.GetNodeID()),
- zap.String("allocationId", alloc.GetUUID()),
+ zap.String("allocationId",
alloc.GetAllocationID()),
zap.String("allocation nodeID",
confirmed.GetNodeID()))
- } else if node.RemoveAllocation(alloc.GetUUID()) != nil {
+ } else if node.RemoveAllocation(alloc.GetAllocationID()) != nil
{
// all non replacement are real removes: must update
the queue usage
total.AddTo(alloc.GetAllocatedResource())
log.Log(log.SchedPartition).Info("removing allocation
from node",
zap.String("nodeID", alloc.GetNodeID()),
- zap.String("allocationId", alloc.GetUUID()))
+ zap.String("allocationId",
alloc.GetAllocationID()))
}
if alloc.IsPreempted() {
totalPreempting.AddTo(alloc.GetAllocatedResource())
@@ -1371,7 +1371,7 @@ func (pc *PartitionContext) removeAllocation(release
*si.AllocationRelease) ([]*
if err := queue.DecAllocatedResource(total); err != nil {
log.Log(log.SchedPartition).Warn("failed to release
resources from queue",
zap.String("appID", appID),
- zap.String("allocationId", uuid),
+ zap.String("allocationId", allocationID),
zap.Error(err))
}
}
diff --git a/pkg/scheduler/partition_test.go b/pkg/scheduler/partition_test.go
index 4869f551..3ac19868 100644
--- a/pkg/scheduler/partition_test.go
+++ b/pkg/scheduler/partition_test.go
@@ -248,7 +248,7 @@ func TestAddNodeWithAllocations(t *testing.T) {
node := newNodeMaxResource(nodeID1, nodeRes)
// fail with an unknown app
- ask := newAllocationAsk("alloc-1-uuid", "unknown", appRes)
+ ask := newAllocationAsk("alloc-1-allocationid", "unknown", appRes)
alloc := objects.NewAllocation(nodeID1, ask)
allocs := []*objects.Allocation{alloc}
err = partition.AddNode(node, allocs)
@@ -258,18 +258,18 @@ func TestAddNodeWithAllocations(t *testing.T) {
assert.Equal(t, partition.nodes.GetNodeCount(), 0, "error returned but
node still added to the partition (app)")
// fail with a broken alloc
- ask = newAllocationAsk("alloc-1-uuid", appID1, appRes)
+ ask = newAllocationAsk("alloc-1-allocationid", appID1, appRes)
alloc = objects.NewAllocation(nodeID1, ask)
- assert.Equal(t, alloc.GetAllocationID(), "alloc-1-uuid-0")
- // reset uuid to empty
+ assert.Equal(t, alloc.GetAllocationID(), "alloc-1-allocationid-0")
+ // 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 (uuid
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 (uuid)")
+ 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
@@ -322,7 +322,7 @@ func TestRemoveNodeWithAllocations(t *testing.T) {
appRes :=
resources.NewResourceFromMap(map[string]resources.Quantity{"vcore": 1000})
ask := newAllocationAsk("alloc-1", appID1, appRes)
alloc := objects.NewAllocation(nodeID1, ask)
- allocUUID := alloc.GetAllocationID()
+ allocAllocationID := alloc.GetAllocationID()
allocs := []*objects.Allocation{alloc}
err = partition.AddNode(node, allocs)
assert.NilError(t, err, "add node to partition should not have failed")
@@ -345,7 +345,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].GetUUID(), allocUUID, "uuid 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")
@@ -403,7 +403,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(),
"uuid 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")
@@ -545,11 +545,11 @@ func TestPlaceholderDataWithPlaceholderPreemption(t
*testing.T) {
// check if there is a release event for the expected allocation
var found bool
- var releasedUUID string
+ var releasedAllocationID string
for _, event := range testHandler2.GetEvents() {
if allocRelease, ok :=
event.(*rmevent.RMReleaseAllocationEvent); ok {
found =
allocRelease.ReleasedAllocations[0].AllocationKey == lastPh
- releasedUUID = allocRelease.ReleasedAllocations[0].UUID
+ releasedAllocationID =
allocRelease.ReleasedAllocations[0].AllocationID
break
}
}
@@ -558,7 +558,7 @@ func TestPlaceholderDataWithPlaceholderPreemption(t
*testing.T) {
release := &si.AllocationRelease{
PartitionName: partition.Name,
ApplicationID: appID2,
- UUID: releasedUUID,
+ AllocationID: releasedAllocationID,
TerminationType: si.TerminationType_PREEMPTED_BY_SCHEDULER,
}
releases, confirmed := partition.removeAllocation(release)
@@ -707,7 +707,7 @@ func TestPlaceholderDataWithRemoval(t *testing.T) {
err = partition.AddApplication(gangApp)
assert.NilError(t, err, "app1-1 should have been added to the
partition")
- var lastPhUUID string
+ var lastPhAllocationID string
for i := 1; i <= 6; i++ {
// add an ask for a placeholder and allocate
ask = newAllocationAskTG(phID+strconv.Itoa(i+1), appID2,
taskGroup, res, true)
@@ -718,7 +718,7 @@ func TestPlaceholderDataWithRemoval(t *testing.T) {
if ph == nil {
t.Fatal("expected placeholder to be allocated")
}
- lastPhUUID = ph.GetUUID()
+ lastPhAllocationID = ph.GetAllocationID()
}
// add an ask for a last placeholder and allocate
@@ -735,7 +735,7 @@ func TestPlaceholderDataWithRemoval(t *testing.T) {
release := &si.AllocationRelease{
PartitionName: partition.Name,
ApplicationID: appID2,
- UUID: lastPhUUID,
+ AllocationID: lastPhAllocationID,
TerminationType: si.TerminationType_STOPPED_BY_RM,
}
releases, _ := partition.removeAllocation(release)
@@ -812,13 +812,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(),
"uuid returned by release not the same as the placeholder")
- assert.Equal(t, alloc.GetAllocationID(),
confirmed[0].GetAllocationID(), "uuid 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(),
"uuid 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)
@@ -885,7 +885,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(),
"uuid 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)
}
@@ -1173,7 +1173,7 @@ func TestRemoveAppAllocs(t *testing.T) {
assertLimits(t, getTestUserGroup(), appRes)
ask = newAllocationAsk("alloc-1", appNotRemoved, appRes)
- uuid := "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")
@@ -1181,7 +1181,7 @@ func TestRemoveAppAllocs(t *testing.T) {
release := &si.AllocationRelease{
PartitionName: "default",
ApplicationID: "",
- UUID: "",
+ AllocationID: "",
TerminationType: si.TerminationType_STOPPED_BY_RM,
}
@@ -1195,19 +1195,19 @@ func TestRemoveAppAllocs(t *testing.T) {
assertLimits(t, getTestUserGroup(), resources.Multiply(appRes, 2))
// create a new release with app, non existing allocation: should just
return
release.ApplicationID = appNotRemoved
- release.UUID = "does_not_exist"
+ release.AllocationID = "does_not_exist"
allocs, _ = partition.removeAllocation(release)
assert.Equal(t, 0, len(allocs), "removal request for non existing
allocation returned allocations: %v", allocs)
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.UUID = uuid
+ 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 uuid: should return last left alloc
- release.UUID = ""
+ // 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)
assert.Equal(t, 0, partition.GetTotalAllocationCount(), "removal
requests did not remove all allocations: %v", partition.allocations)
@@ -1238,7 +1238,7 @@ func TestRemoveAllPlaceholderAllocs(t *testing.T) {
partition.removeAllocation(&si.AllocationRelease{
PartitionName: "default",
ApplicationID: appID1,
- UUID: "",
+ AllocationID: "",
TerminationType: si.TerminationType_STOPPED_BY_RM,
})
assert.Equal(t, 0, partition.getPhAllocationCount())
@@ -1921,7 +1921,7 @@ func TestPreemption(t *testing.T) {
partition.removeAllocation(&si.AllocationRelease{
PartitionName: "default",
ApplicationID: appID1,
- UUID: alloc2.GetUUID(),
+ AllocationID: alloc2.GetAllocationID(),
TerminationType: si.TerminationType_STOPPED_BY_RM,
Message: "Preempted",
AllocationKey: allocID2,
@@ -2154,7 +2154,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())
- uuid := alloc.GetUUID()
+ allocationid := alloc.GetAllocationID()
// required node set on ask
ask2 := newAllocationAsk(allocID2, appID1, res)
@@ -2191,7 +2191,7 @@ func setupPreemptionForRequiredNode(t *testing.T)
(*PartitionContext, *objects.A
release := &si.AllocationRelease{
PartitionName: partition.Name,
ApplicationID: appID1,
- UUID: uuid,
+ AllocationID: allocationid,
TerminationType: si.TerminationType_PREEMPTED_BY_SCHEDULER,
}
releases, _ := partition.removeAllocation(release)
@@ -2863,7 +2863,7 @@ func TestPlaceholderSmallerThanReal(t *testing.T) {
release := &si.AllocationRelease{
PartitionName: ph.GetPartitionName(),
ApplicationID: appID1,
- UUID: ph.GetUUID(),
+ AllocationID: ph.GetAllocationID(),
TerminationType: si.TerminationType_TIMEOUT,
}
assert.Equal(t, 1, partition.getPhAllocationCount(), "ph should be
registered")
@@ -2935,7 +2935,7 @@ func TestPlaceholderSmallerMulti(t *testing.T) {
release := &si.AllocationRelease{
PartitionName: ph.GetPartitionName(),
ApplicationID: appID1,
- UUID: ph.GetUUID(),
+ AllocationID: ph.GetAllocationID(),
TerminationType: si.TerminationType_TIMEOUT,
}
released, _ := partition.removeAllocation(release)
@@ -3002,7 +3002,7 @@ func TestPlaceholderBiggerThanReal(t *testing.T) {
release := &si.AllocationRelease{
PartitionName: ph.GetPartitionName(),
ApplicationID: appID1,
- UUID: ph.GetUUID(),
+ AllocationID: ph.GetAllocationID(),
TerminationType: si.TerminationType_PLACEHOLDER_REPLACED,
}
released, confirmed := partition.removeAllocation(release)
@@ -3041,7 +3041,7 @@ func TestPlaceholderMatch(t *testing.T) {
if ph == nil {
t.Fatal("expected placeholder ph-1 to be allocated")
}
- phUUID := ph.GetUUID()
+ phAllocationID := ph.GetAllocationID()
assert.Equal(t, phID, ph.GetAllocationKey(), "expected allocation of
ph-1 to be returned")
assert.Equal(t, 1, len(app.GetAllPlaceholderData()), "placeholder data
should be created on allocate")
assert.Equal(t, 1, partition.GetTotalAllocationCount(), "placeholder
allocation should be registered as allocation")
@@ -3092,7 +3092,7 @@ func TestPlaceholderMatch(t *testing.T) {
release := &si.AllocationRelease{
PartitionName: "test",
ApplicationID: appID1,
- UUID: phUUID,
+ AllocationID: phAllocationID,
TerminationType: si.TerminationType_PLACEHOLDER_REPLACED,
}
released, confirmed := partition.removeAllocation(release)
@@ -3142,7 +3142,7 @@ func TestPreemptedPlaceholderSkip(t *testing.T) {
if ph == nil {
t.Fatal("expected placeholder ph-1 to be allocated")
}
- phUUID := ph.GetUUID()
+ phAllocationID := ph.GetAllocationID()
assert.Equal(t, phID, ph.GetAllocationKey(), "expected allocation of
ph-1 to be returned")
assert.Equal(t, 1, len(app.GetAllPlaceholderData()), "placeholder data
should be created on allocate")
assert.Equal(t, 1, partition.GetTotalAllocationCount(), "placeholder
allocation should be registered as allocation")
@@ -3170,7 +3170,7 @@ func TestPreemptedPlaceholderSkip(t *testing.T) {
release := &si.AllocationRelease{
PartitionName: "test",
ApplicationID: appID1,
- UUID: phUUID,
+ AllocationID: phAllocationID,
TerminationType: si.TerminationType_PREEMPTED_BY_SCHEDULER,
}
released, confirmed := partition.removeAllocation(release)
@@ -3233,7 +3233,7 @@ func TestTryPlaceholderAllocate(t *testing.T) {
if alloc == nil {
t.Fatal("expected first placeholder to be allocated")
}
- assert.Equal(t, node.GetAllocation(alloc.GetUUID()), alloc,
"placeholder allocation not found on node")
+ assert.Equal(t, node.GetAllocation(alloc.GetAllocationID()), alloc,
"placeholder allocation not found on node")
assert.Assert(t, alloc.IsPlaceholder(), "placeholder alloc should
return a placeholder allocation")
assert.Equal(t, alloc.GetResult(), objects.Allocated, "placeholder
alloc should return an allocated result")
if !resources.Equals(app.GetPlaceholderResource(), res) {
@@ -3256,7 +3256,7 @@ func TestTryPlaceholderAllocate(t *testing.T) {
if alloc == nil {
t.Fatal("expected 2nd placeholder to be allocated")
}
- assert.Equal(t, node.GetAllocation(alloc.GetUUID()), alloc,
"placeholder allocation 2 not found on node")
+ assert.Equal(t, node.GetAllocation(alloc.GetAllocationID()), alloc,
"placeholder allocation 2 not found on node")
if !resources.Equals(app.GetPlaceholderResource(),
resources.Multiply(res, 2)) {
t.Fatalf("placeholder allocation not updated as expected: got
%s, expected %s", app.GetPlaceholderResource(), resources.Multiply(res, 2))
}
@@ -3287,7 +3287,7 @@ func TestTryPlaceholderAllocate(t *testing.T) {
assert.Equal(t, alloc.GetResult(), objects.Replaced, "result is not the
expected allocated replaced")
assert.Equal(t, alloc.GetReleaseCount(), 1, "released allocations
should have been 1")
assertLimits(t, getTestUserGroup(), resources.Multiply(res, 2))
- phUUID := alloc.GetFirstRelease().GetUUID()
+ phAllocationID := alloc.GetFirstRelease().GetAllocationID()
// placeholder is not released until confirmed by the shim
if !resources.Equals(app.GetPlaceholderResource(),
resources.Multiply(res, 2)) {
t.Fatalf("placeholder allocation not updated as expected: got
%s, expected %s", app.GetPlaceholderResource(), resources.Multiply(res, 2))
@@ -3297,7 +3297,7 @@ func TestTryPlaceholderAllocate(t *testing.T) {
release := &si.AllocationRelease{
PartitionName: "test",
ApplicationID: appID1,
- UUID: phUUID,
+ AllocationID: phAllocationID,
TerminationType: si.TerminationType_PLACEHOLDER_REPLACED,
}
released, confirmed := partition.removeAllocation(release)
@@ -3307,7 +3307,7 @@ func TestTryPlaceholderAllocate(t *testing.T) {
if confirmed == nil {
t.Fatal("confirmed allocation should not be nil")
}
- assert.Equal(t, confirmed.GetUUID(), alloc.GetUUID(), "confirmed
allocation has unexpected uuid")
+ assert.Equal(t, confirmed.GetAllocationID(), alloc.GetAllocationID(),
"confirmed allocation has unexpected AllocationID")
if !resources.Equals(app.GetPlaceholderResource(), res) {
t.Fatalf("placeholder allocations not updated as expected: got
%s, expected %s", app.GetPlaceholderResource(), res)
}
@@ -3357,7 +3357,7 @@ func TestFailReplacePlaceholder(t *testing.T) {
}
assert.Equal(t, partition.GetTotalAllocationCount(), 1, "placeholder
allocation should be counted as alloc")
assert.Equal(t, partition.getPhAllocationCount(), 1, "placeholder
allocation should be counted as placeholder")
- assert.Equal(t, node.GetAllocation(alloc.GetUUID()), alloc,
"placeholder allocation not found on node")
+ assert.Equal(t, node.GetAllocation(alloc.GetAllocationID()), alloc,
"placeholder allocation not found on node")
assert.Assert(t, alloc.IsPlaceholder(), "placeholder alloc should
return a placeholder allocation")
assert.Equal(t, alloc.GetResult(), objects.Allocated, "placeholder
alloc should return an allocated result")
assert.Equal(t, alloc.GetNodeID(), nodeID1, "should be allocated on
node-1")
@@ -3385,7 +3385,7 @@ func TestFailReplacePlaceholder(t *testing.T) {
assert.Assert(t, resources.Equals(node.GetAllocatedResource(), res),
"node-1 allocation not updated as expected: got %s, expected %s",
node.GetAllocatedResource(), res)
assert.Assert(t, resources.Equals(node2.GetAllocatedResource(), res),
"node-2 allocation not updated as expected: got %s, expected %s",
node2.GetAllocatedResource(), res)
- phUUID := alloc.GetFirstRelease().GetUUID()
+ phAllocationID := alloc.GetFirstRelease().GetAllocationID()
// placeholder is not released until confirmed by the shim
assert.Assert(t, resources.Equals(app.GetPlaceholderResource(), res),
"placeholder allocation not updated as expected: got %s, expected %s",
app.GetPlaceholderResource(), resources.Multiply(res, 2))
assertLimits(t, getTestUserGroup(), res)
@@ -3394,7 +3394,7 @@ func TestFailReplacePlaceholder(t *testing.T) {
release := &si.AllocationRelease{
PartitionName: "test",
ApplicationID: appID1,
- UUID: phUUID,
+ AllocationID: phAllocationID,
TerminationType: si.TerminationType_PLACEHOLDER_REPLACED,
}
released, confirmed := partition.removeAllocation(release)
@@ -3404,7 +3404,7 @@ func TestFailReplacePlaceholder(t *testing.T) {
if confirmed == nil {
t.Fatal("confirmed allocation should not be nil")
}
- assert.Equal(t, confirmed.GetUUID(), alloc.GetUUID(), "confirmed
allocation has unexpected uuid")
+ assert.Equal(t, confirmed.GetAllocationID(), alloc.GetAllocationID(),
"confirmed allocation has unexpected AllocationID")
assert.Assert(t, resources.IsZero(app.GetPlaceholderResource()),
"placeholder resources should be zero")
assert.Assert(t, resources.Equals(app.GetAllocatedResource(), res),
"allocations not updated as expected: got %s, expected %s",
app.GetAllocatedResource(), res)
assert.Assert(t, resources.IsZero(node.GetAllocatedResource()), "node-1
allocated resources should be zero")
@@ -3908,7 +3908,7 @@ func TestPlaceholderAllocationTracking(t *testing.T) {
// allocate first placeholder
alloc := partition.tryAllocate()
- ph1uuid := alloc.GetUUID()
+ ph1AllocationID := alloc.GetAllocationID()
assert.Assert(t, alloc != nil, "placeholder ask should have been
allocated")
assert.Equal(t, 1, partition.GetTotalAllocationCount(), "placeholder
not counted as alloc")
assert.Equal(t, 1, partition.getPhAllocationCount(), "placeholder not
counted as placeholder")
@@ -3919,33 +3919,33 @@ func TestPlaceholderAllocationTracking(t *testing.T) {
// allocate second placeholder
alloc = partition.tryAllocate()
- ph2uuid := alloc.GetUUID()
+ ph2AllocationID := alloc.GetAllocationID()
assert.Assert(t, alloc != nil, "placeholder ask should have been
allocated")
assert.Equal(t, 2, partition.GetTotalAllocationCount(), "placeholder
not counted as alloc")
assert.Equal(t, 2, partition.getPhAllocationCount(), "placeholder not
counted as placeholder")
// allocate third placeholder
alloc = partition.tryAllocate()
- ph3uuid := alloc.GetUUID()
+ ph3AllocationID := alloc.GetAllocationID()
assert.Assert(t, alloc != nil, "placeholder ask should have been
allocated")
assert.Equal(t, 3, partition.GetTotalAllocationCount(), "placeholder
not counted as alloc")
assert.Equal(t, 3, partition.getPhAllocationCount(), "placeholder not
counted as placeholder")
partition.removeAllocation(&si.AllocationRelease{
- UUID: ph1uuid,
+ AllocationID: ph1AllocationID,
ApplicationID: appID1,
TerminationType: si.TerminationType_PLACEHOLDER_REPLACED,
})
assert.Equal(t, 3, partition.GetTotalAllocationCount(), "placeholder
not counted as alloc")
assert.Equal(t, 2, partition.getPhAllocationCount(), "placeholder
should be removed from count")
partition.removeAllocation(&si.AllocationRelease{
- UUID: ph2uuid,
+ AllocationID: ph2AllocationID,
ApplicationID: appID1,
TerminationType: si.TerminationType_STOPPED_BY_RM,
})
assert.Equal(t, 2, partition.GetTotalAllocationCount(), "placeholder
should be removed from alloc count")
assert.Equal(t, 1, partition.getPhAllocationCount(), "placeholder
should be removed from count")
partition.removeAllocation(&si.AllocationRelease{
- UUID: ph3uuid,
+ AllocationID: ph3AllocationID,
ApplicationID: appID1,
TerminationType: si.TerminationType_TIMEOUT,
})
@@ -3974,7 +3974,7 @@ func TestReservationTracking(t *testing.T) {
assert.NilError(t, err, "failed to add ask")
alloc := partition.tryAllocate() // ask1 occupies node1
- uuid := alloc.GetUUID()
+ allocationID := alloc.GetAllocationID()
assert.Equal(t, objects.Allocated, alloc.GetResult())
assert.Equal(t, "alloc-1", alloc.GetAllocationKey())
assert.Equal(t, 0, partition.getReservationCount())
@@ -3983,7 +3983,7 @@ func TestReservationTracking(t *testing.T) {
assert.Equal(t, 1, partition.getReservationCount())
partition.removeAllocation(&si.AllocationRelease{
- UUID: uuid,
+ AllocationID: allocationID,
ApplicationID: appID1,
TerminationType: si.TerminationType_STOPPED_BY_RM,
}) // terminate ask1
diff --git a/pkg/scheduler/tests/application_tracking_test.go
b/pkg/scheduler/tests/application_tracking_test.go
index 36a3e5c2..359b0043 100644
--- a/pkg/scheduler/tests/application_tracking_test.go
+++ b/pkg/scheduler/tests/application_tracking_test.go
@@ -114,9 +114,9 @@ func TestApplicationHistoryTracking(t *testing.T) {
allocations := ms.mockRM.getAllocations()
assert.Equal(t, 1, len(allocations), "number of allocations")
- var uuid string
+ var allocationID string
for key := range allocations {
- uuid = key
+ allocationID = key
}
// terminate allocation & check events
@@ -126,7 +126,7 @@ func TestApplicationHistoryTracking(t *testing.T) {
{
ApplicationID: appID1,
PartitionName: "default",
- UUID: uuid,
+ AllocationID: allocationID,
TerminationType:
si.TerminationType_STOPPED_BY_RM,
},
},
diff --git a/pkg/scheduler/tests/mock_rm_callback_test.go
b/pkg/scheduler/tests/mock_rm_callback_test.go
index 49a6db24..53488777 100644
--- a/pkg/scheduler/tests/mock_rm_callback_test.go
+++ b/pkg/scheduler/tests/mock_rm_callback_test.go
@@ -72,7 +72,7 @@ func (m *mockRMCallback) UpdateAllocation(response
*si.AllocationResponse) error
m.Lock()
defer m.Unlock()
for _, alloc := range response.New {
- m.Allocations[alloc.UUID] = alloc
+ m.Allocations[alloc.AllocationID] = alloc
if val, ok := m.nodeAllocations[alloc.NodeID]; ok {
val = append(val, alloc)
m.nodeAllocations[alloc.NodeID] = val
@@ -83,7 +83,7 @@ func (m *mockRMCallback) UpdateAllocation(response
*si.AllocationResponse) error
}
}
for _, alloc := range response.Released {
- delete(m.Allocations, alloc.UUID)
+ delete(m.Allocations, alloc.AllocationID)
}
return nil
}
diff --git a/pkg/scheduler/tests/mockscheduler_test.go
b/pkg/scheduler/tests/mockscheduler_test.go
index 4c81f2b9..05e93c1f 100644
--- a/pkg/scheduler/tests/mockscheduler_test.go
+++ b/pkg/scheduler/tests/mockscheduler_test.go
@@ -160,13 +160,13 @@ func (m *mockScheduler) addAppRequest(appID, allocID
string, resource *si.Resour
})
}
-func (m *mockScheduler) releaseAllocRequest(appID, uuid string) error {
+func (m *mockScheduler) releaseAllocRequest(appID, allocationID string) error {
return m.proxy.UpdateAllocation(&si.AllocationRequest{
Releases: &si.AllocationReleasesRequest{
AllocationsToRelease: []*si.AllocationRelease{
{
ApplicationID: appID,
- UUID: uuid,
+ AllocationID: allocationID,
PartitionName: m.partitionName,
},
},
diff --git a/pkg/scheduler/tests/recovery_test.go
b/pkg/scheduler/tests/recovery_test.go
index 94aba2f1..772ae3ab 100644
--- a/pkg/scheduler/tests/recovery_test.go
+++ b/pkg/scheduler/tests/recovery_test.go
@@ -473,7 +473,7 @@ func TestSchedulerRecoveryWithoutAppInfo(t *testing.T) {
ExistingAllocations: []*si.Allocation{
{
AllocationKey:
"allocation-key-01",
- UUID: "UUID01",
+ AllocationID: "ALLOCATIONID01",
ApplicationID: "app-01",
PartitionName: "default",
NodeID: "node-1:1234",
@@ -541,7 +541,7 @@ func TestSchedulerRecoveryWithoutAppInfo(t *testing.T) {
ExistingAllocations: []*si.Allocation{
{
AllocationKey:
"allocation-key-01",
- UUID: "UUID01",
+ AllocationID: "ALLOCATIONID01",
ApplicationID: "app-01",
PartitionName: "default",
NodeID: "node-1:1234",
@@ -843,7 +843,7 @@ partitions:
existingAllocations = append(existingAllocations,
&si.Allocation{
AllocationKey: alloc.AllocationKey,
AllocationTags: alloc.AllocationTags,
- UUID: alloc.UUID,
+ AllocationID: alloc.AllocationID,
ResourcePerAlloc: alloc.ResourcePerAlloc,
Priority: alloc.Priority,
NodeID: alloc.NodeID,
diff --git a/pkg/scheduler/tests/reservation_test.go
b/pkg/scheduler/tests/reservation_test.go
index a81b1032..426093e3 100644
--- a/pkg/scheduler/tests/reservation_test.go
+++ b/pkg/scheduler/tests/reservation_test.go
@@ -422,7 +422,7 @@ func TestUnReservationAndDeletion(t *testing.T) {
}
// delete existing allocations
for _, alloc := range ms.mockRM.getAllocations() {
- err = ms.releaseAllocRequest(appID1, alloc.UUID)
+ err = ms.releaseAllocRequest(appID1, alloc.AllocationID)
assert.NilError(t, err, "allocation release update failed")
}
ms.scheduler.MultiStepSchedule(5)
diff --git a/pkg/scheduler/tests/smoke_test.go
b/pkg/scheduler/tests/smoke_test.go
index 51346950..72f61fee 100644
--- a/pkg/scheduler/tests/smoke_test.go
+++ b/pkg/scheduler/tests/smoke_test.go
@@ -338,7 +338,7 @@ func TestBasicScheduler(t *testing.T) {
// Release all allocations
for _, v := range ms.mockRM.getAllocations() {
updateRequest.Releases.AllocationsToRelease =
append(updateRequest.Releases.AllocationsToRelease, &si.AllocationRelease{
- UUID: v.UUID,
+ AllocationID: v.AllocationID,
ApplicationID: v.ApplicationID,
PartitionName: v.PartitionName,
})
@@ -905,7 +905,7 @@ partitions:
allocReleases = append(allocReleases,
&si.AllocationRelease{
PartitionName: "default",
ApplicationID: appID1,
- UUID: alloc.UUID,
+ AllocationID: alloc.AllocationID,
Message: "",
})
}
@@ -1409,7 +1409,7 @@ func TestDupReleasesInGangScheduling(t *testing.T) {
{
PartitionName: "default",
ApplicationID: appID1,
- UUID:
placeholderAlloc.GetUUID(),
+ AllocationID:
placeholderAlloc.GetAllocationID(),
TerminationType:
si.TerminationType_PLACEHOLDER_REPLACED,
},
},
@@ -1438,7 +1438,7 @@ func TestDupReleasesInGangScheduling(t *testing.T) {
{
PartitionName: "default",
ApplicationID: appID1,
- UUID:
placeholderAlloc.GetUUID(),
+ AllocationID:
placeholderAlloc.GetAllocationID(),
TerminationType:
si.TerminationType_PLACEHOLDER_REPLACED,
},
},
@@ -1594,7 +1594,7 @@ partitions:
// Release all allocations
for _, v := range ms.mockRM.getAllocations() {
updateRequest.Releases.AllocationsToRelease =
append(updateRequest.Releases.AllocationsToRelease, &si.AllocationRelease{
- UUID: v.UUID,
+ AllocationID: v.AllocationID,
ApplicationID: v.ApplicationID,
PartitionName: v.PartitionName,
})
diff --git a/pkg/webservice/dao/allocation_info.go
b/pkg/webservice/dao/allocation_info.go
index 5201b890..90925bd1 100644
--- a/pkg/webservice/dao/allocation_info.go
+++ b/pkg/webservice/dao/allocation_info.go
@@ -24,7 +24,8 @@ type AllocationDAOInfo struct {
RequestTime int64 `json:"requestTime,omitempty"`
// Allocation ask's createTime if PlaceholderUsed is false, otherwise
equivalent to placeholder allocation's createTime
AllocationTime int64 `json:"allocationTime,omitempty"`
// Allocation's createTime
AllocationDelay int64 `json:"allocationDelay,omitempty"`
// Difference between AllocationTime and RequestTime
- UUID string `json:"uuid,omitempty"`
+ UUID string `json:"uuid,omitempty"`
// Deprecated. Need to remove this in next major release
+ AllocationID string `json:"allocationID,omitempty"`
// Added to replace UUID.
ResourcePerAlloc map[string]int64 `json:"resource,omitempty"`
Priority string `json:"priority,omitempty"`
NodeID string `json:"nodeId,omitempty"`
diff --git a/pkg/webservice/handlers.go b/pkg/webservice/handlers.go
index 72ba5149..c2ecfc86 100644
--- a/pkg/webservice/handlers.go
+++ b/pkg/webservice/handlers.go
@@ -194,7 +194,8 @@ func getAllocationDAO(alloc *objects.Allocation)
*dao.AllocationDAOInfo {
RequestTime: requestTime,
AllocationTime: allocTime,
AllocationDelay: allocTime - requestTime,
- UUID: alloc.GetUUID(),
+ UUID: alloc.GetAllocationID(),
+ AllocationID: alloc.GetAllocationID(),
ResourcePerAlloc: alloc.GetAllocatedResource().DAOMap(),
PlaceholderUsed: alloc.IsPlaceholderUsed(),
Placeholder: alloc.IsPlaceholder(),
diff --git a/pkg/webservice/handlers_test.go b/pkg/webservice/handlers_test.go
index cc669958..bd240568 100644
--- a/pkg/webservice/handlers_test.go
+++ b/pkg/webservice/handlers_test.go
@@ -1030,12 +1030,14 @@ func TestGetPartitionNodes(t *testing.T) {
assert.Equal(t, node.NodeID, node1ID)
assert.Equal(t, "alloc-1",
node.Allocations[0].AllocationKey)
assert.Equal(t, "alloc-1-0", node.Allocations[0].UUID)
+ assert.Equal(t, "alloc-1-0",
node.Allocations[0].AllocationID)
assert.DeepEqual(t, attributesOfnode1, node.Attributes)
assert.DeepEqual(t, map[string]int64{"memory": 50,
"vcore": 30}, node.Utilized)
} else {
assert.Equal(t, node.NodeID, node2ID)
assert.Equal(t, "alloc-2",
node.Allocations[0].AllocationKey)
assert.Equal(t, "alloc-2-0", node.Allocations[0].UUID)
+ assert.Equal(t, "alloc-2-0",
node.Allocations[0].AllocationID)
assert.DeepEqual(t, attributesOfnode2, node.Attributes)
assert.DeepEqual(t, map[string]int64{"memory": 30,
"vcore": 50}, node.Utilized)
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]