Github user tillrohrmann commented on a diff in the pull request:
https://github.com/apache/flink/pull/4697#discussion_r141298175
--- Diff:
flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/legacy/JobCancellationHandler.java
---
@@ -70,4 +82,25 @@ public JobCancellationHandler(Executor executor, Time
timeout) {
},
executor);
}
+
+ @Override
+ public CompletableFuture<EmptyResponseBody>
handleRequest(HandlerRequest<EmptyRequestBody, JobMessageParameters> request,
DispatcherGateway gateway) {
+ final JobID jobId =
request.getPathParameter(JobPathParameter.class);
+
+ CompletableFuture<Acknowledge> cancelFuture =
gateway.cancelJob(jobId, timeout);
+
+ return cancelFuture.handle(
+ (Acknowledge ack, Throwable throwable) -> {
+ if (throwable != null) {
+ Throwable error =
ExceptionUtils.stripCompletionException(throwable);
+
+ throw new CompletionException(
+ new RestHandlerException(
+ "Job cancellation
failed: " + error.getMessage(),
--- End diff --
It could also be due to a `TimeoutException`. I'll add more detailed
exception handling to generate the proper `HttpResponseStatus` values.
---