tez-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hit...@apache.org
Subject tez git commit: TEZ-2874. Improved logging for caller context. (hitesh)
Date Sat, 10 Oct 2015 02:45:19 GMT
Repository: tez
Updated Branches:
  refs/heads/branch-0.7 8d49fd528 -> aeb50ab22


TEZ-2874. Improved logging for caller context. (hitesh)

(cherry picked from commit 327e02a761eb01c74acdf5b7af65f79e23b4e28b)

Conflicts:
	CHANGES.txt
	tez-api/src/main/java/org/apache/tez/client/TezClient.java
	tez-api/src/main/java/org/apache/tez/dag/api/DAG.java


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

Branch: refs/heads/branch-0.7
Commit: aeb50ab224b47acfd289fd78da076bea6865b3c1
Parents: 8d49fd5
Author: Hitesh Shah <hitesh@apache.org>
Authored: Fri Oct 9 19:35:05 2015 -0700
Committer: Hitesh Shah <hitesh@apache.org>
Committed: Fri Oct 9 19:42:25 2015 -0700

----------------------------------------------------------------------
 CHANGES.txt                                        |  1 +
 .../java/org/apache/tez/client/CallerContext.java  | 13 +++++++++++--
 .../main/java/org/apache/tez/client/TezClient.java | 17 +++++++++++++----
 .../src/main/java/org/apache/tez/dag/api/DAG.java  |  6 ++++++
 .../test/java/org/apache/tez/dag/api/TestDAG.java  | 15 ++++++++-------
 .../java/org/apache/tez/dag/app/DAGAppMaster.java  |  2 +-
 6 files changed, 40 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tez/blob/aeb50ab2/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index d67f70e..6459dfd 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -6,6 +6,7 @@ Release 0.7.1: Unreleased
 INCOMPATIBLE CHANGES
 
 ALL CHANGES
+  TEZ-2874. Improved logging for caller context.
   TEZ-2781. Fallback to send only TaskAttemptFailedEvent if taskFailed heartbeat fails
   TEZ-2868. Fix setting Caller Context in Tez Examples.
   TEZ-2860. NPE in DAGClientImpl.

http://git-wip-us.apache.org/repos/asf/tez/blob/aeb50ab2/tez-api/src/main/java/org/apache/tez/client/CallerContext.java
----------------------------------------------------------------------
diff --git a/tez-api/src/main/java/org/apache/tez/client/CallerContext.java b/tez-api/src/main/java/org/apache/tez/client/CallerContext.java
index ba68851..809cf47 100644
--- a/tez-api/src/main/java/org/apache/tez/client/CallerContext.java
+++ b/tez-api/src/main/java/org/apache/tez/client/CallerContext.java
@@ -162,10 +162,19 @@ public class CallerContext {
 
   @Override
   public String toString() {
-    return "context=" + context
+    return "{ context=" + context
         + ", callerType=" + callerType
         + ", callerId=" + callerId
-        + ", blob=" + blob;
+        + ", blob=" + blob
+        + " }";
   }
 
+  public String contextAsSimpleString() {
+    return "{ context=" + context
+        + ", callerType=" + callerType
+        + ", callerId=" + callerId
+        + " }";
+  }
+
+
 }

http://git-wip-us.apache.org/repos/asf/tez/blob/aeb50ab2/tez-api/src/main/java/org/apache/tez/client/TezClient.java
----------------------------------------------------------------------
diff --git a/tez-api/src/main/java/org/apache/tez/client/TezClient.java b/tez-api/src/main/java/org/apache/tez/client/TezClient.java
index da31141..692e11d 100644
--- a/tez-api/src/main/java/org/apache/tez/client/TezClient.java
+++ b/tez-api/src/main/java/org/apache/tez/client/TezClient.java
@@ -56,7 +56,6 @@ import org.apache.tez.dag.api.TezConfiguration;
 import org.apache.tez.dag.api.TezConstants;
 import org.apache.tez.dag.api.TezException;
 import org.apache.tez.dag.api.TezReflectionException;
-import org.apache.tez.dag.api.TezUncheckedException;
 import org.apache.tez.dag.api.client.DAGClient;
 import org.apache.tez.dag.api.client.rpc.DAGClientAMProtocolBlockingPB;
 import org.apache.tez.dag.api.client.rpc.DAGClientAMProtocolRPC.GetAMStatusRequestProto;
@@ -431,10 +430,15 @@ public class TezClient {
     verifySessionStateForSubmission();
 
     String dagId = null;
+    String callerContextStr = "";
+    if (dag.getCallerContext() != null) {
+      callerContextStr = ", callerContext=" + dag.getCallerContext().contextAsSimpleString();
+    }
     LOG.info("Submitting dag to TezSession"
       + ", sessionName=" + clientName
       + ", applicationId=" + sessionAppId
-      + ", dagName=" + dag.getName());
+      + ", dagName=" + dag.getName()
+      + callerContextStr);
     
     if (!additionalLocalResources.isEmpty()) {
       for (LocalResource lr : additionalLocalResources.values()) {
@@ -834,13 +838,18 @@ public class TezClient {
       // Add credentials for tez-local resources.
       Map<String, LocalResource> tezJarResources = getTezJarResources(credentials);
       ApplicationSubmissionContext appContext = TezClientUtils
-          .createApplicationSubmissionContext( 
+          .createApplicationSubmissionContext(
               appId, dag, dag.getName(), amConfig, tezJarResources, credentials,
               usingTezArchiveDeploy, apiVersionInfo, historyACLPolicyManager,
               javaOptsChecker);
+      String callerContextStr = "";
+      if (dag.getCallerContext() != null) {
+        callerContextStr = ", callerContext=" + dag.getCallerContext().contextAsSimpleString();
+      }
       LOG.info("Submitting DAG to YARN"
           + ", applicationId=" + appId
-          + ", dagName=" + dag.getName());
+          + ", dagName=" + dag.getName()
+          + callerContextStr);
       
       frameworkClient.submitApplication(appContext);
       ApplicationReport appReport = frameworkClient.getApplicationReport(appId);

http://git-wip-us.apache.org/repos/asf/tez/blob/aeb50ab2/tez-api/src/main/java/org/apache/tez/dag/api/DAG.java
----------------------------------------------------------------------
diff --git a/tez-api/src/main/java/org/apache/tez/dag/api/DAG.java b/tez-api/src/main/java/org/apache/tez/dag/api/DAG.java
index 0b205bf..be75dda 100644
--- a/tez-api/src/main/java/org/apache/tez/dag/api/DAG.java
+++ b/tez-api/src/main/java/org/apache/tez/dag/api/DAG.java
@@ -975,4 +975,10 @@ public class DAG {
     
     return dagBuilder.build();
   }
+
+
+  public synchronized CallerContext getCallerContext() {
+    return this.callerContext;
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/tez/blob/aeb50ab2/tez-api/src/test/java/org/apache/tez/dag/api/TestDAG.java
----------------------------------------------------------------------
diff --git a/tez-api/src/test/java/org/apache/tez/dag/api/TestDAG.java b/tez-api/src/test/java/org/apache/tez/dag/api/TestDAG.java
index e4a78c4..aeef846 100644
--- a/tez-api/src/test/java/org/apache/tez/dag/api/TestDAG.java
+++ b/tez-api/src/test/java/org/apache/tez/dag/api/TestDAG.java
@@ -311,24 +311,25 @@ public class TestDAG {
 
   @Test
   public void testCallerContext() {
-    DAG dag = DAG.create("dag1");
     try {
-      CallerContext callerContext = CallerContext.create("ctxt", "", "", "desc");
+      CallerContext.create("ctxt", "", "", "desc");
       Assert.fail("Expected failure for invalid args");
     } catch (Exception e) {
       // Expected
     }
     try {
-      CallerContext callerContext = CallerContext.create("", "desc");
+      CallerContext.create("", "desc");
       Assert.fail("Expected failure for invalid args");
     } catch (Exception e) {
       // Expected
     }
 
-    CallerContext callerContext;
-    callerContext = CallerContext.create("ctxt", "a", "a", "desc");
-    callerContext = CallerContext.create("ctxt", "desc");
-    callerContext = CallerContext.create("ctxt", null);
+    CallerContext.create("ctxt", "a", "a", "desc");
+    CallerContext.create("ctxt", null);
+
+    CallerContext callerContext = CallerContext.create("ctxt", "desc");
+    Assert.assertTrue(callerContext.toString().contains("desc"));
+    Assert.assertFalse(callerContext.contextAsSimpleString().contains("desc"));
 
   }
 

http://git-wip-us.apache.org/repos/asf/tez/blob/aeb50ab2/tez-dag/src/main/java/org/apache/tez/dag/app/DAGAppMaster.java
----------------------------------------------------------------------
diff --git a/tez-dag/src/main/java/org/apache/tez/dag/app/DAGAppMaster.java b/tez-dag/src/main/java/org/apache/tez/dag/app/DAGAppMaster.java
index 59b2841..bd16526 100644
--- a/tez-dag/src/main/java/org/apache/tez/dag/app/DAGAppMaster.java
+++ b/tez-dag/src/main/java/org/apache/tez/dag/app/DAGAppMaster.java
@@ -2224,7 +2224,7 @@ public class DAGAppMaster extends AbstractService {
     if (dagPlan.hasCallerContext()) {
       CallerContext callerContext = DagTypeConverters.convertCallerContextFromProto(
           dagPlan.getCallerContext());
-      callerContextStr = ", callerContext=" + callerContext.toString();
+      callerContextStr = ", callerContext=" + callerContext.contextAsSimpleString();
     }
     LOG.info("Running DAG: " + dagPlan.getName() + callerContextStr);
 


Mime
View raw message