JingGe commented on code in PR #23949:
URL: https://github.com/apache/flink/pull/23949#discussion_r1430093209


##########
flink-runtime/src/test/java/org/apache/flink/runtime/dispatcher/DispatcherTest.java:
##########
@@ -683,6 +685,69 @@ public void testRetrieveCheckpointStats() throws Exception 
{
         Assertions.assertThat(resultsFuture).isCompletedWithValue(snapshot);
     }
 
+    @Test
+    public void testRetrieveCheckpointStatsOnCompletedJob() throws Exception {
+        CheckpointStatsSnapshot snapshot = 
getTestCheckpointStatsSnapshotWithTwoFailedCheckpoints();
+        TestingJobMasterGateway testingJobMasterGateway =
+                new TestingJobMasterGatewayBuilder().build();
+
+        dispatcher =
+                createAndStartDispatcher(
+                        heartbeatServices,
+                        haServices,
+                        new TestingJobMasterGatewayJobManagerRunnerFactory(
+                                testingJobMasterGateway));
+
+        final JobStatus expectedState = JobStatus.FAILED;

Review Comment:
   Do you have issue with other completed jobs i.e. CANCELED, FINISHED? Does it 
make sense to test them too?



##########
flink-runtime/src/main/java/org/apache/flink/runtime/dispatcher/Dispatcher.java:
##########
@@ -904,29 +904,32 @@ public CompletableFuture<JobStatus> 
requestJobStatus(JobID jobId, Time timeout)
     @Override
     public CompletableFuture<ExecutionGraphInfo> requestExecutionGraphInfo(
             JobID jobId, Time timeout) {
-        Function<Throwable, ExecutionGraphInfo> 
checkExecutionGraphStoreOnException =
-                throwable -> {
-                    // check whether it is a completed job
-                    final ExecutionGraphInfo executionGraphInfo =
-                            executionGraphInfoStore.get(jobId);
-                    if (executionGraphInfo == null) {
-                        throw new CompletionException(
-                                
ExceptionUtils.stripCompletionException(throwable));
-                    } else {
-                        return executionGraphInfo;
-                    }
-                };
         Optional<JobManagerRunner> maybeJob = getJobManagerRunner(jobId);
         return maybeJob.map(job -> job.requestJob(timeout))
                 .orElse(FutureUtils.completedExceptionally(new 
FlinkJobNotFoundException(jobId)))
-                .exceptionally(checkExecutionGraphStoreOnException);
+                .exceptionally(t -> checkExecutionGraphStoreOnException(t, 
jobId));
+    }
+
+    private ExecutionGraphInfo checkExecutionGraphStoreOnException(Throwable 
t, JobID jobId) {

Review Comment:
   NIT: the method name does not tell us what it will do. Maybe something like 
`getExecutionGraphInfoForCompletedJob` ?



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to