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


##########
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskInstanceServiceImpl.java:
##########
@@ -194,6 +198,24 @@ public Map<String, Object> forceTaskSuccess(User 
loginUser, long projectCode, In
             return result;
         }
 
+        ProcessInstance processInstance = 
processService.findProcessInstanceDetailById(task.getProcessInstanceId());
+        if (processInstance != null && 
(processInstance.getState().typeIsFailure() || 
processInstance.getState().typeIsCancel())) {
+            List<TaskInstance> validTaskList = 
processService.findValidTaskListByProcessId(processInstance.getId());
+            List<Long> instanceTaskCodeList = 
validTaskList.stream().map(TaskInstance::getTaskCode).collect(Collectors.toList());
+            List<ProcessTaskRelation> taskRelations = 
processService.findRelationByCode(processInstance.getProcessDefinitionCode(),
+                processInstance.getProcessDefinitionVersion());
+            List<TaskDefinitionLog> taskDefinitionLogs = 
processService.genTaskDefineList(taskRelations);
+            List<Long> definiteTaskCodeList = 
taskDefinitionLogs.stream().filter(definitionLog -> definitionLog.getFlag() == 
Flag.YES)
+                .map(TaskDefinitionLog::getCode).collect(Collectors.toList());
+            if (CollectionUtils.equalLists(instanceTaskCodeList, 
definiteTaskCodeList)) {
+                List<Integer> failTaskList = 
validTaskList.stream().filter(instance -> instance.getState().typeIsFailure() 
|| instance.getState().typeIsCancel())
+                    .map(TaskInstance::getId).collect(Collectors.toList());
+                if (failTaskList.size() == 1 && 
failTaskList.contains(taskInstanceId)) {

Review Comment:
   It looks strange, why is judgment = 1?



##########
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskInstanceServiceImpl.java:
##########
@@ -194,6 +198,24 @@ public Map<String, Object> forceTaskSuccess(User 
loginUser, long projectCode, In
             return result;
         }
 
+        ProcessInstance processInstance = 
processService.findProcessInstanceDetailById(task.getProcessInstanceId());

Review Comment:
   Please add some comment.



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