This is an automated email from the ASF dual-hosted git repository.

SbloodyS pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git


The following commit(s) were added to refs/heads/dev by this push:
     new 869d9aa4e3 [Fix-18247] Fix when forceTaskSuccess is performed on the 
last unsuccessful workflow instance, the workflow instance cannot be reset to 
the success state (#18351)
869d9aa4e3 is described below

commit 869d9aa4e3afa27de3b7fc64af69861fe34ac0b7
Author: xiangzihao <[email protected]>
AuthorDate: Mon Jun 22 10:26:44 2026 +0800

    [Fix-18247] Fix when forceTaskSuccess is performed on the last unsuccessful 
workflow instance, the workflow instance cannot be reset to the success state 
(#18351)
---
 .../api/service/impl/TaskInstanceServiceImpl.java             |  2 +-
 .../dolphinscheduler/service/process/ProcessServiceImpl.java  | 11 ++++++++---
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git 
a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskInstanceServiceImpl.java
 
b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskInstanceServiceImpl.java
index 6bca977281..bbbd28737d 100644
--- 
a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskInstanceServiceImpl.java
+++ 
b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskInstanceServiceImpl.java
@@ -227,7 +227,7 @@ public class TaskInstanceServiceImpl extends 
BaseServiceImpl implements TaskInst
             throw new ServiceException(Status.FORCE_TASK_SUCCESS_ERROR);
         }
         processService.forceWorkflowInstanceSuccessByTaskInstanceId(task);
-        log.info("Force success task instance:{} success", taskInstanceId);
+        log.info("Force success task instance id: {} success", taskInstanceId);
     }
 
     @Override
diff --git 
a/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java
 
b/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java
index 94136ddcbb..1469a909b2 100644
--- 
a/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java
+++ 
b/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java
@@ -745,6 +745,10 @@ public class ProcessServiceImpl implements ProcessService {
         return cluster == null ? null : 
ClusterConfUtils.getK8sConfig(cluster.getConfig());
     }
 
+    /**
+     * Force the workflow instance to success only when every enabled task in 
the workflow definition has a
+     * corresponding instance, and the given task is the only forced success 
task.
+     */
     @Override
     public void forceWorkflowInstanceSuccessByTaskInstanceId(TaskInstance 
task) {
         WorkflowInstance workflowInstance = 
findWorkflowInstanceDetailById(task.getWorkflowInstanceId()).orElse(null);
@@ -760,15 +764,16 @@ public class ProcessServiceImpl implements ProcessService 
{
             List<Long> definiteTaskCodeList =
                     taskDefinitionLogs.stream().filter(definitionLog -> 
definitionLog.getFlag() == Flag.YES)
                             
.map(TaskDefinitionLog::getCode).collect(Collectors.toList());
-            // only all tasks have instances
             if (CollectionUtils.isEqualCollection(instanceTaskCodeList,
                     definiteTaskCodeList)) {
-                List<Integer> failTaskList = validTaskList.stream()
+                List<Integer> failedTaskList = validTaskList.stream()
                         .filter(instance -> instance.getState().isFailure() || 
instance.getState().isKill())
                         .map(TaskInstance::getId).collect(Collectors.toList());
-                if (failTaskList.size() == 1 && 
failTaskList.contains(task.getId())) {
+                if (CollectionUtils.isEmpty(failedTaskList)) {
                     
workflowInstance.setStateWithDesc(WorkflowExecutionStatus.SUCCESS, "success by 
task force success");
                     workflowInstanceDao.updateById(workflowInstance);
+                    log.info("force workflow instance {} to success by task 
instance {}",
+                            workflowInstance.getId(), task.getId());
                 }
             }
         }

Reply via email to