flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [flink] tillrohrmann commented on a change in pull request #7918: [FLINK-11846] Don't delete HA job files in case of duplicate job submission
Date Thu, 07 Mar 2019 09:39:57 GMT
tillrohrmann commented on a change in pull request #7918: [FLINK-11846] Don't delete HA job
files in case of duplicate job submission
URL: https://github.com/apache/flink/pull/7918#discussion_r263303133
 
 

 ##########
 File path: flink-runtime/src/main/java/org/apache/flink/runtime/dispatcher/Dispatcher.java
 ##########
 @@ -260,40 +260,50 @@ private void stopDispatcherServices() throws Exception {
 
 	@Override
 	public CompletableFuture<Acknowledge> submitJob(JobGraph jobGraph, Time timeout) {
-		return internalSubmitJob(jobGraph).whenCompleteAsync((acknowledge, throwable) -> {
-			if (throwable != null) {
-				cleanUpJobData(jobGraph.getJobID(), true);
+		log.info("Received JobGraph submission {} ({}).", jobGraph.getJobID(), jobGraph.getName());
+
+		try {
+			if (checkDuplicateJob(jobGraph.getJobID())) {
+				return FutureUtils.completedExceptionally(
+					new JobSubmissionException(jobGraph.getJobID(), "Job has already been submitted."));
+			} else {
+				return internalSubmitJob(jobGraph);
 			}
-		}, getRpcService().getExecutor());
+		} catch (FlinkException e) {
+			return FutureUtils.completedExceptionally(e);
+		}
 	}
 
-	private CompletableFuture<Acknowledge> internalSubmitJob(JobGraph jobGraph) {
-		final JobID jobId = jobGraph.getJobID();
-
-		log.info("Submitting job {} ({}).", jobId, jobGraph.getName());
+	private boolean checkDuplicateJob(JobID jobId) throws FlinkException {
 
 Review comment:
   You are right. I'll change it.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message