hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From templ...@apache.org
Subject [50/50] [abbrv] hadoop git commit: YARN-6984. DominantResourceCalculator.isAnyMajorResourceZero() should test all resources (Contributed by Sunil G via Daniel Templeton)
Date Wed, 25 Oct 2017 23:14:42 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/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 <templedf@apache.org>
Authored: Tue Oct 24 10:04:36 2017 -0700
Committer: Daniel Templeton <templedf@apache.org>
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


Mime
View raw message