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/09/21 14:29:49 UTC

[GitHub] [yunikorn-core] pbacsko commented on a diff in pull request #438: [YUNIKORN-1337] Application state stuck in Accepted when placeholders are running and the job is deleted

pbacsko commented on code in PR #438:
URL: https://github.com/apache/yunikorn-core/pull/438#discussion_r976586060


##########
pkg/scheduler/objects/application.go:
##########
@@ -1502,13 +1502,17 @@ func (sa *Application) removeAllocationInternal(uuid string) *Allocation {
 	if alloc == nil {
 		return nil
 	}
+
+	// we have to emit a completion event if we have no allocations and placeholders left
+	noAllocations := resources.IsZero(sa.pending) && resources.IsZero(sa.allocatedResource)
+
 	// update correct allocation tracker
 	if alloc.IsPlaceholder() {
 		sa.allocatedPlaceholder = resources.Sub(sa.allocatedPlaceholder, alloc.GetAllocatedResource())
 		// if all the placeholders are replaced, clear the placeholder timer
 		if resources.IsZero(sa.allocatedPlaceholder) {
 			sa.clearPlaceholderTimer()
-			if (sa.IsCompleting() && sa.stateTimer == nil) || sa.IsFailing() || sa.IsResuming() {
+			if (sa.IsCompleting() && sa.stateTimer == nil) || sa.IsFailing() || sa.IsResuming() || noAllocations {

Review Comment:
   Almost, but in the else block `allocatedResource` is updated, so it's not exactly the same.
   Added a tiny function which increases readability.



-- 
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