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;
}
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);
}
Aggregations