YARN-6779. DominantResourceFairnessPolicy.DominantResourceFairnessComparator.calculateShares() should be @VisibleForTesting

(Contributed by Yeliang Cang via Daniel Templeton)
This commit is contained in:
Daniel Templeton 2017-07-24 12:13:50 -07:00
parent 4c40cd451c
commit bb30bd3771
1 changed files with 2 additions and 0 deletions

View File

@ -21,6 +21,7 @@ package org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.policies;
import java.util.Collection; import java.util.Collection;
import java.util.Comparator; import java.util.Comparator;
import com.google.common.annotations.VisibleForTesting;
import org.apache.hadoop.classification.InterfaceAudience.Private; import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceStability.Unstable; import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.api.records.Resource; import org.apache.hadoop.yarn.api.records.Resource;
@ -174,6 +175,7 @@ public class DominantResourceFairnessPolicy extends SchedulingPolicy {
* by largest share. So if resource=<10 MB, 5 CPU>, and pool=<100 MB, 10 CPU>, * by largest share. So if resource=<10 MB, 5 CPU>, and pool=<100 MB, 10 CPU>,
* shares will be [.1, .5] and resourceOrder will be [CPU, MEMORY]. * shares will be [.1, .5] and resourceOrder will be [CPU, MEMORY].
*/ */
@VisibleForTesting
void calculateShares(Resource resource, Resource pool, void calculateShares(Resource resource, Resource pool,
ResourceWeights shares, ResourceType[] resourceOrder, ResourceWeights weights) { ResourceWeights shares, ResourceType[] resourceOrder, ResourceWeights weights) {
shares.setWeight(MEMORY, (float)resource.getMemorySize() / shares.setWeight(MEMORY, (float)resource.getMemorySize() /