tez-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ss...@apache.org
Subject tez git commit: TEZ-1878. Task-specific log level override not working in certain conditions. (sseth)
Date Mon, 22 Dec 2014 21:03:18 GMT
Repository: tez
Updated Branches:
  refs/heads/branch-0.5 599bb0fe2 -> c89b72e0e


TEZ-1878. Task-specific log level override not working in certain
conditions. (sseth)


Project: http://git-wip-us.apache.org/repos/asf/tez/repo
Commit: http://git-wip-us.apache.org/repos/asf/tez/commit/c89b72e0
Tree: http://git-wip-us.apache.org/repos/asf/tez/tree/c89b72e0
Diff: http://git-wip-us.apache.org/repos/asf/tez/diff/c89b72e0

Branch: refs/heads/branch-0.5
Commit: c89b72e0e59e9d890429a4f47f399e860b3c055c
Parents: 599bb0f
Author: Siddharth Seth <sseth@apache.org>
Authored: Mon Dec 22 13:03:15 2014 -0800
Committer: Siddharth Seth <sseth@apache.org>
Committed: Mon Dec 22 13:03:15 2014 -0800

----------------------------------------------------------------------
 CHANGES.txt                                     |  1 +
 .../apache/tez/dag/app/dag/impl/VertexImpl.java |  7 +--
 .../tez/dag/app/dag/impl/TestVertexImpl2.java   | 66 ++++++++++++++++++++
 3 files changed, 70 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tez/blob/c89b72e0/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 8dc8aaa..e62f807 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -4,6 +4,7 @@ Apache Tez Change Log
 Release 0.5.4: Unreleased
 
 ALL CHANGES:
+  TEZ-1878. Task-specific log level override not working in certain conditions.
   TEZ-1775. Allow setting log level per logger.
   TEZ-1851. FileSystem counters do not differentiate between different FileSystems.
   TEZ-1852. Get examples to work in LocalMode.

http://git-wip-us.apache.org/repos/asf/tez/blob/c89b72e0/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/VertexImpl.java
----------------------------------------------------------------------
diff --git a/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/VertexImpl.java b/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/VertexImpl.java
index 9137b1e..e8e6734 100644
--- a/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/VertexImpl.java
+++ b/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/VertexImpl.java
@@ -771,12 +771,11 @@ public class VertexImpl implements org.apache.tez.dag.app.dag.Vertex,
       String [] taskLogParamsTaskSpecific = taskSpecificLaunchCmdOption.getTaskSpecificLogParams();
       this.javaOptsTaskSpecific = TezClientUtils
           .maybeAddDefaultLoggingJavaOpts(taskLogParamsTaskSpecific[0], javaOptsWithoutLoggerMods);
+
+      environmentTaskSpecific = new HashMap<String, String>(this.environment.size());
+      environmentTaskSpecific.putAll(environment);
       if (taskLogParamsTaskSpecific.length == 2 && !Strings.isNullOrEmpty(taskLogParamsTaskSpecific[1]))
{
-        environmentTaskSpecific = new HashMap<String, String>(this.environment.size());
-        environmentTaskSpecific.putAll(environment);
         TezClientUtils.addLogParamsToEnv(environmentTaskSpecific, taskLogParamsTaskSpecific);
-      } else {
-        environmentTaskSpecific = null;
       }
     } else {
       this.javaOptsTaskSpecific = null;

http://git-wip-us.apache.org/repos/asf/tez/blob/c89b72e0/tez-dag/src/test/java/org/apache/tez/dag/app/dag/impl/TestVertexImpl2.java
----------------------------------------------------------------------
diff --git a/tez-dag/src/test/java/org/apache/tez/dag/app/dag/impl/TestVertexImpl2.java b/tez-dag/src/test/java/org/apache/tez/dag/app/dag/impl/TestVertexImpl2.java
index 80fa86a..b4064a0 100644
--- a/tez-dag/src/test/java/org/apache/tez/dag/app/dag/impl/TestVertexImpl2.java
+++ b/tez-dag/src/test/java/org/apache/tez/dag/app/dag/impl/TestVertexImpl2.java
@@ -183,6 +183,72 @@ public class TestVertexImpl2 {
     }
   }
 
+  @Test(timeout = 5000)
+  public void testTaskSpecificLoggingOpts2() {
+
+    String vertexName = "testvertex";
+    String customJavaOpts = "-Xmx128m";
+
+    Configuration conf = new TezConfiguration();
+    conf.set(TezConfiguration.TEZ_TASK_LOG_LEVEL, "WARN;org.apache.tez=INFO");
+    conf.set(TezConfiguration.TEZ_TASK_SPECIFIC_LAUNCH_CMD_OPTS_LIST, vertexName + "[0,1,2]");
+    conf.set(TezConfiguration.TEZ_TASK_SPECIFIC_LOG_LEVEL, "DEBUG");
+    conf.set(TezConfiguration.TEZ_TASK_SPECIFIC_LAUNCH_CMD_OPTS, customJavaOpts);
+
+    LogTestInfoHolder testInfo = new LogTestInfoHolder(conf);
+
+    // Expected command opts for regular tasks
+    List<String> expectedCommands = new LinkedList<String>();
+    expectedCommands.add("-Dlog4j.configuratorClass=org.apache.tez.common.TezLog4jConfigurator");
+    expectedCommands.add("-Dlog4j.configuration=" + TezConstants.TEZ_CONTAINER_LOG4J_PROPERTIES_FILE);
+    expectedCommands.add("-D" + YarnConfiguration.YARN_APP_CONTAINER_LOG_DIR + "=" +
+        ApplicationConstants.LOG_DIR_EXPANSION_VAR);
+    expectedCommands.add("-D" + TezConstants.TEZ_ROOT_LOGGER_NAME + "=" + "WARN" + "," +
+        TezConstants.TEZ_CONTAINER_LOGGER_NAME);
+
+    for (int i = 3 ; i < testInfo.numTasks ; i++) {
+      ContainerContext containerContext = testInfo.vertex.getContainerContext(i);
+      String javaOpts = containerContext.getJavaOpts();
+
+      assertTrue(javaOpts.contains(testInfo.initialJavaOpts));
+      for (String expectedCmd : expectedCommands) {
+        assertTrue(javaOpts.contains(expectedCmd));
+      }
+
+      Map<String, String> env = containerContext.getEnvironment();
+      String val = env.get(testInfo.envKey);
+      assertEquals(testInfo.envVal, val);
+      String logEnvVal = env.get(TezConstants.TEZ_CONTAINER_LOG_PARAMS);
+      assertEquals("org.apache.tez=INFO", logEnvVal);
+    }
+
+    // Expected command opts for instrumented tasks.
+    expectedCommands = new LinkedList<String>();
+    expectedCommands.add("-Dlog4j.configuratorClass=org.apache.tez.common.TezLog4jConfigurator");
+    expectedCommands.add("-Dlog4j.configuration=" + TezConstants.TEZ_CONTAINER_LOG4J_PROPERTIES_FILE);
+    expectedCommands.add("-D" + YarnConfiguration.YARN_APP_CONTAINER_LOG_DIR + "=" +
+        ApplicationConstants.LOG_DIR_EXPANSION_VAR);
+    expectedCommands.add("-D" + TezConstants.TEZ_ROOT_LOGGER_NAME + "=" + "DEBUG" + "," +
+        TezConstants.TEZ_CONTAINER_LOGGER_NAME);
+
+    for (int i = 0 ; i < 3 ; i++) {
+      ContainerContext containerContext = testInfo.vertex.getContainerContext(i);
+      String javaOpts = containerContext.getJavaOpts();
+
+      assertTrue(javaOpts.contains(testInfo.initialJavaOpts));
+      for (String expectedCmd : expectedCommands) {
+        assertTrue(javaOpts.contains(expectedCmd));
+      }
+
+      Map<String, String> env = containerContext.getEnvironment();
+      String val = env.get(testInfo.envKey);
+      assertEquals(testInfo.envVal, val);
+      String logEnvVal = env.get(TezConstants.TEZ_CONTAINER_LOG_PARAMS);
+      assertNull(logEnvVal);
+    }
+  }
+
+
   private static class LogTestInfoHolder {
 
     final AppContext mockAppContext;


Mime
View raw message