manirajv06 commented on code in PR #452:
URL: https://github.com/apache/yunikorn-core/pull/452#discussion_r1031271064


##########
pkg/scheduler/objects/application.go:
##########
@@ -886,6 +886,47 @@ func (sa *Application) tryAllocate(headRoom 
*resources.Resource, nodeIterator fu
                                        zap.String("required node", 
requiredNode))
                                return nil
                        }
+
+                       // Are there any non daemon set reservations on 
specific required node?
+                       // Cancel those reservations to run daemon set pods
+                       reservations := node.getReservations()
+                       if len(reservations) > 0 {
+                               unreserve := true
+                               for _, res := range node.getReservations() {
+                                       // skip the node
+                                       if res.ask.GetRequiredNode() != "" {
+                                               unreserve = false
+                                               break
+                                       }
+                               }
+                               if unreserve {
+                                       var err error
+                                       var num int
+                                       // un reserve all the apps that were 
reserved on the node
+                                       for _, res := range 
node.getReservations() {
+                                               if num, err = 
res.app.unReserveInternal(node, res.ask); err != nil {
+                                                       
log.Logger().Warn("Unable to cancel reservations on node",
+                                                               
zap.String("victim application ID", res.app.ApplicationID),
+                                                               
zap.String("victim allocationKey", res.getKey()),
+                                                               
zap.String("required node", requiredNode),
+                                                               
zap.Int("reservations count", num),
+                                                               
zap.String("application ID", sa.ApplicationID),
+                                                               
zap.String("allocation key", request.GetAllocationKey()))
+                                               } else {
+                                                       
log.Logger().Info("Cancelled reservation on required node",
+                                                               
zap.String("affected application ID", res.app.ApplicationID),
+                                                               
zap.String("affected allocationKey", res.getKey()),
+                                                               
zap.String("required node", requiredNode),
+                                                               
zap.Int("reservations count", num),
+                                                               
zap.String("application ID", sa.ApplicationID),
+                                                               
zap.String("allocation key", request.GetAllocationKey()))
+                                               }
+                                               // remove the reservation of 
the queue
+                                               
res.app.queue.UnReserve(res.app.ApplicationID, num)

Review Comment:
   @wilfred-s like above, do we also need to take care of reservation count in 
partition? 



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