Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 98CCA200B9D for ; Wed, 7 Sep 2016 22:53:22 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 978C9160ABF; Wed, 7 Sep 2016 20:53:22 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id DA7E5160ACF for ; Wed, 7 Sep 2016 22:53:21 +0200 (CEST) Received: (qmail 96026 invoked by uid 500); 7 Sep 2016 20:53:21 -0000 Mailing-List: contact yarn-issues-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list yarn-issues@hadoop.apache.org Received: (qmail 95985 invoked by uid 99); 7 Sep 2016 20:53:20 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 07 Sep 2016 20:53:20 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 991152C1B80 for ; Wed, 7 Sep 2016 20:53:20 +0000 (UTC) Date: Wed, 7 Sep 2016 20:53:20 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: yarn-issues@hadoop.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (YARN-5605) Preempt containers (all on one node) to meet the requirement of starved applications MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Wed, 07 Sep 2016 20:53:22 -0000 [ https://issues.apache.org/jira/browse/YARN-5605?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15471764#comment-15471764 ] ASF GitHub Bot commented on YARN-5605: -------------------------------------- Github user templedf commented on a diff in the pull request: https://github.com/apache/hadoop/pull/124#discussion_r77901500 --- Diff: hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/FSPreemptionThread.java --- @@ -0,0 +1,173 @@ +/** + * 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.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.hadoop.yarn.api.records.ApplicationAttemptId; +import org.apache.hadoop.yarn.api.records.ContainerStatus; +import org.apache.hadoop.yarn.api.records.Resource; +import org.apache.hadoop.yarn.api.records.ResourceRequest; +import org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.RMContainer; +import org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.RMContainerEventType; +import org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerUtils; +import org.apache.hadoop.yarn.util.resource.Resources; + +import java.util.ArrayList; +import java.util.Comparator; +import java.util.List; +import java.util.Timer; +import java.util.TimerTask; + +/** + * Thread that handles FairScheduler preemption + */ +public class FSPreemptionThread extends Thread { + private static final Log LOG = LogFactory.getLog(FSPreemptionThread.class); + private final FSContext context; + private final FairScheduler scheduler; + private final long warnTimeBeforeKill; + private final Timer preemptionTimer; + + public FSPreemptionThread(FairScheduler scheduler) { + this.scheduler = scheduler; + this.context = scheduler.getContext(); + FairSchedulerConfiguration fsConf = scheduler.getConf(); + context.setPreemptionEnabled(); + context.setPreemptionUtilizationThreshold( + fsConf.getPreemptionUtilizationThreshold()); + warnTimeBeforeKill = fsConf.getWaitTimeBeforeKill(); + preemptionTimer = new Timer("Preemption Timer", true); + + setDaemon(true); + setName("FSPreemptionThread"); + } + + public void run() { + while (!Thread.interrupted()) { + FSAppAttempt starvedApp; + try{ + starvedApp = context.getStarvedApps().take(); + if (Resources.none().equals(starvedApp.getStarvation())) { --- End diff -- Feels like this should be a Resources.isNone() call. > 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 > > > 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: yarn-issues-unsubscribe@hadoop.apache.org For additional commands, e-mail: yarn-issues-help@hadoop.apache.org