From beab442f36505370802bfe63827a7d536961e3fd Mon Sep 17 00:00:00 2001 From: Newnius Date: Mon, 15 Jun 2020 14:38:31 +0800 Subject: [PATCH] update --- src/resource_pool.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/resource_pool.go b/src/resource_pool.go index f82e505..0d330fb 100644 --- a/src/resource_pool.go +++ b/src/resource_pool.go @@ -923,13 +923,11 @@ func (pool *ResourcePool) doAcquireResource(job Job) []NodeStatus { allocation := InstanceOfAllocator().allocate(nodesT, tasks) //log.Info(allocation) if allocation.Flags["valid"] { - - log.Info(allocation.TasksOnNode) - for range job.Tasks { //append would cause uncertain order ress = append(ress, NodeStatus{ClientID: "null"}) } + cnt := 0 for nodeID, tasks := range allocation.TasksOnNode { var node *NodeStatus for i := range candidates { @@ -945,6 +943,7 @@ func (pool *ResourcePool) doAcquireResource(job Job) []NodeStatus { } } for _, task := range tasks { + cnt++ res := NodeStatus{} res.ClientID = node.ClientID res.ClientHost = node.ClientHost @@ -985,6 +984,11 @@ func (pool *ResourcePool) doAcquireResource(job Job) []NodeStatus { } } + if cnt != len(job.Tasks) { + log.Warn("Allocation is invalid") + log.Warn(cnt, job.Tasks, allocation.TasksOnNode) + } + } }