caishunfeng commented on code in PR #13051:
URL: 
https://github.com/apache/dolphinscheduler/pull/13051#discussion_r1110844067


##########
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/event/WorkflowStartEventHandler.java:
##########
@@ -66,11 +68,35 @@ public void handleWorkflowEvent(final WorkflowEvent 
workflowEvent) throws Workfl
                         if (processInstance.getTimeout() > 0) {
                             
stateWheelExecuteThread.addProcess4TimeoutCheck(processInstance);
                         }
+                    } else if (WorkflowSubmitStatue.ERROR == 
workflowSubmitStatue) {
+                        log.error(
+                                "Failed to submit the workflow instance, will 
resend the workflow start event: {}, and reduce submit times that can be used",
+                                workflowEvent);
+                        
workflowEvent.setMaxSubmitTimes(workflowEvent.getMaxSubmitTimes() - 1);
+                        if (workflowEvent.getMaxSubmitTimes() >= 0) {
+                            workflowEventQueue.addEvent(workflowEvent);
+                        } else {
+                            WorkflowStateEvent stateEvent = 
WorkflowStateEvent.builder()
+                                    .processInstanceId(processInstance.getId())
+                                    .type(StateEventType.PROCESS_SUBMIT_FAILED)
+                                    .status(WorkflowExecutionStatus.FAILURE)
+                                    .build();
+                            workflowExecuteRunnable.addStateEvent(stateEvent);
+                        }
                     } else {
                         // submit failed will resend the event to workflow 
event queue
                         log.error("Failed to submit the workflow instance, 
will resend the workflow start event: {}",
                                 workflowEvent);
-                        workflowEventQueue.addEvent(workflowEvent);

Review Comment:
   I think it's better to set the workflow instance status to failed if the 
submit unsuccessful, without retrying. It is up to the user to decide whether 
to manually retry. WDYT?



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