|
|
@ -17,19 +17,13 @@ |
|
|
|
|
|
|
|
|
|
|
|
package org.apache.dolphinscheduler.service.process; |
|
|
|
package org.apache.dolphinscheduler.service.process; |
|
|
|
|
|
|
|
|
|
|
|
import static org.apache.dolphinscheduler.common.Constants.CMDPARAM_COMPLEMENT_DATA_END_DATE; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import static org.apache.dolphinscheduler.common.Constants.CMDPARAM_COMPLEMENT_DATA_START_DATE; |
|
|
|
import com.fasterxml.jackson.core.type.TypeReference; |
|
|
|
import static org.apache.dolphinscheduler.common.Constants.CMD_PARAM_EMPTY_SUB_PROCESS; |
|
|
|
import com.fasterxml.jackson.databind.node.ObjectNode; |
|
|
|
import static org.apache.dolphinscheduler.common.Constants.CMD_PARAM_FATHER_PARAMS; |
|
|
|
import com.google.common.collect.Lists; |
|
|
|
import static org.apache.dolphinscheduler.common.Constants.CMD_PARAM_RECOVER_PROCESS_ID_STRING; |
|
|
|
import org.apache.commons.collections.CollectionUtils; |
|
|
|
import static org.apache.dolphinscheduler.common.Constants.CMD_PARAM_SUB_PROCESS; |
|
|
|
import org.apache.commons.lang.StringUtils; |
|
|
|
import static org.apache.dolphinscheduler.common.Constants.CMD_PARAM_SUB_PROCESS_DEFINE_CODE; |
|
|
|
import org.apache.commons.lang.math.NumberUtils; |
|
|
|
import static org.apache.dolphinscheduler.common.Constants.CMD_PARAM_SUB_PROCESS_PARENT_INSTANCE_ID; |
|
|
|
|
|
|
|
import static org.apache.dolphinscheduler.common.Constants.LOCAL_PARAMS; |
|
|
|
|
|
|
|
import static org.apache.dolphinscheduler.plugin.task.api.utils.DataQualityConstants.TASK_INSTANCE_ID; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import static java.util.stream.Collectors.toSet; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import org.apache.dolphinscheduler.common.Constants; |
|
|
|
import org.apache.dolphinscheduler.common.Constants; |
|
|
|
import org.apache.dolphinscheduler.common.enums.AuthorizationType; |
|
|
|
import org.apache.dolphinscheduler.common.enums.AuthorizationType; |
|
|
|
import org.apache.dolphinscheduler.common.enums.CommandType; |
|
|
|
import org.apache.dolphinscheduler.common.enums.CommandType; |
|
|
@ -130,9 +124,11 @@ 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.dolphinscheduler.service.task.TaskPluginManager; |
|
|
|
import org.apache.dolphinscheduler.service.task.TaskPluginManager; |
|
|
|
import org.apache.dolphinscheduler.spi.enums.ResourceType; |
|
|
|
import org.apache.dolphinscheduler.spi.enums.ResourceType; |
|
|
|
|
|
|
|
import org.slf4j.Logger; |
|
|
|
import org.apache.commons.collections.CollectionUtils; |
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
import org.apache.commons.lang.StringUtils; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
|
|
|
|
import org.springframework.stereotype.Component; |
|
|
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.Arrays; |
|
|
@ -147,16 +143,17 @@ import java.util.Objects; |
|
|
|
import java.util.Set; |
|
|
|
import java.util.Set; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
|
|
import org.slf4j.Logger; |
|
|
|
import static java.util.stream.Collectors.toSet; |
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
import static org.apache.dolphinscheduler.common.Constants.CMDPARAM_COMPLEMENT_DATA_END_DATE; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import static org.apache.dolphinscheduler.common.Constants.CMDPARAM_COMPLEMENT_DATA_START_DATE; |
|
|
|
import org.springframework.stereotype.Component; |
|
|
|
import static org.apache.dolphinscheduler.common.Constants.CMD_PARAM_EMPTY_SUB_PROCESS; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
import static org.apache.dolphinscheduler.common.Constants.CMD_PARAM_FATHER_PARAMS; |
|
|
|
|
|
|
|
import static org.apache.dolphinscheduler.common.Constants.CMD_PARAM_RECOVER_PROCESS_ID_STRING; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import static org.apache.dolphinscheduler.common.Constants.CMD_PARAM_SUB_PROCESS; |
|
|
|
import com.fasterxml.jackson.core.type.TypeReference; |
|
|
|
import static org.apache.dolphinscheduler.common.Constants.CMD_PARAM_SUB_PROCESS_DEFINE_CODE; |
|
|
|
import com.fasterxml.jackson.databind.node.ObjectNode; |
|
|
|
import static org.apache.dolphinscheduler.common.Constants.CMD_PARAM_SUB_PROCESS_PARENT_INSTANCE_ID; |
|
|
|
import com.google.common.collect.Lists; |
|
|
|
import static org.apache.dolphinscheduler.common.Constants.LOCAL_PARAMS; |
|
|
|
|
|
|
|
import static org.apache.dolphinscheduler.plugin.task.api.utils.DataQualityConstants.TASK_INSTANCE_ID; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* process relative dao that some mappers in this. |
|
|
|
* process relative dao that some mappers in this. |
|
|
@ -584,6 +581,7 @@ public class ProcessService { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* recursive delete all task instance by process instance id |
|
|
|
* recursive delete all task instance by process instance id |
|
|
|
|
|
|
|
* |
|
|
|
* @param processInstanceId |
|
|
|
* @param processInstanceId |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void deleteWorkTaskInstanceByProcessInstanceId(int processInstanceId) { |
|
|
|
public void deleteWorkTaskInstanceByProcessInstanceId(int processInstanceId) { |
|
|
@ -1345,19 +1343,22 @@ public class ProcessService { |
|
|
|
ProcessInstanceMap instanceMap, |
|
|
|
ProcessInstanceMap instanceMap, |
|
|
|
TaskInstance task) { |
|
|
|
TaskInstance task) { |
|
|
|
CommandType commandType = getSubCommandType(parentProcessInstance, childInstance); |
|
|
|
CommandType commandType = getSubCommandType(parentProcessInstance, childInstance); |
|
|
|
Map<String, String> subProcessParam = JSONUtils.toMap(task.getTaskParams()); |
|
|
|
Map<String, Object> subProcessParam = JSONUtils.toMap(task.getTaskParams(), String.class, Object.class); |
|
|
|
long childDefineCode = 0L; |
|
|
|
long childDefineCode = 0L; |
|
|
|
if (subProcessParam.containsKey(Constants.CMD_PARAM_SUB_PROCESS_DEFINE_CODE)) { |
|
|
|
if (subProcessParam.containsKey(Constants.CMD_PARAM_SUB_PROCESS_DEFINE_CODE)) { |
|
|
|
childDefineCode = Long.parseLong(subProcessParam.get(Constants.CMD_PARAM_SUB_PROCESS_DEFINE_CODE)); |
|
|
|
childDefineCode = NumberUtils.toLong(String.valueOf(subProcessParam.get(Constants.CMD_PARAM_SUB_PROCESS_DEFINE_CODE))); |
|
|
|
} |
|
|
|
} |
|
|
|
ProcessDefinition subProcessDefinition = processDefineMapper.queryByCode(childDefineCode); |
|
|
|
ProcessDefinition subProcessDefinition = processDefineMapper.queryByCode(childDefineCode); |
|
|
|
|
|
|
|
|
|
|
|
Object localParams = subProcessParam.get(Constants.LOCAL_PARAMS); |
|
|
|
Object localParams = subProcessParam.get(Constants.LOCAL_PARAMS); |
|
|
|
List<Property> allParam = JSONUtils.toList(JSONUtils.toJsonString(localParams), Property.class); |
|
|
|
List<Property> allParam = JSONUtils.toList(JSONUtils.toJsonString(localParams), Property.class); |
|
|
|
Map<String, String> globalMap = this.getGlobalParamMap(parentProcessInstance.getGlobalParams()); |
|
|
|
Map<String, String> globalMap = this.getGlobalParamMap(task.getVarPool()); |
|
|
|
Map<String, String> fatherParams = new HashMap<>(); |
|
|
|
Map<String, String> fatherParams = new HashMap<>(); |
|
|
|
if (CollectionUtils.isNotEmpty(allParam)) { |
|
|
|
if (CollectionUtils.isNotEmpty(allParam)) { |
|
|
|
for (Property info : allParam) { |
|
|
|
for (Property info : allParam) { |
|
|
|
|
|
|
|
if (Direct.OUT == info.getDirect()) { |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
} |
|
|
|
fatherParams.put(info.getProp(), globalMap.get(info.getProp())); |
|
|
|
fatherParams.put(info.getProp(), globalMap.get(info.getProp())); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -2740,6 +2741,7 @@ public class ProcessService { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* the first time (when submit the task ) get the resource of the task group |
|
|
|
* the first time (when submit the task ) get the resource of the task group |
|
|
|
|
|
|
|
* |
|
|
|
* @param taskId task id |
|
|
|
* @param taskId task id |
|
|
|
* @param taskName |
|
|
|
* @param taskName |
|
|
|
* @param groupId |
|
|
|
* @param groupId |
|
|
@ -2786,6 +2788,7 @@ public class ProcessService { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* try to get the task group resource(when other task release the resource) |
|
|
|
* try to get the task group resource(when other task release the resource) |
|
|
|
|
|
|
|
* |
|
|
|
* @param taskGroupQueue |
|
|
|
* @param taskGroupQueue |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
|