Search in sources :

Example 1 with ClusterEngineVO

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

the class ConsoleClusterService method fillEngineQueueInfo.

private ClusterEngineVO fillEngineQueueInfo(Map<Long, Set<MultiEngineType>> clusterEngineMapping, Map<Long, List<Queue>> engineQueueMapping, Cluster cluster) {
    ClusterEngineVO vo = ClusterEngineVO.toVO(cluster);
    Set<MultiEngineType> engineList = clusterEngineMapping.get(vo.getClusterId());
    if (CollectionUtils.isNotEmpty(engineList)) {
        List<EngineVO> engineVOS = new ArrayList<>();
        for (MultiEngineType multiEngineType : engineList) {
            EngineVO engineVO = new EngineVO();
            engineVO.setEngineType(multiEngineType.getType());
            engineVO.setEngineName(multiEngineType.getName());
            engineVO.setClusterId(cluster.getId());
            if (MultiEngineType.HADOOP.equals(multiEngineType)) {
                engineVO.setQueues(QueueVO.toVOs(engineQueueMapping.get(cluster.getId())));
            }
            engineVOS.add(engineVO);
        }
        engineVOS.sort(Comparator.comparingInt(EngineVO::getEngineType));
        vo.setEngines(engineVOS);
    }
    return vo;
}
Also used : MultiEngineType(com.dtstack.taier.common.enums.MultiEngineType) ClusterEngineVO(com.dtstack.taier.develop.vo.console.ClusterEngineVO) EngineVO(com.dtstack.taier.develop.vo.console.EngineVO) ClusterEngineVO(com.dtstack.taier.develop.vo.console.ClusterEngineVO)

Example 2 with ClusterEngineVO

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

the class ConsoleClusterService method getClusterEngine.

public ClusterEngineVO getClusterEngine(Long clusterId) {
    Cluster cluster = clusterMapper.selectById(clusterId);
    List<com.dtstack.taier.dao.domain.Component> components = componentService.listAllComponents(clusterId);
    Map<Long, Set<MultiEngineType>> clusterEngineMapping = new HashMap<>();
    if (CollectionUtils.isNotEmpty(components)) {
        clusterEngineMapping = components.stream().filter(c -> {
            MultiEngineType multiEngineType = EComponentType.getEngineTypeByComponent(EComponentType.getByCode(c.getComponentTypeCode()), c.getDeployType());
            return null != multiEngineType && !MultiEngineType.COMMON.equals(multiEngineType);
        }).collect(Collectors.groupingBy(com.dtstack.taier.dao.domain.Component::getClusterId, Collectors.mapping(c -> EComponentType.getEngineTypeByComponent(EComponentType.getByCode(c.getComponentTypeCode()), c.getDeployType()), Collectors.toSet())));
    }
    List<com.dtstack.taier.dao.domain.Queue> queues = consoleQueueMapper.listByClusterWithLeaf(clusterId);
    Map<Long, List<com.dtstack.taier.dao.domain.Queue>> engineQueueMapping = queues.stream().collect(Collectors.groupingBy(Queue::getClusterId));
    return fillEngineQueueInfo(clusterEngineMapping, engineQueueMapping, cluster);
}
Also used : java.util(java.util) QueueVO(com.dtstack.taier.develop.vo.console.QueueVO) IComponentVO(com.dtstack.taier.scheduler.vo.IComponentVO) KerberosConfig(com.dtstack.taier.dao.domain.KerberosConfig) com.dtstack.taier.dao.mapper(com.dtstack.taier.dao.mapper) Autowired(org.springframework.beans.factory.annotation.Autowired) RdosDefineException(com.dtstack.taier.common.exception.RdosDefineException) HashBasedTable(com.google.common.collect.HashBasedTable) StringUtils(org.apache.commons.lang3.StringUtils) ComponentService(com.dtstack.taier.scheduler.service.ComponentService) Queue(com.dtstack.taier.dao.domain.Queue) CollectionUtils(org.apache.commons.collections.CollectionUtils) EComponentScheduleType(com.dtstack.taier.common.enums.EComponentScheduleType) ClusterVO(com.dtstack.taier.develop.vo.console.ClusterVO) DEFAULT_CLUSTER_ID(com.dtstack.taier.pluginapi.constrant.ConfigConstant.DEFAULT_CLUSTER_ID) ErrorCode(com.dtstack.taier.common.exception.ErrorCode) Wrappers(com.baomidou.mybatisplus.core.toolkit.Wrappers) Cluster(com.dtstack.taier.dao.domain.Cluster) ClusterTenant(com.dtstack.taier.dao.domain.ClusterTenant) ClusterEngineVO(com.dtstack.taier.develop.vo.console.ClusterEngineVO) SchedulingVo(com.dtstack.taier.scheduler.vo.SchedulingVo) Collectors(java.util.stream.Collectors) EComponentType(com.dtstack.taier.common.enums.EComponentType) Page(com.baomidou.mybatisplus.extension.plugins.pagination.Page) Component(org.springframework.stereotype.Component) ComponentVO(com.dtstack.taier.scheduler.vo.ComponentVO) MultiEngineType(com.dtstack.taier.common.enums.MultiEngineType) ComponentConfigService(com.dtstack.taier.scheduler.service.ComponentConfigService) IPage(com.baomidou.mybatisplus.core.metadata.IPage) Table(com.google.common.collect.Table) Deleted(com.dtstack.taier.common.enums.Deleted) EngineVO(com.dtstack.taier.develop.vo.console.EngineVO) MultiEngineType(com.dtstack.taier.common.enums.MultiEngineType) Cluster(com.dtstack.taier.dao.domain.Cluster) Component(org.springframework.stereotype.Component) Queue(com.dtstack.taier.dao.domain.Queue)

Aggregations

MultiEngineType (com.dtstack.taier.common.enums.MultiEngineType)2 ClusterEngineVO (com.dtstack.taier.develop.vo.console.ClusterEngineVO)2 EngineVO (com.dtstack.taier.develop.vo.console.EngineVO)2 IPage (com.baomidou.mybatisplus.core.metadata.IPage)1 Wrappers (com.baomidou.mybatisplus.core.toolkit.Wrappers)1 Page (com.baomidou.mybatisplus.extension.plugins.pagination.Page)1 Deleted (com.dtstack.taier.common.enums.Deleted)1 EComponentScheduleType (com.dtstack.taier.common.enums.EComponentScheduleType)1 EComponentType (com.dtstack.taier.common.enums.EComponentType)1 ErrorCode (com.dtstack.taier.common.exception.ErrorCode)1 RdosDefineException (com.dtstack.taier.common.exception.RdosDefineException)1 Cluster (com.dtstack.taier.dao.domain.Cluster)1 ClusterTenant (com.dtstack.taier.dao.domain.ClusterTenant)1 KerberosConfig (com.dtstack.taier.dao.domain.KerberosConfig)1 Queue (com.dtstack.taier.dao.domain.Queue)1 com.dtstack.taier.dao.mapper (com.dtstack.taier.dao.mapper)1 ClusterVO (com.dtstack.taier.develop.vo.console.ClusterVO)1 QueueVO (com.dtstack.taier.develop.vo.console.QueueVO)1 DEFAULT_CLUSTER_ID (com.dtstack.taier.pluginapi.constrant.ConfigConstant.DEFAULT_CLUSTER_ID)1 ComponentConfigService (com.dtstack.taier.scheduler.service.ComponentConfigService)1