chenya-zhang commented on a change in pull request #356:
URL: 
https://github.com/apache/incubator-yunikorn-core/pull/356#discussion_r781384680



##########
File path: pkg/scheduler/objects/application.go
##########
@@ -827,13 +827,41 @@ func (sa *Application) 
tryPlaceholderAllocate(nodeIterator func() NodeIterator,
                        if ph.released || request.taskGroupName != 
ph.taskGroupName {
                                continue
                        }
+                       // before we check anything we need to check the 
resources equality
+                       delta := resources.Sub(ph.AllocatedResource, 
request.AllocatedResource)
+                       // Any negative value in the delta means that at least 
one of the requested resource in the real
+                       // allocation is larger than the placeholder. We need 
to cancel the placeholder and check the next
+                       // placeholder. This should trigger a cleanup of all 
the placeholder as a task group is always one size.
+                       if delta.HasNegativeValue() {
+                               log.Logger().Warn("releasing placeholder: real 
allocation is larger than placeholder",
+                                       zap.String("requested resource", 
request.AllocatedResource.String()),
+                                       zap.String("placeholderID", ph.UUID),
+                                       zap.String("placeholder resource", 
ph.AllocatedResource.String()))
+                               // release the placeholder and tell the RM
+                               ph.released = true
+                               sa.notifyRMAllocationReleased(sa.rmID, 
[]*Allocation{ph}, si.TerminationType_TIMEOUT, "cancel placeholder: resource 
incompatible")

Review comment:
       > cancel placeholder: resource incompatible
   
   Will it be easier to understand if we say "requested resource larger than 
placeholder" directly? "resource incompatible" may also refer to resource type.

##########
File path: pkg/scheduler/objects/application.go
##########
@@ -827,13 +827,41 @@ func (sa *Application) 
tryPlaceholderAllocate(nodeIterator func() NodeIterator,
                        if ph.released || request.taskGroupName != 
ph.taskGroupName {
                                continue
                        }
+                       // before we check anything we need to check the 
resources equality
+                       delta := resources.Sub(ph.AllocatedResource, 
request.AllocatedResource)
+                       // Any negative value in the delta means that at least 
one of the requested resource in the real
+                       // allocation is larger than the placeholder. We need 
to cancel the placeholder and check the next
+                       // placeholder. This should trigger a cleanup of all 
the placeholder as a task group is always one size.

Review comment:
       > This should trigger a cleanup of all the placeholder as a task group 
is always one size.
   
   It sounds to me that all other placeholders will be removed (= cleaned up)?




-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to