This is an automated email from the ASF dual-hosted git repository.

abstractdog pushed a commit to branch branch-0.9
in repository https://gitbox.apache.org/repos/asf/tez.git


The following commit(s) were added to refs/heads/branch-0.9 by this push:
     new 0351e7f  TEZ-4366: Disk utilization limit fix should be applied to all 
tez mini clusters (#173)
0351e7f is described below

commit 0351e7f74ff3aede81fdb0aad0718ff4af1eccf3
Author: Bodor Laszlo <[email protected]>
AuthorDate: Fri Jan 21 18:09:49 2022 +0100

    TEZ-4366: Disk utilization limit fix should be applied to all tez mini 
clusters (#173)
    
    * TEZ-4366: Disk utilization limit fix should be applied to all tez mini 
clusters
---
 .../java/org/apache/tez/common/TezTestUtils.java   | 38 ++++++++++++++++++++++
 .../tez/tests/MiniTezClusterWithTimeline.java      |  7 ++++
 .../java/org/apache/tez/test/MiniTezCluster.java   |  6 ++--
 3 files changed, 47 insertions(+), 4 deletions(-)

diff --git a/tez-common/src/main/java/org/apache/tez/common/TezTestUtils.java 
b/tez-common/src/main/java/org/apache/tez/common/TezTestUtils.java
new file mode 100644
index 0000000..4b9d5c3
--- /dev/null
+++ b/tez-common/src/main/java/org/apache/tez/common/TezTestUtils.java
@@ -0,0 +1,38 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.tez.common;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.yarn.conf.YarnConfiguration;
+
+public class TezTestUtils {
+  /**
+   * Ensures a reasonably high limit for yarn disk utilization. This is very 
important for tests,
+   * as devs keep bumping into silent test hangs where yarn simply considers 
their machines as unhealthy,
+   * as the default limit is 90%, even if a machine with 90% full disk is 
still able to function.
+   * @param conf
+   */
+  public static void ensureHighDiskUtilizationLimit(Configuration conf) {
+    if (conf.getFloat(YarnConfiguration.NM_MAX_PER_DISK_UTILIZATION_PERCENTAGE,
+        YarnConfiguration.DEFAULT_NM_MAX_PER_DISK_UTILIZATION_PERCENTAGE) ==
+          YarnConfiguration.DEFAULT_NM_MAX_PER_DISK_UTILIZATION_PERCENTAGE) {
+      conf.setFloat(YarnConfiguration.NM_MAX_PER_DISK_UTILIZATION_PERCENTAGE, 
99.0f);
+    }
+  }
+}
diff --git 
a/tez-plugins/tez-yarn-timeline-history/src/test/java/org/apache/tez/tests/MiniTezClusterWithTimeline.java
 
b/tez-plugins/tez-yarn-timeline-history/src/test/java/org/apache/tez/tests/MiniTezClusterWithTimeline.java
index d13ebdb..f8a35a2 100644
--- 
a/tez-plugins/tez-yarn-timeline-history/src/test/java/org/apache/tez/tests/MiniTezClusterWithTimeline.java
+++ 
b/tez-plugins/tez-yarn-timeline-history/src/test/java/org/apache/tez/tests/MiniTezClusterWithTimeline.java
@@ -49,6 +49,7 @@ import org.apache.hadoop.yarn.conf.YarnConfiguration;
 import org.apache.hadoop.yarn.server.MiniYARNCluster;
 import org.apache.hadoop.yarn.server.nodemanager.ContainerExecutor;
 import org.apache.hadoop.yarn.server.nodemanager.DefaultContainerExecutor;
+import org.apache.tez.common.TezTestUtils;
 import org.apache.tez.dag.api.TezConfiguration;
 import org.apache.tez.dag.api.TezUncheckedException;
 import org.apache.tez.dag.app.DAGAppMaster;
@@ -93,6 +94,12 @@ public class MiniTezClusterWithTimeline extends 
MiniYARNCluster {
   }
 
   @Override
+  public void init(Configuration conf) {
+    TezTestUtils.ensureHighDiskUtilizationLimit(conf);
+    super.init(conf);
+  }
+
+  @Override
   public void serviceInit(Configuration conf) throws Exception {
     conf.set(MRConfig.FRAMEWORK_NAME, MRConfig.YARN_TEZ_FRAMEWORK_NAME);
     // Use libs from cluster since no build is available
diff --git a/tez-tests/src/test/java/org/apache/tez/test/MiniTezCluster.java 
b/tez-tests/src/test/java/org/apache/tez/test/MiniTezCluster.java
index 17c6885..9af1e60 100644
--- a/tez-tests/src/test/java/org/apache/tez/test/MiniTezCluster.java
+++ b/tez-tests/src/test/java/org/apache/tez/test/MiniTezCluster.java
@@ -50,6 +50,7 @@ import org.apache.hadoop.yarn.conf.YarnConfiguration;
 import org.apache.hadoop.yarn.server.MiniYARNCluster;
 import org.apache.hadoop.yarn.server.nodemanager.ContainerExecutor;
 import org.apache.hadoop.yarn.server.nodemanager.DefaultContainerExecutor;
+import org.apache.tez.common.TezTestUtils;
 import org.apache.tez.dag.api.TezConfiguration;
 import org.apache.tez.dag.api.TezUncheckedException;
 import org.apache.tez.dag.app.DAGAppMaster;
@@ -90,10 +91,7 @@ public class MiniTezCluster extends MiniYARNCluster {
 
   @Override
   public void init(Configuration conf) {
-    if (conf.getFloat(YarnConfiguration.NM_MAX_PER_DISK_UTILIZATION_PERCENTAGE,
-        YarnConfiguration.DEFAULT_NM_MAX_PER_DISK_UTILIZATION_PERCENTAGE) == 
YarnConfiguration.DEFAULT_NM_MAX_PER_DISK_UTILIZATION_PERCENTAGE) {
-      conf.setFloat(YarnConfiguration.NM_MAX_PER_DISK_UTILIZATION_PERCENTAGE, 
99.0f);
-    }
+    TezTestUtils.ensureHighDiskUtilizationLimit(conf);
     super.init(conf);
   }
 

Reply via email to