Browse Source

Fix recovery from failed task will dead loop (#11239)

(cherry picked from commit 04f3aa9713)
3.0.0/version-upgrade
Wenjun Ruan 2 years ago committed by Jiajie Zhong
parent
commit
072672a127
  1. 14
      dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java

14
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java

@ -82,7 +82,6 @@ import org.apache.dolphinscheduler.service.quartz.cron.CronUtils;
import org.apache.dolphinscheduler.service.queue.PeerTaskInstancePriorityQueue; import org.apache.dolphinscheduler.service.queue.PeerTaskInstancePriorityQueue;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils; import org.apache.commons.lang3.math.NumberUtils;
@ -1820,12 +1819,13 @@ public class WorkflowExecuteRunnable implements Callable<WorkflowSubmitStatue> {
// todo: Can we use a better way to set the recover taskInstanceId list? rather then use the cmdParam // todo: Can we use a better way to set the recover taskInstanceId list? rather then use the cmdParam
if (paramMap != null && paramMap.containsKey(CMD_PARAM_RECOVERY_START_NODE_STRING)) { if (paramMap != null && paramMap.containsKey(CMD_PARAM_RECOVERY_START_NODE_STRING)) {
String[] idList = paramMap.get(CMD_PARAM_RECOVERY_START_NODE_STRING).split(Constants.COMMA); List<Integer> startTaskInstanceIds = Arrays.stream(paramMap.get(CMD_PARAM_RECOVERY_START_NODE_STRING)
if (ArrayUtils.isNotEmpty(idList)) { .split(COMMA))
List<Integer> taskInstanceIds = Arrays.stream(idList) .filter(StringUtils::isNotEmpty)
.map(Integer::valueOf) .map(Integer::valueOf)
.collect(Collectors.toList()); .collect(Collectors.toList());
return processService.findTaskInstanceByIdList(taskInstanceIds); if (CollectionUtils.isNotEmpty(startTaskInstanceIds)) {
return processService.findTaskInstanceByIdList(startTaskInstanceIds);
} }
} }
return Collections.emptyList(); return Collections.emptyList();

Loading…
Cancel
Save