Search in sources :

Example 1 with EScheduleJobType

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);
}
Also used : EScheduleJobType(com.dtstack.taier.common.enums.EScheduleJobType) RdosDefineException(com.dtstack.taier.common.exception.RdosDefineException)

Example 2 with EScheduleJobType

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;
}
Also used : EScheduleJobType(com.dtstack.taier.common.enums.EScheduleJobType)

Example 3 with EScheduleJobType

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;
}
Also used : EScheduleJobType(com.dtstack.taier.common.enums.EScheduleJobType) ArrayList(java.util.ArrayList) Component(com.dtstack.taier.dao.domain.Component) EComponentType(com.dtstack.taier.common.enums.EComponentType) HashSet(java.util.HashSet)

Example 4 with EScheduleJobType

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 "";
}
Also used : EScheduleJobType(com.dtstack.taier.common.enums.EScheduleJobType) Dict(com.dtstack.taier.dao.domain.Dict) EComponentType(com.dtstack.taier.common.enums.EComponentType)

Example 5 with EScheduleJobType

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;
}
Also used : EScheduleJobType(com.dtstack.taier.common.enums.EScheduleJobType) JSONObject(com.alibaba.fastjson.JSONObject) RdosDefineException(com.dtstack.taier.common.exception.RdosDefineException) Queue(com.dtstack.taier.dao.domain.Queue) EComponentType(com.dtstack.taier.common.enums.EComponentType)

Aggregations

EScheduleJobType (com.dtstack.taier.common.enums.EScheduleJobType)7 EComponentType (com.dtstack.taier.common.enums.EComponentType)3 RdosDefineException (com.dtstack.taier.common.exception.RdosDefineException)2 Component (com.dtstack.taier.dao.domain.Component)2 JSONObject (com.alibaba.fastjson.JSONObject)1 Dict (com.dtstack.taier.dao.domain.Dict)1 Queue (com.dtstack.taier.dao.domain.Queue)1 TaskParamTemplate (com.dtstack.taier.dao.domain.TaskParamTemplate)1 ReturnTaskSupportTypesVO (com.dtstack.taier.develop.vo.schedule.ReturnTaskSupportTypesVO)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1