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 39DED200BB8 for ; Sat, 29 Oct 2016 04:59:00 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 3884D160AF5; Sat, 29 Oct 2016 02:59:00 +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 7DE5B160AE4 for ; Sat, 29 Oct 2016 04:58:59 +0200 (CEST) Received: (qmail 88909 invoked by uid 500); 29 Oct 2016 02:58:58 -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 88898 invoked by uid 99); 29 Oct 2016 02:58:58 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 29 Oct 2016 02:58:58 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 5E2ED2C1F5A for ; Sat, 29 Oct 2016 02:58:58 +0000 (UTC) Date: Sat, 29 Oct 2016 02:58:58 +0000 (UTC) From: "Tsuyoshi Ozawa (JIRA)" To: yarn-issues@hadoop.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (YARN-5746) The state of the parentQueue and its childQueues should be synchronized. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Sat, 29 Oct 2016 02:59:00 -0000 [ https://issues.apache.org/jira/browse/YARN-5746?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15617279#comment-15617279 ] Tsuyoshi Ozawa commented on YARN-5746: -------------------------------------- [~xgong] thanks for taking this issue. {code} public QueueState getConfiguredState(String queue) { String state = get(getQueuePrefix(queue) + STATE); if (state == null) { return null; } else { return QueueState.valueOf(StringUtils.toUpperCase(state)); } {code} It's a bit difficult to understand what the state of "null" mean. I would like to suggest that we create new state, QueueState.NOT_FOUND, and return it instead of returning null. What do you think? {quote} Let's collapse these nested conditionals into an else if: {quote} +1 In addition to Daniel's comments, how about adding new private method to wrap up the following routine? {code} if (parent != null) { QueueState configuredState = csContext.getConfiguration() .getConfiguredState(getQueuePath()); QueueState parentState = parent.getState(); if (configuredState == null) { this.state = parentState; } else { if (configuredState == QueueState.RUNNING && parentState == QueueState.STOPPED) { throw new IllegalArgumentException( "Illegal" + " State of " + configuredState + " for children of queue: " + queueName + ". The state of its parent queue: " + parent.getQueueName() + " is " + parentState); } else { this.state = configuredState; } } } else { // if this is the root queue, get the state from the configuration. // if the state is not set, use RUNNING as default state. this.state = csContext.getConfiguration().getState(getQueuePath()); } {code} > The state of the parentQueue and its childQueues should be synchronized. > ------------------------------------------------------------------------ > > Key: YARN-5746 > URL: https://issues.apache.org/jira/browse/YARN-5746 > Project: Hadoop YARN > Issue Type: Sub-task > Components: capacity scheduler, resourcemanager > Reporter: Xuan Gong > Assignee: Xuan Gong > Labels: oct16-easy > Attachments: YARN-5746.1.patch, YARN-5746.2.patch > > > The state of the parentQueue and its childQeues need to be synchronized. > * If the state of the parentQueue becomes STOPPED, the state of its childQueue need to become STOPPED as well. > * If we change the state of the queue to RUNNING, we should make sure the state of all its ancestor must be RUNNING. Otherwise, we need to fail this operation. -- 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