dongjoon-hyun commented on code in PR #920:
URL:
https://github.com/apache/spark-kubernetes-operator/pull/920#discussion_r4164102167
##########
spark-operator/src/main/java/org/apache/spark/k8s/operator/utils/EventUtils.java:
##########
@@ -203,16 +210,24 @@ public static String describe(Throwable throwable) {
if (throwable == null) {
return "";
}
- StringBuilder builder = new StringBuilder(describeSingle(throwable));
+ String description = describeSingle(throwable);
Throwable rootCause = rootCauseOf(throwable);
- if (rootCause != null) {
- builder.append(", caused by: ").append(describeSingle(rootCause));
+ if (rootCause == null) {
+ return description;
}
- return builder.toString();
+ String rootCauseDescription = describeSingle(rootCause);
+ return rootCauseDescription.equals(description)
+ ? description
+ : description + ", caused by: " + rootCauseDescription;
}
private static String describeSingle(Throwable throwable) {
String message = throwable.getMessage();
+ if (throwable instanceof KubernetesClientException e
+ && e.getStatus() != null
+ && StringUtils.isNotBlank(e.getStatus().getMessage())) {
+ message = e.getStatus().getMessage();
+ }
String type = throwable.getClass().getSimpleName();
return StringUtils.isBlank(message) ? type : type + ": " + message;
}
Review Comment:
Thank you, @peter-toth. Right, `waitForResult` wraps a cause which is
neither an `IOException` nor a `KubernetesClientException` with the same
message, and the vertx `NoStackTraceTimeoutException` is a `TimeoutException`.
I applied your suggestion with a test case. One nit: the strict read treats a
timeout as an absent resource, so a timeout ends in `SchedulingFailure` only
after the create retries of `getOrCreateSecondaryResource` run out.
--
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]