wangdatan commented on a change in pull request #173:
URL: 
https://github.com/apache/incubator-yunikorn-core/pull/173#discussion_r449813724



##########
File path: pkg/scheduler/scheduling_queue.go
##########
@@ -482,9 +482,26 @@ func (sq *SchedulingQueue) getHeadRoom() 
*resources.Resource {
        if sq.parent != nil {
                parentHeadRoom = sq.parent.getHeadRoom()
        }
+       return sq.internalHeadRoom(parentHeadRoom)
+}
+
+// this function returns the max headRoom of a queue
+// this doesn't get the partition resources into the consideration
+func (sq *SchedulingQueue) getMaxHeadRoom() *resources.Resource {

Review comment:
       Maybe I missed something here, I think we don't need getMaxHeadRoom (and 
it should be Headroom instead of HeadRoom).
   
   What we really need is to be able to pass the parent's Headroom (instead of 
getting from parent.Headroom, which is be used by scheduling).
   
   Also, this patch doesn't take hiearchical resource quota into account. We 
can do this better by doing the following logic. 
   
   ```
   // Return total assigned resource of this queue
   queue.getQueueOutstandingRequests(parentHeadroom, outstandingRequests) 
*Resource{
        myHeadroom = queue.getHeadRoom(parentHeadroom)
   
        totalOutstandingResource := 0
   
        if queue.isLeafQueue() {
          for _, app := range sq.sortApplications() {
                  app.getOutstandingRequests(myHeadRoom, total)
          }
        } else {
   
           for child : queue.children() {
               assigned := child.getQueueOutstandingRequests(myHeadroom, 
outstandingRequests)
   
               myHeadroom -= assigned
   
               totalOutstandingResource += assigned 
   
               if myHeadroom <= 0 {
                   return totalOutstandingResource
               }
           }
        }
   }
   
   // And for root, it passes nil for parentHeadroom.
   ```

##########
File path: pkg/scheduler/outstanding_requests.go
##########
@@ -0,0 +1,43 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+package scheduler
+
+// an outstanding request is a request that fits into the queue capacity but in
+// pending state because there is no enough partition resources to allocate it
+type outstandingRequests struct {

Review comment:
       Regarding style: Why use typedef struct instead of a simple array[]?

##########
File path: pkg/scheduler/scheduling_partition.go
##########
@@ -356,6 +356,17 @@ func (psc *partitionSchedulingContext) 
removeSchedulingNode(nodeID string) {
        }
 }
 
+func (psc *partitionSchedulingContext) calculateOutstandingRequests() 
*outstandingRequests {

Review comment:
       Suggest to rename to `getAllocatableOutstandingRequests`

##########
File path: pkg/scheduler/scheduling_application.go
##########
@@ -409,6 +409,21 @@ func (sa *SchedulingApplication) sortRequests(ascending 
bool) {
        }
 }
 
+func (sa *SchedulingApplication) getOutstandingRequests(headRoom 
*resources.Resource, total *outstandingRequests) {

Review comment:
       Suggest to rename to `getAllocatableOutstandingRequests`

##########
File path: pkg/scheduler/scheduling_queue.go
##########
@@ -558,6 +575,19 @@ func (sq *SchedulingQueue) tryAllocate(ctx 
*partitionSchedulingContext) *schedul
        return nil
 }
 
+func (sq *SchedulingQueue) getQueueOutstandingRequests(total 
*outstandingRequests) {

Review comment:
       Suggest to rename to `getAllocatableOutstandingRequests`

##########
File path: pkg/scheduler/scheduler.go
##########
@@ -110,6 +111,39 @@ func (s *Scheduler) internalPreemption() {
        }
 }
 
+func (s *Scheduler) internalInspectOutstandingRequests() {
+       for {
+               time.Sleep(1000 * time.Millisecond)
+               s.inspectOutstandingRequests()
+       }
+}
+
+func (s *Scheduler) inspectOutstandingRequests() {

Review comment:
       Suggest to rename it to `UpdateUnschedulableStateForOutstandingRequests`




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

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


Reply via email to