XComp commented on code in PR #26111:
URL: https://github.com/apache/flink/pull/26111#discussion_r1943202076
##########
flink-runtime/src/main/java/org/apache/flink/runtime/dispatcher/Dispatcher.java:
##########
@@ -878,8 +879,12 @@ public CompletableFuture<MultipleJobsDetails>
requestMultipleJobDetails(Duration
completedJobDetails.forEach(job ->
deduplicatedJobs.put(job.getJobId(), job));
runningJobDetails.forEach(job ->
deduplicatedJobs.put(job.getJobId(), job));
+ Collection<JobDetails> orderedDeduplicatedJobs =
+ deduplicatedJobs.values().stream()
+
.sorted(Comparator.comparingLong(JobDetails::getStartTime))
Review Comment:
I know it's quite unlikely but should we use the job ID as a fallback if the
start time is the same?
##########
flink-runtime/src/main/java/org/apache/flink/runtime/dispatcher/Dispatcher.java:
##########
@@ -878,8 +879,12 @@ public CompletableFuture<MultipleJobsDetails>
requestMultipleJobDetails(Duration
completedJobDetails.forEach(job ->
deduplicatedJobs.put(job.getJobId(), job));
runningJobDetails.forEach(job ->
deduplicatedJobs.put(job.getJobId(), job));
+ Collection<JobDetails> orderedDeduplicatedJobs =
+ deduplicatedJobs.values().stream()
+
.sorted(Comparator.comparingLong(JobDetails::getStartTime))
+ .collect(Collectors.toList());
- return new MultipleJobsDetails(new
HashSet<>(deduplicatedJobs.values()));
+ return new MultipleJobsDetails(new
ArrayList<>(orderedDeduplicatedJobs));
Review Comment:
```suggestion
return new MultipleJobsDetails(orderedDeduplicatedJobs);
```
I guess, we don't need the explicit `ArrayList`, do we?
##########
flink-runtime/src/test/java/org/apache/flink/runtime/dispatcher/DispatcherTest.java:
##########
@@ -1225,7 +1257,16 @@ public void testOverridingJobVertexParallelisms() throws
Exception {
private JobManagerRunner runningJobManagerRunnerWithJobStatus(
final JobStatus currentJobStatus) {
+ return runningJobManagerRunnerWithJobStatus(currentJobStatus, jobId,
0L);
+ }
+
+ private JobManagerRunner runningJobManagerRunnerWithJobStatus(
+ final JobStatus currentJobStatus, final JobID jobId, long
startTime) {
Preconditions.checkArgument(!currentJobStatus.isTerminalState());
+ long[] stateTimeStampsForRunningJob = new
long[JobStatus.values().length];
+ stateTimeStampsForRunningJob[JobStatus.INITIALIZING.ordinal()] =
startTime;
Review Comment:
nit, you could add custom timestamps for `CREATED` and `RUNNING` that have
inverse values for the two jobs to verify that the `INITIALIZING` timestamp is
used.
--
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]