zhuqi-lucas commented on code in PR #745:
URL: https://github.com/apache/yunikorn-core/pull/745#discussion_r1418957840


##########
pkg/scheduler/objects/application.go:
##########
@@ -936,6 +938,8 @@ func (sa *Application) tryAllocate(headRoom 
*resources.Resource, allowPreemption
        userHeadroom := ugm.GetUserManager().Headroom(sa.queuePath, 
sa.ApplicationID, sa.user)
        // get all the requests from the app sorted in order
        for _, request := range sa.sortedRequests {
+               request.SetSchedulingAttempted(true)
+

Review Comment:
   1. When we calculate the headroom for scheduling cycle using the getHeadRoom 
method:
   ```
   // getHeadRoom returns the headroom for the queue. This can never be more 
than the headroom for the parent.
   // In case there are no nodes in a newly started cluster and no queues have 
a limit configured this call
   // will return nil.
   // NOTE: if a resource quantity is missing and a limit is defined the 
missing quantity will be seen as no limit.
   func (sq *Queue) getHeadRoom() *resources.Resource {
        var parentHeadRoom *resources.Resource
        if sq.parent != nil {
                parentHeadRoom = sq.parent.getHeadRoom()
        }
        return sq.internalHeadRoom(parentHeadRoom)
   }
   ```
   So the attempt will be rejected if we have root limit, but the triggering 
autoscaling is different 
   
   2. When we calculate the headroom for triggering autoscaling, we use the 
getMaxHeadRoom method:
   ```
   // getMaxHeadRoom returns the maximum headRoom of a queue. The cluster size, 
which defines the root limit,
   // is not relevant for this call. Contrary to the getHeadRoom call. This 
will return nil unless a limit is set.
   // Used during scheduling in an auto-scaling cluster.
   // NOTE: if a resource quantity is missing and a limit is defined the 
missing quantity will be seen as no limit.
   func (sq *Queue) getMaxHeadRoom() *resources.Resource {
        var parentHeadRoom *resources.Resource
        if sq.parent != nil {
                parentHeadRoom = sq.parent.getMaxHeadRoom()
        } else {
                return nil
        }
        return sq.internalHeadRoom(parentHeadRoom)
   }
   ```
   
   



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