Skip to content

Commit

Permalink
Merge pull request #47 from exacaster/do_not_faill_on_stderr
Browse files Browse the repository at this point in the history
Do not fail on stderr error
  • Loading branch information
pdambrauskas authored May 24, 2022
2 parents dd548d3 + 6b010d5 commit 0b139ff
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,7 @@ public ApplicationState processApplicationRunning(Application app) {
}

public void processApplicationError(Application application, Throwable error) {
// Workaround for case when Spark launcher logs
// `DEBUG Configuration: Handling deprecation for hive.stats.ndv.error`
// on org.apache.spark.launcher.OutputRedirector#redirect() it marks all stdout lines
// containing `error` string as Exceptions.
if (error.getMessage().contains("hive.stats.ndv.error")) {
LOG.debug("Skipping", error);
return;
}

LOG.warn("Application {} error occurred", application, error);
LOG.warn("Marking application {} failed because of error {}", application.getId(), error.getMessage());
var appId = backend.getInfo(application).map(ApplicationInfo::getApplicationId)
.orElse(null);
applicationStorage.saveApplication(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,12 @@ public SparkListener(Consumer<Throwable> errorHandler) {
public void stateChanged(SparkAppHandle handle) {
var state = handle.getState();
LOG.info("State change. AppId: {}, State: {}", handle.getAppId(), state);
handle.getError().ifPresent(errorHandler);

handle.getError().ifPresent((error) -> {
LOG.warn("State changed with error: {} ", error.getMessage());
if (State.FAILED.equals(state)) {
errorHandler.accept(error);
}
});
// Disconnect when final or submitted.
// In case app fails after detach, status will be retrieved by ApplicationStatusHandler.
if (state != null && (state.isFinal() || State.SUBMITTED.equals(state))) {
Expand Down

0 comments on commit 0b139ff

Please sign in to comment.