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 343842004A0 for ; Wed, 16 Aug 2017 18:01:18 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 3231B168F70; Wed, 16 Aug 2017 16:01:18 +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 79907168F6D for ; Wed, 16 Aug 2017 18:01:17 +0200 (CEST) Received: (qmail 99188 invoked by uid 500); 16 Aug 2017 16:01:14 -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 99175 invoked by uid 99); 16 Aug 2017 16:01:14 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 16 Aug 2017 16:01:14 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 217321805C2 for ; Wed, 16 Aug 2017 16:01:14 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -99.202 X-Spam-Level: X-Spam-Status: No, score=-99.202 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id 0CE0kJ_5M1ii for ; Wed, 16 Aug 2017 16:01:13 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id 94C4A5F6C4 for ; Wed, 16 Aug 2017 16:01:12 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 8A038E0EAC for ; Wed, 16 Aug 2017 16:01:10 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 75EA225387 for ; Wed, 16 Aug 2017 16:01:07 +0000 (UTC) Date: Wed, 16 Aug 2017 16:01:07 +0000 (UTC) From: "Eric Badger (JIRA)" To: yarn-issues@hadoop.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (YARN-6930) Admins should be able to explicitly enable specific LinuxContainerRuntime in the NodeManager MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Wed, 16 Aug 2017 16:01:18 -0000 [ https://issues.apache.org/jira/browse/YARN-6930?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16128993#comment-16128993 ] Eric Badger commented on YARN-6930: ----------------------------------- The findbugs isn't related to this JIRA, butI think it's something that we should fix. We can just make {{CGROUPS_ROOT_DIRECTORY}} another NM config. DelegatingLinuxContainerRuntime.java {noformat} @@ -31,8 +32,13 @@ import org.apache.hadoop.yarn.server.nodemanager.containermanager.runtime.ContainerRuntime; import org.apache.hadoop.yarn.server.nodemanager.containermanager.runtime.ContainerRuntimeContext; +import java.util.Arrays; +import java.util.List; import java.util.Map; +import static org.apache.hadoop.yarn.conf.YarnConfiguration.DEFAULT_LINUX_CONTAINER_RUNTIME_ALLOWED_RUNTIMES; +import static org.apache.hadoop.yarn.conf.YarnConfiguration.LINUX_CONTAINER_RUNTIME_ALLOWED_RUNTIMES; + {noformat} Not sure of the convention here. Is it ok to import static variables one by one or should we just import {{YarnConfiguration}} and reference the variables specifically? {noformat} @@ -50,25 +56,35 @@ private DefaultLinuxContainerRuntime defaultLinuxContainerRuntime; private DockerLinuxContainerRuntime dockerLinuxContainerRuntime; private JavaSandboxLinuxContainerRuntime javaSandboxLinuxContainerRuntime; + private List allowedRuntimes; @Override public void initialize(Configuration conf) throws ContainerExecutionException { + allowedRuntimes = Arrays.asList( + conf.getTrimmedStrings(LINUX_CONTAINER_RUNTIME_ALLOWED_RUNTIMES, + DEFAULT_LINUX_CONTAINER_RUNTIME_ALLOWED_RUNTIMES)); PrivilegedOperationExecutor privilegedOperationExecutor = PrivilegedOperationExecutor.getInstance(conf); defaultLinuxContainerRuntime = new DefaultLinuxContainerRuntime( privilegedOperationExecutor); - defaultLinuxContainerRuntime.initialize(conf); + if (isRuntimeAllowed(defaultLinuxContainerRuntime)) { + defaultLinuxContainerRuntime.initialize(conf); + } dockerLinuxContainerRuntime = new DockerLinuxContainerRuntime( privilegedOperationExecutor); - dockerLinuxContainerRuntime.initialize(conf); + if (isRuntimeAllowed(dockerLinuxContainerRuntime)) { + dockerLinuxContainerRuntime.initialize(conf); + } javaSandboxLinuxContainerRuntime = new JavaSandboxLinuxContainerRuntime( privilegedOperationExecutor); - javaSandboxLinuxContainerRuntime.initialize(conf); + if (isRuntimeAllowed(javaSandboxLinuxContainerRuntime)) { + javaSandboxLinuxContainerRuntime.initialize(conf); + } {noformat} It would save us a little bit of time and memory {{isRuntimeAllowed}} took the class name directly. That way we could check to see if the runtime is allowed before we allocate it. I also wonder whether it would be better/cleaner to iterate through {{allowedRuntimes}} and allocate the new objects by class name via reflection instead of hard-coding all of them. There's probably a reason why this is a terrible idea, but it's a thought. > Admins should be able to explicitly enable specific LinuxContainerRuntime in the NodeManager > -------------------------------------------------------------------------------------------- > > Key: YARN-6930 > URL: https://issues.apache.org/jira/browse/YARN-6930 > Project: Hadoop YARN > Issue Type: Improvement > Components: nodemanager > Reporter: Vinod Kumar Vavilapalli > Assignee: Shane Kumpf > Attachments: YARN-6930.001.patch, YARN-6930.002.patch, YARN-6930.003.patch > > > Today, in the java land, all LinuxContainerRuntimes are always enabled when using LinuxContainerExecutor and the user can simply invoke anything that he/she wants - default, docker, java-sandbox. > We should have a way for admins to explicitly enable only specific runtimes that he/she decides for the cluster. And by default, we should have everything other than the default one disabled. -- This message was sent by Atlassian JIRA (v6.4.14#64029) --------------------------------------------------------------------- To unsubscribe, e-mail: yarn-issues-unsubscribe@hadoop.apache.org For additional commands, e-mail: yarn-issues-help@hadoop.apache.org