use of com.dtstack.taier.common.enums.EScheduleJobType in project Taier by DTStack.
the class CommonResource method newInstance.
public ComputeResourceType newInstance(JobClient jobClient) {
EScheduleJobType taskType = EScheduleJobType.getByTaskType(jobClient.getTaskType());
CommonResource resource = resources.computeIfAbsent(taskType, k -> {
CommonResource commonResource = null;
switch(taskType) {
case SYNC:
commonResource = new FlinkResource();
commonResource.setClusterMapper(clusterMapper);
commonResource.setClusterService(clusterService);
commonResource.setComponentService(componentService);
commonResource.setClusterTenantMapper(clusterTenantMapper);
break;
case SPARK_SQL:
case SPARK:
commonResource = this;
break;
default:
throw new RdosDefineException("taskType:" + taskType + " is not support.");
}
return commonResource;
});
return resource.getComputeResourceType(jobClient);
}
use of com.dtstack.taier.common.enums.EScheduleJobType in project Taier by DTStack.
the class JobComputeResourcePlain method getJobResource.
public String getJobResource(JobClient jobClient) {
this.buildJobClientGroupName(jobClient);
ComputeResourceType computeResourceType = commonResource.newInstance(jobClient);
String plainType = environmentContext.getComputeResourcePlain();
String jobResource = null;
EScheduleJobType scheduleJobType = EScheduleJobType.getByTaskType(jobClient.getTaskType());
if (ComputeResourcePlain.EngineTypeClusterQueue.name().equalsIgnoreCase(plainType)) {
jobResource = scheduleJobType.name().toLowerCase() + SPLIT + jobClient.getGroupName();
} else {
jobResource = scheduleJobType.name().toLowerCase() + SPLIT + jobClient.getGroupName() + SPLIT + jobClient.getComputeType().name().toLowerCase();
}
String type = EScheduleType.TEMP_JOB.getType().equals(jobClient.getType()) ? jobClient.getType() + "" : "";
return jobResource + SPLIT + computeResourceType.name() + type;
}
use of com.dtstack.taier.common.enums.EScheduleJobType in project Taier by DTStack.
the class ComponentService method getComponentVersionByEngineType.
public List<Component> getComponentVersionByEngineType(Long tenantId, Integer taskType) {
EScheduleJobType scheduleJobType = EScheduleJobType.getByTaskType(taskType);
EComponentType componentType = scheduleJobType.getComponentType();
List<Component> componentVersionList = componentMapper.getComponentVersionByEngineType(tenantId, componentType.getTypeCode());
if (CollectionUtils.isEmpty(componentVersionList)) {
return Collections.emptyList();
}
Set<String> distinct = new HashSet<>(2);
List<Component> components = new ArrayList<>(2);
for (Component component : componentVersionList) {
if (distinct.add(component.getVersionValue())) {
components.add(component);
}
}
return components;
}
use of com.dtstack.taier.common.enums.EScheduleJobType in project Taier by DTStack.
the class ScheduleDictService method convertVersionNameToValue.
public String convertVersionNameToValue(String componentVersion, Integer taskType) {
if (StringUtils.isBlank(componentVersion)) {
return "";
}
EScheduleJobType scheduleJobType = EScheduleJobType.getByTaskType(taskType);
EComponentType componentType = scheduleJobType.getComponentType();
Integer dictType = DictType.getByEComponentType(componentType);
if (null != dictType) {
Dict versionDict = getByNameAndValue(dictType, componentVersion.trim(), null, null);
if (null != versionDict) {
return versionDict.getDictValue();
}
}
return "";
}
use of com.dtstack.taier.common.enums.EScheduleJobType in project Taier by DTStack.
the class ClusterService method pluginInfoJSON.
/**
* 内部使用
*/
public JSONObject pluginInfoJSON(Long tenantId, Integer taskType, Integer deployMode, String componentVersion) {
EScheduleJobType engineJobType = EScheduleJobType.getByTaskType(taskType);
EComponentType componentType = engineJobType.getComponentType();
if (componentType == null) {
return null;
}
Long clusterId = clusterTenantMapper.getClusterIdByTenantId(tenantId);
if (null == clusterId) {
clusterId = DEFAULT_CLUSTER_ID;
}
JSONObject clusterConfigJson = buildClusterConfig(clusterId, componentVersion, componentType);
JSONObject pluginJson = convertPluginInfo(clusterConfigJson, componentType, clusterId, deployMode);
if (pluginJson == null) {
throw new RdosDefineException(format("The cluster is not configured [%s] engine", componentType));
}
Queue queue = getQueue(tenantId, clusterId);
pluginJson.put(QUEUE, queue == null ? "" : queue.getQueueName());
setComponentSftpDir(clusterId, clusterConfigJson, pluginJson, componentType);
return pluginJson;
}
Aggregations