GaneshPatil7517 opened a new pull request, #17953:
URL: https://github.com/apache/dolphinscheduler/pull/17953

   ## Purpose of the pull request
   
   This PR moves the initialization of `WorkflowGraph` and 
`WorkflowExecutionGraph` from command handling to when the 
`WorkflowStartLifecycleEvent` is fired, as requested in #17751.
   
   ## Brief description of changes
   
   ### New Components
   - **`IWorkflowExecutionGraphAssembler`**: A functional interface for 
deferred `WorkflowExecutionGraph` assembly
   
   ### Modified Components
   - **`WorkflowExecuteContext`**: Added `workflowExecutionGraphAssembler` 
field and lazy initialization support with `initializeWorkflowExecutionGraph()` 
and `isWorkflowExecutionGraphInitialized()` methods
   - **`IWorkflowExecuteContext`**: Added interface methods for graph 
initialization
   - **`AbstractCommandHandler`**: Changed to use assembler pattern - now calls 
`createWorkflowExecutionGraphAssembler()` instead of 
`assembleWorkflowExecutionGraph()`
   - **Command Handlers**: All handlers now return assembler lambdas instead of 
immediate graph creation:
     - `RunWorkflowCommandHandler`
     - `RecoverFailureTaskCommandHandler`
     - `WorkflowFailoverCommandHandler`
     - `RecoverSerialWaitCommandHandler` (returns null - no graph needed)
     - `ReRunWorkflowCommandHandler` (wraps parent assembler)
   - **`WorkflowRunningStateAction`**: Added graph initialization in 
`onStartEvent()` with proper exception handling that publishes 
`WorkflowFailedLifecycleEvent` on failure
   
   ## Benefits
   - Reduces transaction time during command processing
   - Enables proper workflow failure handling if graph initialization fails
   - Workflow can be properly marked as failed with 
`WorkflowFailedLifecycleEvent`
   
   ## Verification
   -  Code compiles successfully
   -  Spotless formatting applied
   -  Build passes
   
   Closes #17751
   <img width="1863" height="1079" alt="Screenshot 2026-02-05 123742" 
src="https://github.com/user-attachments/assets/31cf9d5e-1970-4572-ba05-084eb1bca0c6";
 />
   


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