Repository: tez
Updated Branches:
  refs/heads/branch-0.8 68e016f77 -> ef5bd642f


TEZ-3337. Do not log empty fields of TaskAttemptFinishedEvent to avoid 
confusion. (Zhiyuan Yang via hitesh)

(cherry picked from commit e6be196951307057dc8561441996445232edfa24)

Conflicts:
        CHANGES.txt


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

Branch: refs/heads/branch-0.8
Commit: ef5bd642f364900854bea3f7246a0455fe1706ba
Parents: 68e016f
Author: Hitesh Shah <[email protected]>
Authored: Wed Jul 13 10:52:29 2016 -0700
Committer: Hitesh Shah <[email protected]>
Committed: Wed Jul 13 10:54:11 2016 -0700

----------------------------------------------------------------------
 CHANGES.txt                                     |  1 +
 .../events/TaskAttemptFinishedEvent.java        | 12 +++++------
 .../TestHistoryEventsProtoConversion.java       | 22 ++++++++++++++++++++
 3 files changed, 29 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tez/blob/ef5bd642/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 5ddc8e6..885abbc 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -7,6 +7,7 @@ INCOMPATIBLE CHANGES
 
 ALL CHANGES:
 
+  TEZ-3337. Do not log empty fields of TaskAttemptFinishedEvent to avoid 
confusion.
   TEZ-1248. Reduce slow-start should special case 1 reducer runs.
 
 Release 0.8.4: 2016-07-08

http://git-wip-us.apache.org/repos/asf/tez/blob/ef5bd642/tez-dag/src/main/java/org/apache/tez/dag/history/events/TaskAttemptFinishedEvent.java
----------------------------------------------------------------------
diff --git 
a/tez-dag/src/main/java/org/apache/tez/dag/history/events/TaskAttemptFinishedEvent.java
 
b/tez-dag/src/main/java/org/apache/tez/dag/history/events/TaskAttemptFinishedEvent.java
index 5a9d8c9..e9100e8 100644
--- 
a/tez-dag/src/main/java/org/apache/tez/dag/history/events/TaskAttemptFinishedEvent.java
+++ 
b/tez-dag/src/main/java/org/apache/tez/dag/history/events/TaskAttemptFinishedEvent.java
@@ -256,12 +256,12 @@ public class TaskAttemptFinishedEvent implements 
HistoryEvent {
         + ", finishTime=" + finishTime
         + ", timeTaken=" + (finishTime - startTime)
         + ", status=" + state.name()
-        + ", taskFailureType=" + taskFailureType
-        + ", errorEnum=" + (error != null ? error.name() : "")
-        + ", diagnostics=" + diagnostics
-        + ", containerId=" + (containerId != null ? containerId.toString() : 
"")
-        + ", nodeId=" + (nodeId != null ? nodeId.toString() : "")
-        + ", nodeHttpAddress=" + (nodeHttpAddress != null ? nodeHttpAddress : 
"")
+        + (taskFailureType != null ? ", taskFailureType=" + taskFailureType : 
"")
+        + (error != null ? ", errorEnum=" + error.name() : "")
+        + (diagnostics != null ? ", diagnostics=" + diagnostics : "")
+        + (containerId != null ? ", containerId=" + containerId.toString() : 
"")
+        + (nodeId != null ? ", nodeId=" + nodeId.toString() : "")
+        + (nodeHttpAddress != null ? ", nodeHttpAddress=" + nodeHttpAddress : 
"")
         + counterStr;
   }
 

http://git-wip-us.apache.org/repos/asf/tez/blob/ef5bd642/tez-dag/src/test/java/org/apache/tez/dag/history/events/TestHistoryEventsProtoConversion.java
----------------------------------------------------------------------
diff --git 
a/tez-dag/src/test/java/org/apache/tez/dag/history/events/TestHistoryEventsProtoConversion.java
 
b/tez-dag/src/test/java/org/apache/tez/dag/history/events/TestHistoryEventsProtoConversion.java
index 7d3faf9..67a927e 100644
--- 
a/tez-dag/src/test/java/org/apache/tez/dag/history/events/TestHistoryEventsProtoConversion.java
+++ 
b/tez-dag/src/test/java/org/apache/tez/dag/history/events/TestHistoryEventsProtoConversion.java
@@ -18,6 +18,7 @@
 
 package org.apache.tez.dag.history.events;
 
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.fail;
 
 import java.nio.ByteBuffer;
@@ -622,6 +623,27 @@ public class TestHistoryEventsProtoConversion {
       Assert.assertEquals(event.getTaskFailureType(), 
deserializedEvent.getTaskFailureType());
       logEvents(event, deserializedEvent);
     }
+    {
+      // toString shouldn't include null fields
+      TezTaskAttemptID taId =
+        
TezTaskAttemptID.getInstance(TezTaskID.getInstance(TezVertexID.getInstance(
+          TezDAGID.getInstance(ApplicationId.newInstance(0, 1), 1), 111), 0), 
0);
+      long timestamp = 1024L;
+      List<DataEventDependencyInfo> events = Lists.newArrayList();
+      events.add(new DataEventDependencyInfo(timestamp, taId));
+      events.add(new DataEventDependencyInfo(timestamp, taId));
+      TaskAttemptFinishedEvent event = new TaskAttemptFinishedEvent(
+        
TezTaskAttemptID.getInstance(TezTaskID.getInstance(TezVertexID.getInstance(
+          TezDAGID.getInstance(ApplicationId.newInstance(0, 1), 1), 111), 1), 
1),
+        "vertex1", 10001l, 1000434444l, TaskAttemptState.SUCCEEDED, null, null,
+        null, new TezCounters(), events, null, 0, null, 0, null, null, null, 
null, null);
+      String eventStr = event.toString();
+      String[] items = new String[] {"taskFailureType", "errorEnum", 
"diagnostics", "containerId",
+          "nodeId", "nodeHttpAddress"};
+      for (String item : items) {
+        assertFalse(eventStr.contains(item));
+      }
+    }
   }
 
   @SuppressWarnings("deprecation")

Reply via email to