Repository: tez Updated Branches: refs/heads/master d22389cc2 -> b63d7faf5
TEZ-3246. Improve diagnostics when DAG killed by user (Eric Badger via jlowe) Project: http://git-wip-us.apache.org/repos/asf/tez/repo Commit: http://git-wip-us.apache.org/repos/asf/tez/commit/b63d7faf Tree: http://git-wip-us.apache.org/repos/asf/tez/tree/b63d7faf Diff: http://git-wip-us.apache.org/repos/asf/tez/diff/b63d7faf Branch: refs/heads/master Commit: b63d7faf5f9ef892b582f62d000fafd80e8a3b5b Parents: d22389c Author: Jason Lowe <[email protected]> Authored: Tue May 17 19:58:38 2016 +0000 Committer: Jason Lowe <[email protected]> Committed: Tue May 17 19:58:38 2016 +0000 ---------------------------------------------------------------------- CHANGES.txt | 2 ++ .../tez/dag/api/client/DAGClientHandler.java | 29 +++++++++++++++++--- .../dag/api/client/TestDAGClientHandler.java | 5 ++-- 3 files changed, 30 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tez/blob/b63d7faf/CHANGES.txt ---------------------------------------------------------------------- diff --git a/CHANGES.txt b/CHANGES.txt index e20940f..434412b 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -7,6 +7,7 @@ INCOMPATIBLE CHANGES ALL CHANGES: + TEZ-3246. Improve diagnostics when DAG killed by user TEZ-3258. Jvm Checker does not ignore DisableExplicitGC when checking JVM GC options. TEZ-3256. [Backport HADOOP-11032] Remove Guava Stopwatch dependency TEZ-2342. Reduce bytearray copy with TezEvent Serialization and deserialization @@ -40,6 +41,7 @@ INCOMPATIBLE CHANGES ALL CHANGES: + TEZ-3246. Improve diagnostics when DAG killed by user TEZ-3258. Jvm Checker does not ignore DisableExplicitGC when checking JVM GC options. TEZ-3256. [Backport HADOOP-11032] Remove Guava Stopwatch dependency TEZ-2342. Reduce bytearray copy with TezEvent Serialization and deserialization http://git-wip-us.apache.org/repos/asf/tez/blob/b63d7faf/tez-dag/src/main/java/org/apache/tez/dag/api/client/DAGClientHandler.java ---------------------------------------------------------------------- diff --git a/tez-dag/src/main/java/org/apache/tez/dag/api/client/DAGClientHandler.java b/tez-dag/src/main/java/org/apache/tez/dag/api/client/DAGClientHandler.java index 79b9acd..0f51eff 100644 --- a/tez-dag/src/main/java/org/apache/tez/dag/api/client/DAGClientHandler.java +++ b/tez-dag/src/main/java/org/apache/tez/dag/api/client/DAGClientHandler.java @@ -18,6 +18,7 @@ package org.apache.tez.dag.api.client; +import java.io.IOException; import java.util.Collections; import java.util.List; import java.util.Map; @@ -25,6 +26,8 @@ import java.util.Set; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.apache.hadoop.ipc.Server; +import org.apache.hadoop.security.UserGroupInformation; import org.apache.hadoop.yarn.api.records.LocalResource; import org.apache.tez.client.TezAppMasterStatus; import org.apache.tez.dag.api.DAGNotRunningException; @@ -109,10 +112,27 @@ public class DAGClientHandler { return currentDAG; } + private String getClientInfo() throws TezException { + UserGroupInformation callerUGI; + try { + callerUGI = UserGroupInformation.getCurrentUser(); + } catch (IOException ie) { + LOG.info("Error getting UGI ", ie); + throw new TezException(ie); + } + String message = callerUGI.toString(); + if(null != Server.getRemoteAddress()) { + message += " at " + Server.getRemoteAddress(); + } + return message; + } + public void tryKillDAG(String dagIdStr) throws TezException { DAG dag = getDAG(dagIdStr); - LOG.info("Sending client kill to dag: " + dagIdStr); - dagAppMaster.tryKillDAG(dag, "Kill Dag request received from client"); + String message = "Sending client kill from " + getClientInfo() + + " to dag " + dagIdStr; + LOG.info(message); + dagAppMaster.tryKillDAG(dag, message); } public synchronized String submitDAG(DAGPlan dagPlan, @@ -122,9 +142,10 @@ public class DAGClientHandler { // Only to be invoked by the DAGClient. public synchronized void shutdownAM() throws TezException { - LOG.info("Received message to shutdown AM"); + String message = "Received message to shutdown AM from " + getClientInfo(); + LOG.info(message); if (dagAppMaster != null) { - dagAppMaster.shutdownTezAM("AM Shutdown request received from client"); + dagAppMaster.shutdownTezAM(message); } } http://git-wip-us.apache.org/repos/asf/tez/blob/b63d7faf/tez-dag/src/test/java/org/apache/tez/dag/api/client/TestDAGClientHandler.java ---------------------------------------------------------------------- diff --git a/tez-dag/src/test/java/org/apache/tez/dag/api/client/TestDAGClientHandler.java b/tez-dag/src/test/java/org/apache/tez/dag/api/client/TestDAGClientHandler.java index 23a5191..8a8b776 100644 --- a/tez-dag/src/test/java/org/apache/tez/dag/api/client/TestDAGClientHandler.java +++ b/tez-dag/src/test/java/org/apache/tez/dag/api/client/TestDAGClientHandler.java @@ -112,7 +112,8 @@ public class TestDAGClientHandler { } dagClientHandler.tryKillDAG("dag_9999_0001_1"); ArgumentCaptor<DAG> eventCaptor = ArgumentCaptor.forClass(DAG.class); - verify(mockDagAM, times(1)).tryKillDAG(eventCaptor.capture(), eq("Kill Dag request received from client")); + verify(mockDagAM, times(1)).tryKillDAG(eventCaptor.capture(), + contains("Sending client kill from")); assertEquals(1, eventCaptor.getAllValues().size()); assertTrue(eventCaptor.getAllValues().get(0) instanceof DAG); assertEquals("dag_9999_0001_1", ((DAG)eventCaptor.getAllValues().get(0)).getID().toString()); @@ -125,7 +126,7 @@ public class TestDAGClientHandler { // shutdown dagClientHandler.shutdownAM(); - verify(mockDagAM).shutdownTezAM(eq("AM Shutdown request received from client")); + verify(mockDagAM).shutdownTezAM(contains("Received message to shutdown AM from")); } }
