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 30BDE200D4C for ; Thu, 26 Oct 2017 01:14:12 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 2F5E0160BF3; Wed, 25 Oct 2017 23:14:12 +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 721AC160BF2 for ; Thu, 26 Oct 2017 01:14:11 +0200 (CEST) Received: (qmail 55212 invoked by uid 500); 25 Oct 2017 23:13:56 -0000 Mailing-List: contact common-commits-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list common-commits@hadoop.apache.org Received: (qmail 53896 invoked by uid 99); 25 Oct 2017 23:13:56 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 25 Oct 2017 23:13:56 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 1D6C2E04E9; Wed, 25 Oct 2017 23:13:54 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: templedf@apache.org To: common-commits@hadoop.apache.org Date: Wed, 25 Oct 2017 23:14:42 -0000 Message-Id: <4f374bef581548f789fbe8bede27b148@git.apache.org> In-Reply-To: <7883c3ead2e84647abaa496d527afb46@git.apache.org> References: <7883c3ead2e84647abaa496d527afb46@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [50/50] [abbrv] hadoop git commit: YARN-6984. DominantResourceCalculator.isAnyMajorResourceZero() should test all resources (Contributed by Sunil G via Daniel Templeton) archived-at: Wed, 25 Oct 2017 23:14:12 -0000 YARN-6984. DominantResourceCalculator.isAnyMajorResourceZero() should test all resources (Contributed by Sunil G via Daniel Templeton) (cherry picked from commit 679f99b1455a1fcd785aef8ddc705f63cf0e6518) Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/2041448a Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/2041448a Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/2041448a Branch: refs/heads/resource-types Commit: 2041448a9d2fbb1b073005c5100dd8ea97ca148b Parents: 0bc3c9f Author: Daniel Templeton Authored: Tue Oct 24 10:04:36 2017 -0700 Committer: Daniel Templeton Committed: Wed Oct 25 16:09:33 2017 -0700 ---------------------------------------------------------------------- .../yarn/util/resource/DominantResourceCalculator.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/2041448a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/resource/DominantResourceCalculator.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/resource/DominantResourceCalculator.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/resource/DominantResourceCalculator.java index ca828a5..6b284e3 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/resource/DominantResourceCalculator.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/resource/DominantResourceCalculator.java @@ -557,6 +557,14 @@ public class DominantResourceCalculator extends ResourceCalculator { @Override public boolean isAnyMajorResourceZero(Resource resource) { - return resource.getMemorySize() == 0f || resource.getVirtualCores() == 0; + int maxLength = ResourceUtils.getNumberOfKnownResourceTypes(); + for (int i = 0; i < maxLength; i++) { + ResourceInformation resourceInformation = resource + .getResourceInformation(i); + if (resourceInformation.getValue() == 0L) { + return true; + } + } + return false; } } --------------------------------------------------------------------- To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org For additional commands, e-mail: common-commits-help@hadoop.apache.org