goiri commented on code in PR #6211:
URL: https://github.com/apache/hadoop/pull/6211#discussion_r1379181856
##########
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/main/java/org/apache/hadoop/yarn/server/router/RouterServerUtil.java:
##########
@@ -125,8 +125,8 @@ public static void logAndThrowException(Throwable t, String
errMsgFormat, Object
public static void logAndThrowException(String errMsg, Throwable t)
throws YarnException {
if (t != null) {
- LOG.error(errMsg, t);
- throw new YarnException(errMsg, t);
+ LOG.error(errMsg + "" + t.getMessage(), t);
Review Comment:
Can we make this cleaner?
##########
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:
Extract the exception for readability.
##########
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/test/java/org/apache/hadoop/yarn/server/router/clientrm/TestableFederationClientInterceptor.java:
##########
@@ -35,8 +35,7 @@
import org.apache.hadoop.test.GenericTestUtils;
import org.apache.hadoop.thirdparty.com.google.common.collect.ImmutableSet;
import org.apache.hadoop.yarn.api.ApplicationClientProtocol;
-import org.apache.hadoop.yarn.api.protocolrecords.SubmitApplicationRequest;
-import org.apache.hadoop.yarn.api.protocolrecords.SubmitApplicationResponse;
+import org.apache.hadoop.yarn.api.protocolrecords.*;
Review Comment:
Avoid
##########
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/main/java/org/apache/hadoop/yarn/server/router/clientrm/FederationClientInterceptor.java:
##########
@@ -862,8 +873,11 @@ <R> Collection<R> invokeConcurrent(ClientMethod request,
Class<R> clazz)
Pair<SubClusterId, Object> pair = future.get();
subClusterId = pair.getKey();
Object result = pair.getValue();
+ if(result instanceof YarnException) {
Review Comment:
Space
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]