hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From templ...@apache.org
Subject [38/44] hadoop git commit: YARN-6984. DominantResourceCalculator.isAnyMajorResourceZero() should test all resources (Contributed by Sunil G via Daniel Templeton)
Date Tue, 31 Oct 2017 22:08:39 GMT
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/c818c852
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/c818c852
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/c818c852

Branch: refs/heads/branch-3.0
Commit: c818c85238b91407e41f3b29a888394170ff447a
Parents: 6858515
Author: Daniel Templeton <templedf@apache.org>
Authored: Tue Oct 24 10:04:36 2017 -0700
Committer: Daniel Templeton <templedf@apache.org>
Committed: Tue Oct 31 15:06:18 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/c818c852/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


Mime
View raw message