zentol commented on issue #8269: [FLINK-12285][test] Harden savepoint relevant 
test cases by explicitly canceling test job
URL: https://github.com/apache/flink/pull/8269#issuecomment-488637332
 
 
   something like this in `after()` should work:
   ```
   try {
        final Deadline deadline = Deadline.fromNow(Duration.ofSeconds(30));
   
        List<CompletableFuture<Acknowledge>> jobCancellationFutures = 
miniCluster.listJobs()
                .get(deadline.timeLeft().toMillis(), TimeUnit.MILLISECONDS)
                .stream()
                .filter(status -> 
!status.getJobState().isGloballyTerminalState())
                .map(status -> miniCluster.cancelJob(status.getJobId()))
                .collect(Collectors.toList());
   
        FutureUtils.waitForAll(jobCancellationFutures)
                .get(deadline.timeLeft().toMillis(), TimeUnit.MILLISECONDS);
   } catch (InterruptedException | ExecutionException e) {
        log.warn("Exception while shutting down remaining jobs.", e);
   } catch (TimeoutException e) {
        log.warn("Shutting down remaining jobs resulted in a timeout.", e);
   }
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to