Skip to content

Commit

Permalink
[AMORO-3110] Extract error message in optimizers (#3130)
Browse files Browse the repository at this point in the history
extract error message in optimizers
  • Loading branch information
XBaith authored Aug 26, 2024
1 parent 2bf68a1 commit 5adbfbf
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
public class OptimizerExecutor extends AbstractOptimizerOperator {

private static final Logger LOG = LoggerFactory.getLogger(OptimizerExecutor.class);
protected static final int ERROR_MESSAGE_MAX_LENGTH = 4000;

private final int threadId;

Expand Down Expand Up @@ -166,7 +167,7 @@ public static OptimizingTaskResult executeTask(
System.currentTimeMillis() - startTime,
t);
OptimizingTaskResult errorResult = new OptimizingTaskResult(task.getTaskId(), threadId);
errorResult.setErrorMessage(ExceptionUtil.getErrorMessage(t, 4000));
errorResult.setErrorMessage(ExceptionUtil.getErrorMessage(t, ERROR_MESSAGE_MAX_LENGTH));
return errorResult;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,11 @@ protected OptimizingTaskResult executeTask(OptimizingTask task) {
// add optimizer flink runtime info, including application_id, tm_id
StringBuilder sb = new StringBuilder();
if (!Strings.isNullOrEmpty(result.getErrorMessage())) {
if (runtimeContext != null && runtimeContext.size() > 0) {
if (runtimeContext != null && !runtimeContext.isEmpty()) {
runtimeContext.forEach((k, v) -> sb.append(k).append("=").append(v).append("\n"));
}
result.setErrorMessage(sb.toString() + result.getErrorMessage());
result.setErrorMessage(
(sb + result.getErrorMessage()).substring(0, ERROR_MESSAGE_MAX_LENGTH));
}
return result;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ protected OptimizingTaskResult executeTask(OptimizingTask task) {
(System.currentTimeMillis() - startTime),
r);
result = new OptimizingTaskResult(task.getTaskId(), threadId);
result.setErrorMessage(ExceptionUtil.getErrorMessage(r, 4000));
result.setErrorMessage(ExceptionUtil.getErrorMessage(r, ERROR_MESSAGE_MAX_LENGTH));
return result;
}
}
Expand Down

0 comments on commit 5adbfbf

Please sign in to comment.