Skip to content

Commit

Permalink
[FLINK-26583][runtime] Adds log message for when a Job is submitted t…
Browse files Browse the repository at this point in the history
…hat is already marked as cleaned
  • Loading branch information
XComp committed Mar 11, 2022
1 parent 208d7dd commit 106a45e
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@

import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
Expand Down Expand Up @@ -428,6 +429,17 @@ public CompletableFuture<Acknowledge> submitJob(JobGraph jobGraph, Time timeout)

try {
if (isDuplicateJob(jobGraph.getJobID())) {
if (isInGloballyTerminalState(jobGraph.getJobID())) {
log.warn(
"Ignoring JobGraph submission '{}' ({}) because the job already reached a globally-terminal state (i.e. {}) in a previous execution.",
jobGraph.getName(),
jobGraph.getJobID(),
Arrays.stream(JobStatus.values())
.filter(JobStatus::isGloballyTerminalState)
.map(JobStatus::name)
.collect(Collectors.joining(", ")));
}

final DuplicateJobSubmissionException exception =
isInGloballyTerminalState(jobGraph.getJobID())
? DuplicateJobSubmissionException.ofGloballyTerminated(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,11 +207,26 @@ public void testJobSubmission() throws Exception {
}

@Test
public void testDuplicateJobSubmissionWithGloballyTerminatedJobId() throws Exception {
public void testDuplicateJobSubmissionWithGloballyTerminatedButDirtyJob() throws Exception {
final JobResult jobResult =
TestingJobResultStore.createJobResult(
jobGraph.getJobID(), ApplicationStatus.SUCCEEDED);
haServices.getJobResultStore().createDirtyResult(new JobResultEntry(jobResult));
assertDuplicateJobSubmission();
}

@Test
public void testDuplicateJobSubmissionWithGloballyTerminatedAndCleanedJob() throws Exception {
final JobResult jobResult =
TestingJobResultStore.createJobResult(
jobGraph.getJobID(), ApplicationStatus.SUCCEEDED);
haServices.getJobResultStore().createDirtyResult(new JobResultEntry(jobResult));
haServices.getJobResultStore().markResultAsClean(jobGraph.getJobID());

assertDuplicateJobSubmission();
}

private void assertDuplicateJobSubmission() throws Exception {
dispatcher =
createAndStartDispatcher(
heartbeatServices,
Expand Down

0 comments on commit 106a45e

Please sign in to comment.