Skip to content

Commit

Permalink
[ML] Audit all errors during job deletion (#37933)
Browse files Browse the repository at this point in the history
This commit moves the auditing of job deletion related errors
to the final listener in the job delete action. This ensures
any error that occurs during job deletion is audited.
  • Loading branch information
dimitris-athanasiou authored Jan 29, 2019
1 parent 891320f commit ebe9c95
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,10 @@ protected void masterOperation(Task task, DeleteJobAction.Request request, Clust
// The listener that will be executed at the end of the chain will notify all listeners
ActionListener<AcknowledgedResponse> finalListener = ActionListener.wrap(
ack -> notifyListeners(request.getJobId(), ack, null),
e -> notifyListeners(request.getJobId(), null, e)
e -> {
notifyListeners(request.getJobId(), null, e);
auditor.error(request.getJobId(), Messages.getMessage(Messages.JOB_AUDIT_DELETING_FAILED, e.getMessage()));
}
);

ActionListener<Boolean> markAsDeletingListener = ActionListener.wrap(
Expand All @@ -192,10 +195,7 @@ protected void masterOperation(Task task, DeleteJobAction.Request request, Clust
normalDeleteJob(parentTaskClient, request, finalListener);
}
},
e -> {
auditor.error(request.getJobId(), Messages.getMessage(Messages.JOB_AUDIT_DELETING_FAILED, e.getMessage()));
finalListener.onFailure(e);
});
finalListener::onFailure);

ActionListener<Boolean> jobExistsListener = ActionListener.wrap(
response -> {
Expand Down

0 comments on commit ebe9c95

Please sign in to comment.