ruanwenjun commented on code in PR #16616:
URL: 
https://github.com/apache/dolphinscheduler/pull/16616#discussion_r1796326199


##########
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/execute/MasterTaskExecutor.java:
##########
@@ -100,6 +101,15 @@ public void run() {
             TaskInstanceLogHeader.printInitializeTaskContextHeader();
             initializeTask();
 
+            if (DRY_RUN_FLAG_YES == taskExecutionContext.getDryRun()) {
+                
taskExecutionContext.setCurrentExecutionStatus(TaskExecutionStatus.SUCCESS);
+                taskExecutionContext.setEndTime(System.currentTimeMillis());
+                
MasterTaskExecutorHolder.removeMasterTaskExecutor(taskExecutionContext.getTaskInstanceId());
+                
logicTaskInstanceExecutionEventSenderManager.successEventSender().sendMessage(taskExecutionContext);
+                log.info(
+                        "The current execute mode is dry run, will stop the 
logic task and set the taskInstance status to success");
+                return;
+            }

Review Comment:
   It's better to move this after `beforeExecute` I am not sure if the 
statemachine will throw exception, since the task lifecycle might miss 
`running` event.



##########
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/execute/AsyncMasterTaskDelayQueueLooper.java:
##########
@@ -86,8 +88,14 @@ public void run() {
                     try {
                         
LogUtils.setTaskInstanceLogFullPathMDC(taskExecutionContext.getLogPath());
                         
LogUtils.setTaskInstanceIdMDC(taskExecutionContext.getTaskInstanceId());
-                        AsyncTaskExecuteFunction.AsyncTaskExecutionStatus 
asyncTaskExecutionStatus =
-                                
asyncTaskExecuteFunction.getAsyncTaskExecutionStatus();
+                        AsyncTaskExecuteFunction.AsyncTaskExecutionStatus 
asyncTaskExecutionStatus;
+                        if (taskExecutionContext.getDryRun() == 
DRY_RUN_FLAG_YES) {
+                            log.info(
+                                    "The current execute mode is dry run check 
again, will stop the logic task and set the taskInstance status to success");
+                            asyncTaskExecutionStatus = 
AsyncTaskExecuteFunction.AsyncTaskExecutionStatus.SUCCESS;
+                        } else {
+                            asyncTaskExecutionStatus = 
asyncTaskExecuteFunction.getAsyncTaskExecutionStatus();
+                        }

Review Comment:
   We can revert this change, since the Async task will not put into 
asyncMasterTaskDelayQueue



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