Search in sources :

Example 1 with ClusterVO

use of com.dtstack.taier.develop.vo.console.ClusterVO in project Taier by DTStack.

the class ConsoleClusterService method getConsoleClusterInfo.

/**
 * 获取集群信息详情 需要根据组件分组
 *
 * @param clusterId
 * @return
 */
public ClusterVO getConsoleClusterInfo(Long clusterId) {
    Cluster cluster = clusterMapper.getOne(clusterId);
    if (null == cluster) {
        return new ClusterVO();
    }
    ClusterVO clusterVO = ClusterVO.toVO(cluster);
    // 查询默认版本或者多个版本
    List<com.dtstack.taier.dao.domain.Component> components = componentMapper.listByClusterId(clusterId, null, false);
    List<IComponentVO> componentConfigs = componentConfigService.getComponentVoByComponent(components, true, clusterId, true, true);
    Table<Integer, String, KerberosConfig> kerberosTable = null;
    // kerberos的配置
    kerberosTable = HashBasedTable.create();
    for (KerberosConfig kerberosConfig : consoleKerberosMapper.getByClusters(clusterId)) {
        kerberosTable.put(kerberosConfig.getComponentType(), StringUtils.isBlank(kerberosConfig.getComponentVersion()) ? StringUtils.EMPTY : kerberosConfig.getComponentVersion(), kerberosConfig);
    }
    Map<EComponentScheduleType, List<IComponentVO>> scheduleType = new HashMap<>(4);
    // 组件根据用途分组(计算,资源)
    if (CollectionUtils.isNotEmpty(componentConfigs)) {
        scheduleType = componentConfigs.stream().collect(Collectors.groupingBy(c -> EComponentType.getScheduleTypeByComponent(c.getComponentTypeCode())));
    }
    List<SchedulingVo> schedulingVos = convertComponentToScheduling(kerberosTable, scheduleType);
    clusterVO.setScheduling(schedulingVos);
    clusterVO.setCanModifyMetadata(checkMetadata(clusterId, components));
    return clusterVO;
}
Also used : IComponentVO(com.dtstack.taier.scheduler.vo.IComponentVO) ClusterVO(com.dtstack.taier.develop.vo.console.ClusterVO) KerberosConfig(com.dtstack.taier.dao.domain.KerberosConfig) Cluster(com.dtstack.taier.dao.domain.Cluster) EComponentScheduleType(com.dtstack.taier.common.enums.EComponentScheduleType) SchedulingVo(com.dtstack.taier.scheduler.vo.SchedulingVo) Component(org.springframework.stereotype.Component)

Aggregations

EComponentScheduleType (com.dtstack.taier.common.enums.EComponentScheduleType)1 Cluster (com.dtstack.taier.dao.domain.Cluster)1 KerberosConfig (com.dtstack.taier.dao.domain.KerberosConfig)1 ClusterVO (com.dtstack.taier.develop.vo.console.ClusterVO)1 IComponentVO (com.dtstack.taier.scheduler.vo.IComponentVO)1 SchedulingVo (com.dtstack.taier.scheduler.vo.SchedulingVo)1 Component (org.springframework.stereotype.Component)1