You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by GitBox <gi...@apache.org> on 2022/09/13 06:45:09 UTC

[GitHub] [incubator-seatunnel] ic4y commented on a diff in pull request #2699: [Feature][ST-Engine] Put Job Status in IMap

ic4y commented on code in PR #2699:
URL: https://github.com/apache/incubator-seatunnel/pull/2699#discussion_r969193866


##########
seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/SeaTunnelServer.java:
##########
@@ -238,7 +340,18 @@ public JobStatus getJobStatus(long jobId) {
             // TODO Get Job Status from JobHistoryStorage
             return JobStatus.FINISHED;
         }
-        return runningJobMaster.getJobStatus();
+        // This method is called by operation and in the runningJobMaster.getJobStatus() we will get data from IMap.
+        // It will cause an error "Waiting for response on this thread is illegal". To solve it we need put
+        // runningJobMaster.getJobStatus() in another thread.
+        CompletableFuture<JobStatus> future = CompletableFuture.supplyAsync(() -> {
+            return runningJobMaster.getJobStatus();
+        }, executorService);

Review Comment:
   I think the problem is mainly caused by some limitations of the caller of the getJobStatus method, so solving this problem should be solved by the caller. instead of being handled internally by the method. Because calling in a normal thread should not encounter this problem.



##########
seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/dag/physical/PipelineLocation.java:
##########
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.seatunnel.engine.server.dag.physical;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+
+import java.io.Serializable;
+
+@AllArgsConstructor
+@Data
+public class PipelineLocation implements Serializable {

Review Comment:
   This class has duplicate content with TaskGroupLocation, it is recommended to modify TaskGroupLocation. Delete jobId and pipelineId in TaskGroupLocation and add PipelineLocation. and put this class together with TaskGroupLocation



##########
seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/master/JobMaster.java:
##########
@@ -168,26 +184,26 @@ public void handleCheckpointTimeout(long pipelineId) {
         });
     }
 
-    public CompletableFuture<Void> reSchedulerPipeline(SubPlan subPlan) {
-        return jobScheduler.reSchedulerPipeline(subPlan);
+    public PassiveCompletableFuture<Void> reSchedulerPipeline(SubPlan subPlan) {
+        return new PassiveCompletableFuture<>(jobScheduler.reSchedulerPipeline(subPlan));
     }
 
-    public void releasePipelineResource(int pipelineId) {
+    public void releasePipelineResource(SubPlan subPlan) {
         resourceManager.releaseResources(jobImmutableInformation.getJobId(),
-            Lists.newArrayList(ownedSlotProfiles.get(pipelineId).values()));
+            Lists.newArrayList(ownedSlotProfilesIMap.get(subPlan.getPipelineLocation()).values())).join();

Review Comment:
   Why are released resources not removed from ownedSlotProfilesIMap?



##########
seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/TaskExecutionService.java:
##########
@@ -151,10 +151,15 @@ public synchronized PassiveCompletableFuture<TaskExecutionState> deployTask(
             } else {
                 taskGroup = nodeEngine.getSerializationService().toObject(taskImmutableInfo.getGroup());
             }
-            if (executionContexts.containsKey(taskGroup.getTaskGroupLocation())) {
-                throw new RuntimeException(String.format("TaskGroupLocation: %s already exists", taskGroup.getTaskGroupLocation()));
+            logger.info(String.format("deploying task %s", taskGroup.getTaskGroupLocation()));
+
+            synchronized (this) {

Review Comment:
   If `synchronized`  is added in this place, the `synchronized` of this method should be deleted.



-- 
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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org