[
https://issues.apache.org/jira/browse/YARN-5605?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15508876#comment-15508876
]
ASF GitHub Bot commented on YARN-5605:
--------------------------------------
Github user kambatla commented on a diff in the pull request:
https://github.com/apache/hadoop/pull/124#discussion_r79765051
--- Diff:
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/FSStarvedApps.java
---
@@ -0,0 +1,72 @@
+/**
+ * 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 com.google.common.annotations.VisibleForTesting;
+import org.apache.hadoop.yarn.util.resource.Resources;
+
+import java.io.Serializable;
+import java.util.Comparator;
+import java.util.concurrent.PriorityBlockingQueue;
+
+/**
+ * Helper class to track starved apps.
+ *
+ * Initially, this uses a blocking queue. We could use other data
structures
+ * in the future. This class also has some methods to simplify testing.
+ */
+public class FSStarvedApps {
+ private int numAppsAddedSoFar;
+ private PriorityBlockingQueue<FSAppAttempt> apps;
+
+ public FSStarvedApps() {
+ apps = new PriorityBlockingQueue<>(10, new StarvationComparator());
+ }
+
+ public void addStarvedApp(FSAppAttempt app) {
+ if (!apps.contains(app)) {
+ apps.add(app);
+ numAppsAddedSoFar++;
+ }
+ }
+
+ public FSAppAttempt take() throws InterruptedException {
+ return apps.take();
+ }
+
+ private static class StarvationComparator implements
+ Comparator<FSAppAttempt>, Serializable {
+ private static final long serialVersionUID = 1;
+
+ @Override
+ public int compare(FSAppAttempt app1, FSAppAttempt app2) {
+ return Resources.fitsIn(app1.getStarvation(), app2.getStarvation())
+ ? -1 : 1;
--- End diff --
I don't understand the reasons, but fixing it anyway.
> Preempt containers (all on one node) to meet the requirement of starved
> applications
> ------------------------------------------------------------------------------------
>
> Key: YARN-5605
> URL: https://issues.apache.org/jira/browse/YARN-5605
> Project: Hadoop YARN
> Issue Type: Sub-task
> Components: fairscheduler
> Reporter: Karthik Kambatla
> Assignee: Karthik Kambatla
> Attachments: yarn-5605-1.patch, yarn-5605-2.patch, yarn-5605-3.patch
>
>
> Required items:
> # Identify starved applications
> # Identify a node that has enough containers from applications over their
> fairshare.
> # Preempt those containers
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]