[ 
https://issues.apache.org/jira/browse/TEZ-1758?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14203564#comment-14203564
 ] 

Bikas Saha commented on TEZ-1758:
---------------------------------

Diagnostics are expected to be user visible and meaningful. Showing YARN app 
state does not meet that criteria.

Will make both places consistent.

This is because we simply dont show diagnostics on the client and we have to 
look at the RM UI/logs or NM logs to find why the AM did not start. Dont know 
if YARN is propagating the errors from the NM to the RM properly but this will 
show if its not doing so.

The tabs looks fine to me in the diff
{code}
+  
+  @Test(timeout = 5000)
+  public void testWaitTillReadyAppFailed() throws Exception {
+    final TezClientForTest client = configure();
+    client.start();
+    String msg = "Application Test Failed";
+    
when(client.mockYarnClient.getApplicationReport(client.mockAppId).getYarnApplicationState())
+        
.thenReturn(YarnApplicationState.NEW).thenReturn(YarnApplicationState.FAILED);
+    
when(client.mockYarnClient.getApplicationReport(client.mockAppId).getDiagnostics()).thenReturn(
+        msg);
+    try {
+      client.waitTillReady();
+      Assert.fail();
+    } catch (SessionNotRunning e) {
+      Assert.assertTrue(e.getMessage().contains(msg));
+    }
+    client.stop();
+  }
+  
+  @Test(timeout = 5000)
+  public void testSubmitDAGAppFailed() throws Exception {
+    final TezClientForTest client = configure();
+    client.start();
+    
+    client.callRealGetSessionAMProxy = true;
+    String msg = "Application Test Failed";
+    
when(client.mockYarnClient.getApplicationReport(client.mockAppId).getYarnApplicationState())
+        .thenReturn(YarnApplicationState.KILLED);
+    
when(client.mockYarnClient.getApplicationReport(client.mockAppId).getDiagnostics()).thenReturn(
+        msg);
+
+    Vertex vertex = Vertex.create("Vertex", ProcessorDescriptor.create("P"), 1,
+        Resource.newInstance(1, 1));
+    DAG dag = DAG.create("DAG").addVertex(vertex);
+    
+    try {
+      client.submitDAG(dag);
+      Assert.fail();
+    } catch (SessionNotRunning e) {
+      Assert.assertTrue(e.getMessage().contains(msg));
+    }
+    client.stop();
+  }
 {code}

Thanks for the review!

> TezClient should provide YARN diagnostics when the AM crashes
> -------------------------------------------------------------
>
>                 Key: TEZ-1758
>                 URL: https://issues.apache.org/jira/browse/TEZ-1758
>             Project: Apache Tez
>          Issue Type: Bug
>    Affects Versions: 0.5.2
>            Reporter: Bikas Saha
>            Assignee: Bikas Saha
>         Attachments: TEZ-1758.1.patch
>
>




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to