Blazer-007 commented on code in PR #4197:
URL: https://github.com/apache/gobblin/pull/4197#discussion_r3345703773


##########
gobblin-temporal/src/main/java/org/apache/gobblin/temporal/joblauncher/GobblinTemporalJobLauncher.java:
##########
@@ -97,9 +107,64 @@ public GobblinTemporalJobLauncher(Properties jobProps, Path 
appWorkDir,
 
     // non-null value indicates job has been submitted
     this.workflowId = null;
+    // Reset the process-wide terminal-status cache for this fresh launcher. 
In a real AM JVM only one
+    // launcher ever runs, but tests re-instantiate within the same JVM and 
must not see leaked status.
+    setLastTerminalStatus(null);
     startCancellationExecutor();
   }
 
+  /**
+   * Query Temporal for the current execution status of {@link #workflowId}. 
Returns
+   * {@code WORKFLOW_EXECUTION_STATUS_UNSPECIFIED} as a safe fallback if the 
describe call fails, so callers
+   * downstream emit a JOB_FAILED rather than swallowing the GTE entirely.
+   */
+  private WorkflowExecutionStatus fetchWorkflowStatus() {
+    try {
+      WorkflowStub workflowStub = 
this.client.newUntypedWorkflowStub(this.workflowId);
+      DescribeWorkflowExecutionRequest request = 
DescribeWorkflowExecutionRequest.newBuilder()
+          .setNamespace(this.namespace)
+          .setExecution(workflowStub.getExecution())
+          .build();
+      DescribeWorkflowExecutionResponse response = 
managedWorkflowServiceStubs.getWorkflowServiceStubs()
+          .blockingStub().describeWorkflowExecution(request);
+      return response.getWorkflowExecutionInfo().getStatus();
+    } catch (Exception e) {
+      log.warn("Failed to describe workflow {} for completion GTE; treating as 
UNSPECIFIED (will emit JOB_FAILED)",
+          this.workflowId, e);
+      return WorkflowExecutionStatus.WORKFLOW_EXECUTION_STATUS_UNSPECIFIED;
+    }

Review Comment:
   the blanket exception catch will lead to wrong GTE in case of temporal is 
momentarily down / namespace limit exceeded exception 
   ```
   DEADLINE_EXCEEDED
   UNAVAILABLE
   RESOURCE_EXHAUSTED
   ```
   
   can we see if we can distinguish between them ? 



##########
gobblin-yarn/src/main/java/org/apache/gobblin/yarn/GobblinYarnAppLauncher.java:
##########
@@ -970,6 +1090,15 @@ void signalGracefulShutdownAndWaitForTerminal() {
       }
       sendGracefulShutdownSignal(amContainerId.get());
       pollForApplicationCompletionUntil(timeoutMs);
+      // Always kill so the RM cannot re-attempt the AM (no-op if the app 
already finished). If the terminal

Review Comment:
   will this be a no-op or we will see some exceptions in log ?



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