EricJoy2048 commented on code in PR #2413:
URL:
https://github.com/apache/incubator-seatunnel/pull/2413#discussion_r949776562
##########
seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/SeaTunnelServer.java:
##########
@@ -116,23 +122,39 @@ public LiveOperationRegistry getLiveOperationRegistry() {
/**
* call by client to submit job
*/
- @SuppressWarnings("checkstyle:MagicNumber")
- public NonCompletableFuture<Void> submitJob(Data jobImmutableInformation) {
+ public PassiveCompletableFuture<Void> submitJob(long jobId, Data
jobImmutableInformation) {
CompletableFuture<Void> voidCompletableFuture = new
CompletableFuture<>();
JobMaster jobMaster = new JobMaster(jobImmutableInformation,
this.nodeEngine, executorService);
executorService.submit(() -> {
try {
jobMaster.init();
- jobMaster.run();
+ runningJobMasterMap.put(jobId, jobMaster);
} catch (Throwable e) {
- LOGGER.severe("submit job error: " + e.getMessage());
+ LOGGER.severe(String.format("submit job %s error %s ", jobId,
ExceptionUtils.getMessage(e)));
voidCompletableFuture.completeExceptionally(e);
} finally {
// We specify that when init is complete, the submitJob is
complete
voidCompletableFuture.complete(null);
}
- //jobMaster.run();
+
+ try {
+ jobMaster.run();
+ } finally {
+ runningJobMasterMap.remove(jobId);
+ }
});
- return new NonCompletableFuture<>(voidCompletableFuture);
+ return new PassiveCompletableFuture(voidCompletableFuture);
+ }
+
+ public PassiveCompletableFuture<JobStatus> waitForJobComplete(long jobId) {
+ JobMaster runningJobMaster = runningJobMasterMap.get(jobId);
+ if (runningJobMaster == null) {
Review Comment:
I add a todo comment `// TODO Get Job Status from JobHistoryStorage` .
Now I only add some tmp code.
--
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]