Skip to content

Commit d7047e7

Browse files
Address PR review comments: add try-catch, @OverRide annotations, and fix Javadoc
1 parent 208aeaf commit d7047e7

2 files changed

Lines changed: 14 additions & 4 deletions

File tree

dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/workflow/statemachine/WorkflowRunningStateAction.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,15 @@ public void onStartEvent(final IWorkflowExecutionRunnable workflowExecutionRunna
4949

5050
// Initialize the workflow execution graph if not already initialized
5151
// This is deferred from command handling to reduce transaction time
52-
workflowExecutionRunnable.getWorkflowExecuteContext().initializeWorkflowExecutionGraph();
52+
try {
53+
workflowExecutionRunnable.getWorkflowExecuteContext().initializeWorkflowExecutionGraph();
54+
} catch (Exception e) {
55+
log.error("Failed to initialize workflow execution graph", e);
56+
final WorkflowEventBus workflowEventBus =
57+
workflowExecutionRunnable.getWorkflowExecuteContext().getWorkflowEventBus();
58+
workflowEventBus.publish(WorkflowFailedLifecycleEvent.of(workflowExecutionRunnable));
59+
return;
60+
}
5361

5462
final IWorkflowExecutionGraph workflowExecutionGraph =
5563
workflowExecutionRunnable.getWorkflowExecuteContext().getWorkflowExecutionGraph();

dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteContext.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,11 @@ public WorkflowExecuteContext(Command command,
8080
* Initialize the workflow execution graph using the assembler.
8181
* This method should be called when the workflow is ready to start execution,
8282
* typically during the handling of WorkflowStartLifecycleEvent.
83-
*
84-
* @throws IllegalStateException if the execution graph is already initialized
85-
* or no assembler is available
83+
* <p>
84+
* If the execution graph is already initialized or no assembler is available,
85+
* this method returns without making any changes.
8686
*/
87+
@Override
8788
public void initializeWorkflowExecutionGraph() {
8889
if (workflowExecutionGraph != null) {
8990
return;
@@ -101,6 +102,7 @@ public void initializeWorkflowExecutionGraph() {
101102
/**
102103
* Check if the workflow execution graph has been initialized.
103104
*/
105+
@Override
104106
public boolean isWorkflowExecutionGraphInitialized() {
105107
return workflowExecutionGraph != null;
106108
}

0 commit comments

Comments
 (0)