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

ASF GitHub Bot commented on YARN-11823:
---------------------------------------

K0K0V0K commented on code in PR #8123:
URL: https://github.com/apache/hadoop/pull/8123#discussion_r2911270255


##########
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/webapp/NMWebServices.java:
##########
@@ -628,6 +636,60 @@ public Response syncYarnSysFS(@javax.ws.rs.core.Context
     return Response.ok().build();
   }
 
+
+  @GET
+  @Path("/jstack/{numberOfJStack}")
+  public Response getNodeThreadDump(@PathParam("numberOfJStack") int 
numberOfJStack)
+  {
+    if (!isJStackEndpointsEnable) {
+      return Response.status(Status.METHOD_NOT_ALLOWED)
+              .build();
+    }
+
+    try {
+      return Response.status(Status.OK)
+              
.entity(diagnosticJStackService.collectNodeThreadDump(numberOfJStack))
+              .build();
+    } catch (IOException e){
+      throw new WebAppException("Shell command has failed: " + e.getMessage() 
+ ". " +
+              "For more information please check the NodeManager logs.");
+    } catch (Exception e) {
+      throw new WebAppException(
+              "Unexpected error collection NodeManager JStack: " + 
e.getMessage() + ". " +
+                      "For more information please check the NodeManager 
logs.");
+    }
+  }
+
+
+  @GET
+  @Path("/apps/{appid}/jstack/{numberOfJStack}")
+  @Produces({MediaType.TEXT_PLAIN})
+  public Response getApplicationJStack(@PathParam("appid") String appId,
+                                       @PathParam("numberOfJStack") int 
numberOfJStack)
+  {
+    if (!isJStackEndpointsEnable) {
+      return Response.status(Status.METHOD_NOT_ALLOWED)
+              .build();
+    }
+
+    try {
+      return Response.status(Status.OK)
+              
.entity(diagnosticJStackService.collectApplicationThreadDump(appId, 
numberOfJStack))
+              .build();
+    } catch (RuntimeException e){

Review Comment:
   If i see right this should be IllegalArgumentException





> New JStack endpoint for running containers and nodes
> ----------------------------------------------------
>
>                 Key: YARN-11823
>                 URL: https://issues.apache.org/jira/browse/YARN-11823
>             Project: Hadoop YARN
>          Issue Type: New Feature
>          Components: yarn
>            Reporter: chhinlinghean
>            Assignee: chhinlinghean
>            Priority: Major
>              Labels: pull-request-available
>
> Getting jstack for container is not trivial to most people. This new endpoint 
> aims to streamline the process of getting jstack of running containers and 
> nodes. It mainly use in the DiagnosticCollector script.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to