dybyte commented on code in PR #9776:
URL: https://github.com/apache/seatunnel/pull/9776#discussion_r2306956511


##########
seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/TaskExecutionService.java:
##########
@@ -571,16 +571,81 @@ public void provideDynamicMetrics(
     }
 
     private void updateMetricsContextInImap() {
-        if (!nodeEngine.getNode().getState().equals(NodeState.ACTIVE)) {
+        final long deadlineNanos = System.nanoTime() + 
TimeUnit.MINUTES.toNanos(2);
+        long backoffMillis = 1000;
+        final long maxBackoffMillis = 10000;
+        int attempts = 0;
+        while (isRunning) {
+            if (!nodeEngine.getNode().getState().equals(NodeState.ACTIVE)) {
+                logger.warning(
+                        String.format(
+                                "The Node is not ready yet, Node state 
%s,looking forward to the next "
+                                        + "scheduling",
+                                nodeEngine.getNode().getState()));
+                return;
+            }
+
+            InvocationFuture<Object> invoke =
+                    nodeEngine
+                            .getOperationService()
+                            .createInvocationBuilder(
+                                    SeaTunnelServer.SERVICE_NAME,
+                                    new 
ReportMetricsOperation(collectLocalMetricsMap()),

Review Comment:
   I removed the loop, so `collectLocalMetricsMap` should now run only once. Is 
that correct?



##########
seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/master/JobMaster.java:
##########
@@ -893,47 +892,69 @@ public void removeMetricsContext(
         if ((pipelineStatus.equals(PipelineStatus.FINISHED)
                         && 
!checkpointManager.isPipelineSavePointEnd(pipelineLocation))
                 || pipelineStatus.equals(PipelineStatus.CANCELED)) {
+            final long deadlineNanos = System.nanoTime() + 
TimeUnit.MINUTES.toNanos(2);
+            long backoffMillis = 1000;
+            final long maxBackoffMillis = 10000;
+            int attempts = 0;
+            while (isRunning) {
+
+                InvocationFuture<Object> invoke =
+                        nodeEngine
+                                .getOperationService()
+                                .createInvocationBuilder(
+                                        SeaTunnelServer.SERVICE_NAME,
+                                        new 
RemoveMetricsOperation(pipelineLocation),
+                                        nodeEngine.getMasterAddress())
+                                .invoke();

Review Comment:
   ```java
       private void startMaster() {
           coordinatorService =
                   new CoordinatorService(nodeEngine, this, 
seaTunnelConfig.getEngineConfig());
           checkpointService =
                   new 
CheckpointService(seaTunnelConfig.getEngineConfig().getCheckpointConfig());
           monitorService = Executors.newSingleThreadScheduledExecutor();
           monitorService.scheduleAtFixedRate(
                   this::printExecutionInfo,
                   0,
                   
seaTunnelConfig.getEngineConfig().getPrintExecutionInfoInterval(),
                   TimeUnit.SECONDS);
       }
   ```
   Thank you, that makes sense now. it’s because of this part.



-- 
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]

Reply via email to