You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@yunikorn.apache.org by GitBox <gi...@apache.org> on 2022/12/14 14:59:12 UTC

[GitHub] [yunikorn-core] craigcondit commented on a diff in pull request #478: [YUNIKORN-1465] Track dynamic preemption priority of applications

craigcondit commented on code in PR #478:
URL: https://github.com/apache/yunikorn-core/pull/478#discussion_r1048575678


##########
pkg/scheduler/objects/application.go:
##########
@@ -1508,6 +1510,9 @@ func (sa *Application) addAllocationInternal(info *Allocation) {
 		sa.allocatedResource = resources.Add(sa.allocatedResource, info.GetAllocatedResource())
 		sa.maxAllocatedResource = resources.ComponentWiseMax(sa.allocatedResource, sa.maxAllocatedResource)
 	}
+	if info.GetPriority() < sa.allocMinPriority {

Review Comment:
   add a variable here so we don't call GetPriority() multiple times (this locks the object repeatedly)



##########
pkg/scheduler/objects/application.go:
##########
@@ -1640,9 +1645,32 @@ func (sa *Application) removeAllocationInternal(uuid string, releaseType si.Term
 		}
 	}
 	delete(sa.allocations, uuid)
+	if alloc.GetPriority() == sa.allocMinPriority {
+		sa.updateAllocationMinPriority(alloc.GetPriority())
+	}
 	return alloc
 }
 
+func (sa *Application) updateAllocationMinPriority(allocPriority int32) {

Review Comment:
   This can just be a simple loop, tracking the lowest priority value we find. The extra minPriorityCount stuff doesn't save any time and adds complexity.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@yunikorn.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org