[ 
https://issues.apache.org/jira/browse/FLINK-7650?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16182299#comment-16182299
 ] 

ASF GitHub Bot commented on FLINK-7650:
---------------------------------------

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.


> Port JobCancellationHandler to new REST endpoint
> ------------------------------------------------
>
>                 Key: FLINK-7650
>                 URL: https://issues.apache.org/jira/browse/FLINK-7650
>             Project: Flink
>          Issue Type: Sub-task
>          Components: REST, Webfrontend
>            Reporter: Tzu-Li (Gordon) Tai
>            Assignee: Till Rohrmann
>              Labels: flip-6
>             Fix For: 1.4.0
>
>
> Port existing {{JobCancellationHandler}} to new REST endpoint



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to