|
|
@ -20,6 +20,7 @@ package org.apache.dolphinscheduler.server.master.consumer; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import org.apache.dolphinscheduler.common.Constants; |
|
|
|
import org.apache.dolphinscheduler.common.Constants; |
|
|
|
import org.apache.dolphinscheduler.common.enums.ExecutionStatus; |
|
|
|
import org.apache.dolphinscheduler.common.enums.ExecutionStatus; |
|
|
|
|
|
|
|
import org.apache.dolphinscheduler.common.enums.ResourceType; |
|
|
|
import org.apache.dolphinscheduler.common.enums.TaskType; |
|
|
|
import org.apache.dolphinscheduler.common.enums.TaskType; |
|
|
|
import org.apache.dolphinscheduler.common.enums.UdfType; |
|
|
|
import org.apache.dolphinscheduler.common.enums.UdfType; |
|
|
|
import org.apache.dolphinscheduler.common.model.TaskNode; |
|
|
|
import org.apache.dolphinscheduler.common.model.TaskNode; |
|
|
@ -32,7 +33,6 @@ import org.apache.dolphinscheduler.common.task.sqoop.SqoopParameters; |
|
|
|
import org.apache.dolphinscheduler.common.task.sqoop.sources.SourceMysqlParameter; |
|
|
|
import org.apache.dolphinscheduler.common.task.sqoop.sources.SourceMysqlParameter; |
|
|
|
import org.apache.dolphinscheduler.common.task.sqoop.targets.TargetMysqlParameter; |
|
|
|
import org.apache.dolphinscheduler.common.task.sqoop.targets.TargetMysqlParameter; |
|
|
|
import org.apache.dolphinscheduler.common.thread.Stopper; |
|
|
|
import org.apache.dolphinscheduler.common.thread.Stopper; |
|
|
|
import org.apache.dolphinscheduler.common.thread.ThreadUtils; |
|
|
|
|
|
|
|
import org.apache.dolphinscheduler.common.utils.*; |
|
|
|
import org.apache.dolphinscheduler.common.utils.*; |
|
|
|
import org.apache.dolphinscheduler.dao.entity.*; |
|
|
|
import org.apache.dolphinscheduler.dao.entity.*; |
|
|
|
import org.apache.dolphinscheduler.server.builder.TaskExecutionContextBuilder; |
|
|
|
import org.apache.dolphinscheduler.server.builder.TaskExecutionContextBuilder; |
|
|
@ -50,14 +50,10 @@ import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Component; |
|
|
|
import org.springframework.stereotype.Component; |
|
|
|
|
|
|
|
|
|
|
|
import javax.annotation.PostConstruct; |
|
|
|
import javax.annotation.PostConstruct; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.*; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
import java.util.Set; |
|
|
|
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
import java.util.stream.Stream; |
|
|
|
import java.util.stream.Stream; |
|
|
|
|
|
|
|
|
|
|
|
import static org.apache.dolphinscheduler.common.Constants.SLEEP_TIME_MILLIS; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* TaskUpdateQueue consumer |
|
|
|
* TaskUpdateQueue consumer |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -362,10 +358,10 @@ public class TaskPriorityQueueConsumer extends Thread{ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* get resource full name list |
|
|
|
* get resource map key is full name and value is tenantCode |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private List<String> getResourceFullNames(TaskNode taskNode) { |
|
|
|
private Map<String,String> getResourceFullNames(TaskNode taskNode) { |
|
|
|
List<String> resourceFullNameList = new ArrayList<>(); |
|
|
|
Map<String,String> resourceMap = new HashMap<>(); |
|
|
|
AbstractParameters baseParam = TaskParametersUtils.getParameters(taskNode.getType(), taskNode.getParams()); |
|
|
|
AbstractParameters baseParam = TaskParametersUtils.getParameters(taskNode.getType(), taskNode.getParams()); |
|
|
|
|
|
|
|
|
|
|
|
if (baseParam != null) { |
|
|
|
if (baseParam != null) { |
|
|
@ -375,7 +371,10 @@ public class TaskPriorityQueueConsumer extends Thread{ |
|
|
|
// filter the resources that the resource id equals 0
|
|
|
|
// filter the resources that the resource id equals 0
|
|
|
|
Set<ResourceInfo> oldVersionResources = projectResourceFiles.stream().filter(t -> t.getId() == 0).collect(Collectors.toSet()); |
|
|
|
Set<ResourceInfo> oldVersionResources = projectResourceFiles.stream().filter(t -> t.getId() == 0).collect(Collectors.toSet()); |
|
|
|
if (CollectionUtils.isNotEmpty(oldVersionResources)) { |
|
|
|
if (CollectionUtils.isNotEmpty(oldVersionResources)) { |
|
|
|
resourceFullNameList.addAll(oldVersionResources.stream().map(resource -> resource.getRes()).collect(Collectors.toSet())); |
|
|
|
|
|
|
|
|
|
|
|
oldVersionResources.forEach( |
|
|
|
|
|
|
|
(t)->resourceMap.put(t.getRes(), processService.queryTenantCodeByResName(t.getRes(), ResourceType.FILE)) |
|
|
|
|
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// get the resource id in order to get the resource names in batch
|
|
|
|
// get the resource id in order to get the resource names in batch
|
|
|
@ -386,13 +385,13 @@ public class TaskPriorityQueueConsumer extends Thread{ |
|
|
|
Integer[] resourceIds = resourceIdsSet.toArray(new Integer[resourceIdsSet.size()]); |
|
|
|
Integer[] resourceIds = resourceIdsSet.toArray(new Integer[resourceIdsSet.size()]); |
|
|
|
|
|
|
|
|
|
|
|
List<Resource> resources = processService.listResourceByIds(resourceIds); |
|
|
|
List<Resource> resources = processService.listResourceByIds(resourceIds); |
|
|
|
resourceFullNameList.addAll(resources.stream() |
|
|
|
resources.forEach( |
|
|
|
.map(resourceInfo -> resourceInfo.getFullName()) |
|
|
|
(t)->resourceMap.put(t.getFullName(),processService.queryTenantCodeByResName(t.getFullName(), ResourceType.FILE)) |
|
|
|
.collect(Collectors.toList())); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return resourceFullNameList; |
|
|
|
return resourceMap; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|