Github user zentol commented on a diff in the pull request:

    https://github.com/apache/flink/pull/4697#discussion_r141113862
  
    --- 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 --
    
    Is the only reason this can fail due to the job not existing?


---

Reply via email to