This is an automated email from the ASF dual-hosted git repository.
pbacsko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/yunikorn-core.git
The following commit(s) were added to refs/heads/master by this push:
new 6f54992d [YUNIKORN-2942] Expose foreign allocations tags on the REST
interface (#988)
6f54992d is described below
commit 6f54992d4eb07d4be4e529570ac186bb3b76fb05
Author: Peter Bacsko <[email protected]>
AuthorDate: Tue Oct 22 16:41:16 2024 +0200
[YUNIKORN-2942] Expose foreign allocations tags on the REST interface (#988)
Closes: #988
Signed-off-by: Peter Bacsko <[email protected]>
---
pkg/webservice/dao/allocation_info.go | 13 +++++++------
pkg/webservice/handlers.go | 1 +
pkg/webservice/handlers_test.go | 6 ++++++
3 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/pkg/webservice/dao/allocation_info.go
b/pkg/webservice/dao/allocation_info.go
index e399cbdf..0de1191d 100644
--- a/pkg/webservice/dao/allocation_info.go
+++ b/pkg/webservice/dao/allocation_info.go
@@ -36,10 +36,11 @@ type AllocationDAOInfo struct {
}
type ForeignAllocationDAOInfo struct {
- AllocationKey string `json:"allocationKey"` // no
omitempty, allocation key should not be empty
- AllocationTime int64 `json:"allocationTime,omitempty"`
- ResourcePerAlloc map[string]int64 `json:"resource,omitempty"`
- Priority string `json:"priority,omitempty"`
- NodeID string `json:"nodeId,omitempty"`
- Preemptable bool `json:"preemptable,omitempty"`
+ AllocationKey string `json:"allocationKey"` // no
omitempty, allocation key should not be empty
+ AllocationTags map[string]string `json:"allocationTags,omitempty"`
+ AllocationTime int64 `json:"allocationTime,omitempty"`
+ ResourcePerAlloc map[string]int64 `json:"resource,omitempty"`
+ Priority string `json:"priority,omitempty"`
+ NodeID string `json:"nodeId,omitempty"`
+ Preemptable bool `json:"preemptable,omitempty"`
}
diff --git a/pkg/webservice/handlers.go b/pkg/webservice/handlers.go
index 8e455a71..1180b32e 100644
--- a/pkg/webservice/handlers.go
+++ b/pkg/webservice/handlers.go
@@ -258,6 +258,7 @@ func getForeignAllocationDAO(alloc *objects.Allocation)
*dao.ForeignAllocationDA
allocTime := alloc.GetCreateTime().UnixNano()
allocDAO := &dao.ForeignAllocationDAOInfo{
AllocationKey: alloc.GetAllocationKey(),
+ AllocationTags: alloc.GetTagsClone(),
AllocationTime: allocTime,
ResourcePerAlloc: alloc.GetAllocatedResource().DAOMap(),
Priority: strconv.Itoa(int(alloc.GetPriority())),
diff --git a/pkg/webservice/handlers_test.go b/pkg/webservice/handlers_test.go
index bba72166..e3465b89 100644
--- a/pkg/webservice/handlers_test.go
+++ b/pkg/webservice/handlers_test.go
@@ -1490,6 +1490,12 @@ func assertForeignAllocation(t *testing.T, key,
priority, nodeID string, expecte
resFromInfo := resources.NewResourceFromMap(resMap)
assert.Assert(t, resources.Equals(resFromInfo, expectedRes))
assert.Equal(t, preemptable, info.Preemptable)
+ assert.Equal(t, 1, len(info.AllocationTags))
+ if info.AllocationKey == "foreign-1" {
+ assert.Equal(t, siCommon.AllocTypeDefault,
info.AllocationTags[siCommon.Foreign])
+ } else {
+ assert.Equal(t, siCommon.AllocTypeStatic,
info.AllocationTags[siCommon.Foreign])
+ }
}
// addApp Add app to the given partition and assert the app count, state etc
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]