@@ -85,7 +85,7 @@ public abstract class AbstractCSQueue implements CSQueue {
85
// Track capacities like used-capcity/abs-used-capacity/capacity/abs-capacity,
85
// Track capacities like used-capcity/abs-used-capacity/capacity/abs-capacity,
86
// etc.
86
// etc.
87
QueueCapacities queueCapacities ;
87
QueueCapacities queueCapacities ;
88
-
88
+
89
private final RecordFactory recordFactory =
89
private final RecordFactory recordFactory =
90
RecordFactoryProvider .getRecordFactory (null );
90
RecordFactoryProvider .getRecordFactory (null );
91
protected CapacitySchedulerContext csContext ;
91
protected CapacitySchedulerContext csContext ;
@@ -473,55 +473,55 @@ synchronized boolean canAssignToThisQueue(Resource clusterResource,
473
getCurrentLimitResource (nodePartition , clusterResource ,
473
getCurrentLimitResource (nodePartition , clusterResource ,
474
currentResourceLimits , schedulingMode );
474
currentResourceLimits , schedulingMode );
475
475
476
- // if reservation continous looking enabled, check to see if could we
477
- // potentially use this node instead of a reserved node if the application
478
- // has reserved containers.
479
- // TODO, now only consider reservation cases when the node has no label
480
- if (this .reservationsContinueLooking
481
- && nodePartition .equals (RMNodeLabelsManager .NO_LABEL )
482
- && Resources .greaterThan (resourceCalculator , clusterResource ,
483
- resourceCouldBeUnreserved , Resources .none ())) {
484
- // resource-without-reserved = used - reserved
485
- Resource newTotalWithoutReservedResource =
486
- Resources .subtract (newTotalResource , resourceCouldBeUnreserved );
487
-
488
- // when total-used-without-reserved-resource < currentLimit, we still
489
- // have chance to allocate on this node by unreserving some containers
490
- if (Resources .lessThan (resourceCalculator , clusterResource ,
491
- newTotalWithoutReservedResource , currentLimitResource )) {
492
- if (LOG .isDebugEnabled ()) {
493
- LOG .debug ("try to use reserved: " + getQueueName ()
494
- + " usedResources: " + queueUsage .getUsed ()
495
- + ", clusterResources: " + clusterResource
496
- + ", reservedResources: " + resourceCouldBeUnreserved
497
- + ", capacity-without-reserved: "
498
- + newTotalWithoutReservedResource + ", maxLimitCapacity: "
499
- + currentLimitResource );
500
- }
501
- return true ;
502
- }
503
- }
504
-
505
- // Check if we over current-resource-limit computed.
506
if (Resources .greaterThan (resourceCalculator , clusterResource ,
476
if (Resources .greaterThan (resourceCalculator , clusterResource ,
507
newTotalResource , currentLimitResource )) {
477
newTotalResource , currentLimitResource )) {
508
- return false ;
509
- }
510
478
511
- if (LOG .isDebugEnabled ()) {
479
+ // if reservation continous looking enabled, check to see if could we
512
- LOG .debug (getQueueName ()
480
+ // potentially use this node instead of a reserved node if the application
513
- + "Check assign to queue, nodePartition="
481
+ // has reserved containers.
514
- + nodePartition
482
+ // TODO, now only consider reservation cases when the node has no label
515
- + " usedResources: "
483
+ if (this .reservationsContinueLooking
516
- + queueUsage .getUsed (nodePartition )
484
+ && nodePartition .equals (RMNodeLabelsManager .NO_LABEL )
517
- + " clusterResources: "
485
+ && Resources .greaterThan (resourceCalculator , clusterResource ,
518
- + clusterResource
486
+ resourceCouldBeUnreserved , Resources .none ())) {
519
- + " currentUsedCapacity "
487
+ // resource-without-reserved = used - reserved
520
- + Resources .divide (resourceCalculator , clusterResource ,
488
+ Resource newTotalWithoutReservedResource =
521
- queueUsage .getUsed (nodePartition ),
489
+ Resources .subtract (newTotalResource , resourceCouldBeUnreserved );
522
- labelManager .getResourceByLabel (nodePartition , clusterResource ))
490
+
523
- + " max-capacity: "
491
+ // when total-used-without-reserved-resource < currentLimit, we still
524
- + queueCapacities .getAbsoluteMaximumCapacity (nodePartition ) + ")" );
492
+ // have chance to allocate on this node by unreserving some containers
493
+ if (Resources .lessThan (resourceCalculator , clusterResource ,
494
+ newTotalWithoutReservedResource , currentLimitResource )) {
495
+ if (LOG .isDebugEnabled ()) {
496
+ LOG .debug ("try to use reserved: " + getQueueName ()
497
+ + " usedResources: " + queueUsage .getUsed ()
498
+ + ", clusterResources: " + clusterResource
499
+ + ", reservedResources: " + resourceCouldBeUnreserved
500
+ + ", capacity-without-reserved: "
501
+ + newTotalWithoutReservedResource + ", maxLimitCapacity: "
502
+ + currentLimitResource );
503
+ }
504
+ currentResourceLimits .setAmountNeededUnreserve (Resources .subtract (newTotalResource ,
505
+ currentLimitResource ));
506
+ return true ;
507
+ }
508
+ }
509
+ if (LOG .isDebugEnabled ()) {
510
+ LOG .debug (getQueueName ()
511
+ + "Check assign to queue, nodePartition="
512
+ + nodePartition
513
+ + " usedResources: "
514
+ + queueUsage .getUsed (nodePartition )
515
+ + " clusterResources: "
516
+ + clusterResource
517
+ + " currentUsedCapacity "
518
+ + Resources .divide (resourceCalculator , clusterResource ,
519
+ queueUsage .getUsed (nodePartition ),
520
+ labelManager .getResourceByLabel (nodePartition , clusterResource ))
521
+ + " max-capacity: "
522
+ + queueCapacities .getAbsoluteMaximumCapacity (nodePartition ) + ")" );
523
+ }
524
+ return false ;
525
}
525
}
526
return true ;
526
return true ;
527
}
527
}
0 commit comments