|
|
@ -42,7 +42,6 @@ import org.apache.dolphinscheduler.common.enums.Flag; |
|
|
|
import org.apache.dolphinscheduler.common.enums.ReleaseState; |
|
|
|
import org.apache.dolphinscheduler.common.enums.ReleaseState; |
|
|
|
import org.apache.dolphinscheduler.common.enums.ResourceType; |
|
|
|
import org.apache.dolphinscheduler.common.enums.ResourceType; |
|
|
|
import org.apache.dolphinscheduler.common.enums.TaskDependType; |
|
|
|
import org.apache.dolphinscheduler.common.enums.TaskDependType; |
|
|
|
import org.apache.dolphinscheduler.common.enums.TaskType; |
|
|
|
|
|
|
|
import org.apache.dolphinscheduler.common.enums.TimeoutFlag; |
|
|
|
import org.apache.dolphinscheduler.common.enums.TimeoutFlag; |
|
|
|
import org.apache.dolphinscheduler.common.enums.WarningType; |
|
|
|
import org.apache.dolphinscheduler.common.enums.WarningType; |
|
|
|
import org.apache.dolphinscheduler.common.graph.DAG; |
|
|
|
import org.apache.dolphinscheduler.common.graph.DAG; |
|
|
@ -110,8 +109,6 @@ import org.apache.dolphinscheduler.service.exceptions.ServiceException; |
|
|
|
import org.apache.dolphinscheduler.service.log.LogClientService; |
|
|
|
import org.apache.dolphinscheduler.service.log.LogClientService; |
|
|
|
import org.apache.dolphinscheduler.service.quartz.cron.CronUtils; |
|
|
|
import org.apache.dolphinscheduler.service.quartz.cron.CronUtils; |
|
|
|
|
|
|
|
|
|
|
|
import org.apache.commons.collections.map.HashedMap; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.Calendar; |
|
|
|
import java.util.Calendar; |
|
|
@ -2200,7 +2197,7 @@ public class ProcessService { |
|
|
|
taskDefinition.setName(taskNode.getName()); |
|
|
|
taskDefinition.setName(taskNode.getName()); |
|
|
|
taskDefinition.setDescription(taskNode.getDesc()); |
|
|
|
taskDefinition.setDescription(taskNode.getDesc()); |
|
|
|
taskDefinition.setTaskType(taskNode.getType().toUpperCase()); |
|
|
|
taskDefinition.setTaskType(taskNode.getType().toUpperCase()); |
|
|
|
taskDefinition.setTaskParams(TaskType.DEPENDENT.getDesc().equalsIgnoreCase(taskNode.getType()) ? taskNode.getDependence() : taskNode.getParams()); |
|
|
|
taskDefinition.setTaskParams(taskNode.getTaskParams()); |
|
|
|
taskDefinition.setFlag(taskNode.isForbidden() ? Flag.NO : Flag.YES); |
|
|
|
taskDefinition.setFlag(taskNode.isForbidden() ? Flag.NO : Flag.YES); |
|
|
|
taskDefinition.setTaskPriority(taskNode.getTaskInstancePriority()); |
|
|
|
taskDefinition.setTaskPriority(taskNode.getTaskInstancePriority()); |
|
|
|
taskDefinition.setWorkerGroup(taskNode.getWorkerGroup()); |
|
|
|
taskDefinition.setWorkerGroup(taskNode.getWorkerGroup()); |
|
|
@ -2209,6 +2206,7 @@ public class ProcessService { |
|
|
|
taskDefinition.setTimeoutFlag(taskNode.getTaskTimeoutParameter().getEnable() ? TimeoutFlag.OPEN : TimeoutFlag.CLOSE); |
|
|
|
taskDefinition.setTimeoutFlag(taskNode.getTaskTimeoutParameter().getEnable() ? TimeoutFlag.OPEN : TimeoutFlag.CLOSE); |
|
|
|
taskDefinition.setTimeoutNotifyStrategy(taskNode.getTaskTimeoutParameter().getStrategy()); |
|
|
|
taskDefinition.setTimeoutNotifyStrategy(taskNode.getTaskTimeoutParameter().getStrategy()); |
|
|
|
taskDefinition.setTimeout(taskNode.getTaskTimeoutParameter().getInterval()); |
|
|
|
taskDefinition.setTimeout(taskNode.getTaskTimeoutParameter().getInterval()); |
|
|
|
|
|
|
|
taskDefinition.setDelayTime(taskNode.getDelayTime()); |
|
|
|
taskDefinition.setResourceIds(getResourceIds(taskDefinition)); |
|
|
|
taskDefinition.setResourceIds(getResourceIds(taskDefinition)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -2221,7 +2219,6 @@ public class ProcessService { |
|
|
|
public String getResourceIds(TaskDefinition taskDefinition) { |
|
|
|
public String getResourceIds(TaskDefinition taskDefinition) { |
|
|
|
Set<Integer> resourceIds = null; |
|
|
|
Set<Integer> resourceIds = null; |
|
|
|
AbstractParameters params = TaskParametersUtils.getParameters(taskDefinition.getTaskType(), taskDefinition.getTaskParams()); |
|
|
|
AbstractParameters params = TaskParametersUtils.getParameters(taskDefinition.getTaskType(), taskDefinition.getTaskParams()); |
|
|
|
|
|
|
|
|
|
|
|
if (params != null && CollectionUtils.isNotEmpty(params.getResourceFilesList())) { |
|
|
|
if (params != null && CollectionUtils.isNotEmpty(params.getResourceFilesList())) { |
|
|
|
resourceIds = params.getResourceFilesList(). |
|
|
|
resourceIds = params.getResourceFilesList(). |
|
|
|
stream() |
|
|
|
stream() |
|
|
@ -2341,7 +2338,8 @@ public class ProcessService { |
|
|
|
List<String> depList = taskNode.getDepList(); |
|
|
|
List<String> depList = taskNode.getDepList(); |
|
|
|
if (CollectionUtils.isNotEmpty(depList)) { |
|
|
|
if (CollectionUtils.isNotEmpty(depList)) { |
|
|
|
for (String preTaskName : depList) { |
|
|
|
for (String preTaskName : depList) { |
|
|
|
builderRelationList.add(new ProcessTaskRelation("", |
|
|
|
builderRelationList.add(new ProcessTaskRelation( |
|
|
|
|
|
|
|
StringUtils.EMPTY, |
|
|
|
processDefinition.getVersion(), |
|
|
|
processDefinition.getVersion(), |
|
|
|
projectCode, |
|
|
|
projectCode, |
|
|
|
processDefinition.getCode(), |
|
|
|
processDefinition.getCode(), |
|
|
@ -2350,12 +2348,13 @@ public class ProcessService { |
|
|
|
taskDefinitionMap.get(taskNode.getName()).getCode(), |
|
|
|
taskDefinitionMap.get(taskNode.getName()).getCode(), |
|
|
|
taskDefinitionMap.get(taskNode.getName()).getVersion(), |
|
|
|
taskDefinitionMap.get(taskNode.getName()).getVersion(), |
|
|
|
ConditionType.NONE, |
|
|
|
ConditionType.NONE, |
|
|
|
taskNode.getConditionResult(), |
|
|
|
StringUtils.EMPTY, |
|
|
|
now, |
|
|
|
now, |
|
|
|
now)); |
|
|
|
now)); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
builderRelationList.add(new ProcessTaskRelation("", |
|
|
|
builderRelationList.add(new ProcessTaskRelation( |
|
|
|
|
|
|
|
StringUtils.EMPTY, |
|
|
|
processDefinition.getVersion(), |
|
|
|
processDefinition.getVersion(), |
|
|
|
projectCode, |
|
|
|
projectCode, |
|
|
|
processDefinition.getCode(), |
|
|
|
processDefinition.getCode(), |
|
|
@ -2363,8 +2362,8 @@ public class ProcessService { |
|
|
|
0, |
|
|
|
0, |
|
|
|
taskDefinitionMap.get(taskNode.getName()).getCode(), |
|
|
|
taskDefinitionMap.get(taskNode.getName()).getCode(), |
|
|
|
taskDefinitionMap.get(taskNode.getName()).getVersion(), |
|
|
|
taskDefinitionMap.get(taskNode.getName()).getVersion(), |
|
|
|
ConditionType.of("none"), |
|
|
|
ConditionType.NONE, |
|
|
|
taskNode.getConditionResult(), |
|
|
|
StringUtils.EMPTY, |
|
|
|
now, |
|
|
|
now, |
|
|
|
now)); |
|
|
|
now)); |
|
|
|
} |
|
|
|
} |
|
|
@ -2464,7 +2463,6 @@ public class ProcessService { |
|
|
|
v = new TaskNode(); |
|
|
|
v = new TaskNode(); |
|
|
|
v.setCode(processTaskRelation.getPostTaskCode()); |
|
|
|
v.setCode(processTaskRelation.getPostTaskCode()); |
|
|
|
v.setVersion(processTaskRelation.getPostTaskVersion()); |
|
|
|
v.setVersion(processTaskRelation.getPostTaskVersion()); |
|
|
|
v.setConditionResult(processTaskRelation.getConditionParams()); |
|
|
|
|
|
|
|
List<PreviousTaskNode> preTaskNodeList = new ArrayList<>(); |
|
|
|
List<PreviousTaskNode> preTaskNodeList = new ArrayList<>(); |
|
|
|
if (processTaskRelation.getPreTaskCode() > 0) { |
|
|
|
if (processTaskRelation.getPreTaskCode() > 0) { |
|
|
|
preTaskNodeList.add(new PreviousTaskNode(processTaskRelation.getPreTaskCode(), "", processTaskRelation.getPreTaskVersion())); |
|
|
|
preTaskNodeList.add(new PreviousTaskNode(processTaskRelation.getPreTaskCode(), "", processTaskRelation.getPreTaskVersion())); |
|
|
@ -2489,13 +2487,18 @@ public class ProcessService { |
|
|
|
v.setRunFlag(taskDefinitionLog.getFlag() == Flag.YES ? Constants.FLOWNODE_RUN_FLAG_NORMAL : Constants.FLOWNODE_RUN_FLAG_FORBIDDEN); |
|
|
|
v.setRunFlag(taskDefinitionLog.getFlag() == Flag.YES ? Constants.FLOWNODE_RUN_FLAG_NORMAL : Constants.FLOWNODE_RUN_FLAG_FORBIDDEN); |
|
|
|
v.setMaxRetryTimes(taskDefinitionLog.getFailRetryTimes()); |
|
|
|
v.setMaxRetryTimes(taskDefinitionLog.getFailRetryTimes()); |
|
|
|
v.setRetryInterval(taskDefinitionLog.getFailRetryInterval()); |
|
|
|
v.setRetryInterval(taskDefinitionLog.getFailRetryInterval()); |
|
|
|
v.setParams(TaskType.DEPENDENT.getDesc().equalsIgnoreCase(taskDefinitionLog.getTaskType()) ? null : taskDefinitionLog.getTaskParams()); |
|
|
|
Map<String, Object> taskParamsMap = v.taskParamsToJsonObj(taskDefinitionLog.getTaskParams()); |
|
|
|
v.setDependence(TaskType.DEPENDENT.getDesc().equalsIgnoreCase(taskDefinitionLog.getTaskType()) ? taskDefinitionLog.getTaskParams() : null); |
|
|
|
v.setConditionResult((String) taskParamsMap.get(Constants.CONDITION_RESULT)); |
|
|
|
|
|
|
|
v.setDependence((String) taskParamsMap.get(Constants.DEPENDENCE)); |
|
|
|
|
|
|
|
taskParamsMap.remove(Constants.CONDITION_RESULT); |
|
|
|
|
|
|
|
taskParamsMap.remove(Constants.DEPENDENCE); |
|
|
|
|
|
|
|
v.setParams(JSONUtils.toJsonString(taskParamsMap)); |
|
|
|
v.setTaskInstancePriority(taskDefinitionLog.getTaskPriority()); |
|
|
|
v.setTaskInstancePriority(taskDefinitionLog.getTaskPriority()); |
|
|
|
v.setWorkerGroup(taskDefinitionLog.getWorkerGroup()); |
|
|
|
v.setWorkerGroup(taskDefinitionLog.getWorkerGroup()); |
|
|
|
v.setTimeout(JSONUtils.toJsonString(new TaskTimeoutParameter(taskDefinitionLog.getTimeoutFlag() == TimeoutFlag.OPEN, |
|
|
|
v.setTimeout(JSONUtils.toJsonString(new TaskTimeoutParameter(taskDefinitionLog.getTimeoutFlag() == TimeoutFlag.OPEN, |
|
|
|
taskDefinitionLog.getTimeoutNotifyStrategy(), |
|
|
|
taskDefinitionLog.getTimeoutNotifyStrategy(), |
|
|
|
taskDefinitionLog.getTimeout()))); |
|
|
|
taskDefinitionLog.getTimeout()))); |
|
|
|
|
|
|
|
v.setDelayTime(taskDefinitionLog.getDelayTime()); |
|
|
|
v.getPreTaskNodeList().forEach(task -> task.setName(taskDefinitionLogMap.get(task.getCode()).getName())); |
|
|
|
v.getPreTaskNodeList().forEach(task -> task.setName(taskDefinitionLogMap.get(task.getCode()).getName())); |
|
|
|
v.setPreTasks(JSONUtils.toJsonString(v.getPreTaskNodeList().stream().map(PreviousTaskNode::getName).collect(Collectors.toList()))); |
|
|
|
v.setPreTasks(JSONUtils.toJsonString(v.getPreTaskNodeList().stream().map(PreviousTaskNode::getName).collect(Collectors.toList()))); |
|
|
|
}); |
|
|
|
}); |
|
|
@ -2503,7 +2506,7 @@ public class ProcessService { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* find task definition by code and verision |
|
|
|
* find task definition by code and version |
|
|
|
* |
|
|
|
* |
|
|
|
* @param taskCode |
|
|
|
* @param taskCode |
|
|
|
* @param taskDefinitionVersion |
|
|
|
* @param taskDefinitionVersion |
|
|
@ -2514,7 +2517,7 @@ public class ProcessService { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* query taks definition list by process code and process version |
|
|
|
* query tasks definition list by process code and process version |
|
|
|
* |
|
|
|
* |
|
|
|
* @param processCode |
|
|
|
* @param processCode |
|
|
|
* @param processVersion |
|
|
|
* @param processVersion |
|
|
@ -2523,7 +2526,7 @@ public class ProcessService { |
|
|
|
public List<TaskDefinitionLog> queryTaskDefinitionList(Long processCode, int processVersion) { |
|
|
|
public List<TaskDefinitionLog> queryTaskDefinitionList(Long processCode, int processVersion) { |
|
|
|
List<ProcessTaskRelationLog> processTaskRelationLogs = |
|
|
|
List<ProcessTaskRelationLog> processTaskRelationLogs = |
|
|
|
processTaskRelationLogMapper.queryByProcessCodeAndVersion(processCode, processVersion); |
|
|
|
processTaskRelationLogMapper.queryByProcessCodeAndVersion(processCode, processVersion); |
|
|
|
Map<Long, TaskDefinition> postTaskDefinitionMap = new HashedMap(); |
|
|
|
Map<Long, TaskDefinition> postTaskDefinitionMap = new HashMap<>(); |
|
|
|
processTaskRelationLogs.forEach(processTaskRelationLog -> { |
|
|
|
processTaskRelationLogs.forEach(processTaskRelationLog -> { |
|
|
|
Long code = processTaskRelationLog.getPostTaskCode(); |
|
|
|
Long code = processTaskRelationLog.getPostTaskCode(); |
|
|
|
int version = processTaskRelationLog.getPostTaskVersion(); |
|
|
|
int version = processTaskRelationLog.getPostTaskVersion(); |
|
|
|