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

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

slfan1989 commented on code in PR #6211:
URL: https://github.com/apache/hadoop/pull/6211#discussion_r1379976006


##########
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/main/java/org/apache/hadoop/yarn/server/router/clientrm/FederationClientInterceptor.java:
##########
@@ -842,13 +842,24 @@ <R> Collection<R> invokeConcurrent(ClientMethod request, 
Class<R> clazz)
     // Generate parallel Callable tasks
     for (SubClusterId subClusterId : subClusterIds) {
       callables.add(() -> {
-        ApplicationClientProtocol protocol = 
getClientRMProxyForSubCluster(subClusterId);
-        String methodName = request.getMethodName();
-        Class<?>[] types = request.getTypes();
-        Object[] params = request.getParams();
-        Method method = ApplicationClientProtocol.class.getMethod(methodName, 
types);
-        Object result = method.invoke(protocol, params);
-        return Pair.of(subClusterId, result);
+        try {
+          ApplicationClientProtocol protocol = 
getClientRMProxyForSubCluster(subClusterId);
+          String methodName = request.getMethodName();
+          Class<?>[] types = request.getTypes();
+          Object[] params = request.getParams();
+          Method method = 
ApplicationClientProtocol.class.getMethod(methodName, types);
+          Object result = method.invoke(protocol, params);
+          return Pair.of(subClusterId, result);
+        } catch (Exception e) {
+          Throwable cause = e.getCause();
+          if (cause != null && cause instanceof InvocationTargetException) {
+            cause = cause.getCause();
+          }
+          String errMsg = (cause.getMessage() != null) ? cause.getMessage() : 
"UNKNOWN";
+          return Pair.of(subClusterId, new YarnException(

Review Comment:
   I will improve this code.





> Make YARN Router throw Exception to client clearly
> --------------------------------------------------
>
>                 Key: YARN-11011
>                 URL: https://issues.apache.org/jira/browse/YARN-11011
>             Project: Hadoop YARN
>          Issue Type: Improvement
>          Components: yarn
>    Affects Versions: 3.3.1
>            Reporter: Yuan Luo
>            Assignee: Shilun Fan
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 3.4.0
>
>         Attachments: router-error.png
>
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> When router submits job to yarn, the job is rejected by yarn for some reason. 
> Yarn router just throw exception to log and return not enough info to client.
> The router always throws the following non-obvious error to client:
> Exception in thread "main" 
> org.apache.hadoop.yarn.server.federation.policies.exceptions.FederationPolicyException:
> No active SubCluster available to submit the request.
> To make it easy for the user to locate the cause of a job submission failure, 
> we need to make Router throw the true cause of the error to the client 
> clearly.



--
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