Search in sources :

Example 21 with EComponentType

use of com.dtstack.taier.common.enums.EComponentType in project Taier by DTStack.

the class ConsoleComponentService method convertComponentTypeToClient.

/**
 * 根据组件类型转换对应的插件名称
 * 如果只配yarn 需要调用插件时候 hdfs给默认值
 *
 * @param clusterName
 * @param componentType
 * @param versionName
 * @return
 */
public String convertComponentTypeToClient(String clusterName, Integer componentType, String versionName, Integer storeType, Integer deployType) {
    Cluster cluster = clusterMapper.getByClusterName(clusterName);
    EComponentType type = EComponentType.getByCode(componentType);
    EComponentType storeComponent = null == storeType ? null : EComponentType.getByCode(storeType);
    PartCluster partCluster = clusterFactory.newImmediatelyLoadCluster(cluster.getId());
    Part part = partCluster.create(type, versionName, storeComponent, deployType);
    return part.getPluginName();
}
Also used : PartCluster(com.dtstack.taier.develop.model.PartCluster) Part(com.dtstack.taier.develop.model.Part) PartCluster(com.dtstack.taier.develop.model.PartCluster) EComponentType(com.dtstack.taier.common.enums.EComponentType)

Example 22 with EComponentType

use of com.dtstack.taier.common.enums.EComponentType in project Taier by DTStack.

the class ConsoleClusterService method convertComponentToScheduling.

private List<SchedulingVo> convertComponentToScheduling(Table<Integer, String, KerberosConfig> kerberosTable, Map<EComponentScheduleType, List<IComponentVO>> scheduleType) {
    List<SchedulingVo> schedulingVos = new ArrayList<>();
    // 为空也返回
    for (EComponentScheduleType value : EComponentScheduleType.values()) {
        SchedulingVo schedulingVo = new SchedulingVo();
        schedulingVo.setSchedulingCode(value.getType());
        schedulingVo.setSchedulingName(value.getName());
        List<IComponentVO> componentVoList = scheduleType.getOrDefault(value, Collections.emptyList());
        if (Objects.nonNull(kerberosTable) && !kerberosTable.isEmpty() && CollectionUtils.isNotEmpty(componentVoList)) {
            componentVoList.forEach(component -> {
                // 组件每个版本设置k8s参数
                for (ComponentVO componentVO : component.loadComponents()) {
                    KerberosConfig kerberosConfig;
                    EComponentType type = EComponentType.getByCode(componentVO.getComponentTypeCode());
                    if (type == EComponentType.YARN || type == EComponentType.SPARK_THRIFT || type == EComponentType.HIVE_SERVER) {
                        kerberosConfig = kerberosTable.get(type.getTypeCode(), StringUtils.EMPTY);
                    } else {
                        kerberosConfig = kerberosTable.get(componentVO.getComponentTypeCode(), StringUtils.isBlank(componentVO.getVersionValue()) ? StringUtils.EMPTY : componentVO.getVersionValue());
                    }
                    if (Objects.nonNull(kerberosConfig)) {
                        componentVO.setPrincipal(kerberosConfig.getPrincipal());
                        componentVO.setPrincipals(kerberosConfig.getPrincipals());
                        componentVO.setMergeKrb5Content(kerberosConfig.getMergeKrbContent());
                    }
                }
            });
        }
        schedulingVo.setComponents(componentVoList);
        schedulingVos.add(schedulingVo);
    }
    return schedulingVos;
}
Also used : IComponentVO(com.dtstack.taier.scheduler.vo.IComponentVO) IComponentVO(com.dtstack.taier.scheduler.vo.IComponentVO) ComponentVO(com.dtstack.taier.scheduler.vo.ComponentVO) EComponentScheduleType(com.dtstack.taier.common.enums.EComponentScheduleType) KerberosConfig(com.dtstack.taier.dao.domain.KerberosConfig) SchedulingVo(com.dtstack.taier.scheduler.vo.SchedulingVo) EComponentType(com.dtstack.taier.common.enums.EComponentType)

Example 23 with EComponentType

use of com.dtstack.taier.common.enums.EComponentType in project Taier by DTStack.

the class StoragePart method getExtraVersionParameters.

@Override
public Long getExtraVersionParameters() {
    Component resourceComponent = componentScheduleGroup.get(EComponentScheduleType.RESOURCE).get(0);
    String resourceVersion = resourceComponent.getVersionName();
    EComponentType resourceType = EComponentType.getByCode(resourceComponent.getComponentTypeCode());
    Optional<JSONObject> resourceModelExtraVersionParameters = context.getModelExtraVersionParameters(resourceType, resourceVersion);
    if (resourceModelExtraVersionParameters.isPresent()) {
        return resourceModelExtraVersionParameters.map(res -> res.getJSONObject(type.name())).orElse(new JSONObject()).getLong(type.name());
    }
    return null;
}
Also used : JSONObject(com.alibaba.fastjson.JSONObject) Component(com.dtstack.taier.dao.domain.Component) EComponentType(com.dtstack.taier.common.enums.EComponentType)

Aggregations

EComponentType (com.dtstack.taier.common.enums.EComponentType)23 JSONObject (com.alibaba.fastjson.JSONObject)10 RdosDefineException (com.dtstack.taier.common.exception.RdosDefineException)10 Component (com.dtstack.taier.dao.domain.Component)9 ComponentVO (com.dtstack.taier.scheduler.vo.ComponentVO)4 EScheduleJobType (com.dtstack.taier.common.enums.EScheduleJobType)3 Part (com.dtstack.taier.develop.model.Part)3 PartCluster (com.dtstack.taier.develop.model.PartCluster)3 EComponentScheduleType (com.dtstack.taier.common.enums.EComponentScheduleType)2 Cluster (com.dtstack.taier.dao.domain.Cluster)2 Dict (com.dtstack.taier.dao.domain.Dict)2 KerberosConfig (com.dtstack.taier.dao.domain.KerberosConfig)2 IComponentService (com.dtstack.taier.develop.service.develop.IComponentService)2 ClientTemplate (com.dtstack.taier.scheduler.impl.pojo.ClientTemplate)2 IComponentVO (com.dtstack.taier.scheduler.vo.IComponentVO)2 Map (java.util.Map)2 Transactional (org.springframework.transaction.annotation.Transactional)2 ErrorCode (com.dtstack.taier.common.exception.ErrorCode)1 Strings (com.dtstack.taier.common.util.Strings)1 com.dtstack.taier.dao.domain (com.dtstack.taier.dao.domain)1