[ https://issues.apache.org/jira/browse/YARN-2162?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16135346#comment-16135346 ]
ASF GitHub Bot commented on YARN-2162: -------------------------------------- Github user kambatla commented on a diff in the pull request: https://github.com/apache/hadoop/pull/261#discussion_r133308854 --- Diff: hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/ResourceConfiguration.java --- @@ -0,0 +1,71 @@ +/** + * 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 org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair; + +import org.apache.hadoop.classification.InterfaceAudience.Private; +import org.apache.hadoop.classification.InterfaceStability.Unstable; +import org.apache.hadoop.yarn.api.records.Resource; +import org.apache.hadoop.yarn.server.resourcemanager.resource.ResourceType; + +import java.util.HashMap; + +/** + * A ResourceConfiguration represents an entity that is used to configuration + * resources, such as maximum resources of a queue. It can be percentage of + * cluster resources or an absolute value. + */ +@Private +@Unstable +public class ResourceConfiguration { + private final boolean isPercentage; + private final Resource resource; + private final HashMap<ResourceType, Double> percentages; + + public boolean isPercentage() { + return isPercentage; + } + + public ResourceConfiguration(HashMap<ResourceType, Double> percentages) { + isPercentage = true; + this.percentages = percentages; + this.resource = null; + } + + public ResourceConfiguration(Resource resource) { + isPercentage = false; + this.percentages = null; + this.resource = resource; + } + + public Resource getResource(Resource clusterResource) { --- End diff -- I think there should be a single getResource method. I am divided between explicitly passing clusterResource as an arg vs passing FSContext or some such that you could get the cluster resource from lazily if required. > add ability in Fair Scheduler to optionally configure maxResources in terms > of percentage > ----------------------------------------------------------------------------------------- > > Key: YARN-2162 > URL: https://issues.apache.org/jira/browse/YARN-2162 > Project: Hadoop YARN > Issue Type: Improvement > Components: fairscheduler, scheduler > Reporter: Ashwin Shankar > Assignee: Yufei Gu > Labels: scheduler > Attachments: YARN-2162.001.patch, YARN-2162.002.patch > > > minResources and maxResources in fair scheduler configs are expressed in > terms of absolute numbers X mb, Y vcores. > As a result, when we expand or shrink our hadoop cluster, we need to > recalculate and change minResources/maxResources accordingly, which is pretty > inconvenient. > We can circumvent this problem if we can optionally configure these > properties in terms of percentage of cluster capacity. -- This message was sent by Atlassian JIRA (v6.4.14#64029) --------------------------------------------------------------------- To unsubscribe, e-mail: yarn-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: yarn-issues-h...@hadoop.apache.org