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

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

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

    https://github.com/apache/flink/pull/5168#discussion_r157476788
  
    --- Diff: 
flink-runtime/src/main/java/org/apache/flink/runtime/dispatcher/Dispatcher.java 
---
    @@ -357,6 +362,28 @@ public void start() throws Exception {
                return 
CompletableFuture.completedFuture(jobManagerServices.blobServer.getPort());
        }
     
    +   @Override
    +   public CompletableFuture<Either<Throwable, 
SerializedJobExecutionResult>> getJobExecutionResult(
    +                   final JobID jobId,
    +                   final Time timeout) {
    +           final Either<Throwable, SerializedJobExecutionResult> 
jobExecutionResult =
    +                   jobExecutionResultCache.get(jobId);
    +           if (jobExecutionResult == null) {
    +                   return FutureUtils.completedExceptionally(new 
JobExecutionResultNotFoundException(jobId));
    +           } else {
    +                   return 
CompletableFuture.completedFuture(jobExecutionResult);
    +           }
    +   }
    +
    +   @Override
    +   public CompletableFuture<Boolean> isJobExecutionResultPresent(final 
JobID jobId, final Time timeout) {
    +           final boolean jobExecutionResultPresent = 
jobExecutionResultCache.contains(jobId);
    +           if (!jobManagerRunners.containsKey(jobId) && 
!jobExecutionResultPresent) {
    +                   return FutureUtils.completedExceptionally(new 
FlinkJobNotFoundException(jobId));
    +           }
    +           return 
CompletableFuture.completedFuture(jobExecutionResultPresent);
    --- End diff --
    
    I think the logic should be something like 
    
    ```
    if (jobExecutionResultPresent || jobManagerRunners.containsKey(jobId)) { 
      return CompletableFuture.completedFuture(true);
    } else {
      return FutureUtils.completedExceptionally(new 
FlinkJobNotFoundException(jobId));
    }
    ```


> Cache JobExecutionResult from finished JobManagerRunners
> --------------------------------------------------------
>
>                 Key: FLINK-8234
>                 URL: https://issues.apache.org/jira/browse/FLINK-8234
>             Project: Flink
>          Issue Type: Sub-task
>          Components: Distributed Coordination
>    Affects Versions: 1.5.0
>            Reporter: Till Rohrmann
>            Assignee: Gary Yao
>              Labels: flip-6
>             Fix For: 1.5.0
>
>
> In order to serve the {{JobExecutionResults}} we have to cache them in the 
> {{Dispatcher}} after the {{JobManagerRunner}} has finished. The cache should 
> have a configurable size and should periodically clean up stale entries in 
> order to avoid memory leaks.



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

Reply via email to