use of com.dtstack.taier.dao.domain.Queue in project Taier by DTStack.
the class TenantService method bindingQueue.
/**
* 绑定/切换队列
*/
@Transactional(rollbackFor = Exception.class)
public void bindingQueue(String queueName, Long clusterId, Long tenantId) {
List<Queue> queues = consoleQueueMapper.listByClusterId(clusterId);
Optional<Queue> queueOptional = queues.stream().filter(queue -> queue.getQueueName().equals(queueName)).findFirst();
if (!queueOptional.isPresent()) {
throw new RdosDefineException("Queue does not exist", ErrorCode.DATA_NOT_FIND);
}
Queue queue = queueOptional.get();
Long queueId = queue.getId();
try {
LOGGER.info("switch queue, tenantId:{} queueId:{} queueName:{} clusterId:{}", tenantId, queueId, queue.getQueueName(), queue.getClusterId());
updateTenantQueue(tenantId, queue.getClusterId(), queueId);
} catch (Exception e) {
LOGGER.error("", e);
throw new RdosDefineException("Failed to switch queue");
}
}
use of com.dtstack.taier.dao.domain.Queue 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);
}
use of com.dtstack.taier.dao.domain.Queue in project Taier by DTStack.
the class JobComputeResourcePlain method buildJobClientGroupName.
private void buildJobClientGroupName(JobClient jobClient) {
Long clusterId = clusterTenantMapper.getClusterIdByTenantId(jobClient.getTenantId());
if (null == clusterId) {
return;
}
Cluster cluster = clusterMapper.getOne(clusterId);
if (null == cluster) {
return;
}
String clusterName = cluster.getClusterName();
// %s_default
String groupName = clusterName + SPLIT + RESOURCE_NAMESPACE_OR_QUEUE_DEFAULT;
Queue queue = clusterService.getQueue(jobClient.getTenantId(), clusterId);
if (null != queue) {
groupName = clusterName + SPLIT + queue.getQueueName();
}
jobClient.setGroupName(groupName);
}
Aggregations