use of com.dtstack.taier.common.enums.EScheduleType in project Taier by DTStack.
the class JobSchedulerListener method getAllNodesJobQueueInfo.
/**
* 同步所有节点的 type类型下的 job实例信息
* key1: nodeAddress,
* key2: scheduleType
*/
public Map<String, Map<Integer, QueueInfo>> getAllNodesJobQueueInfo() {
List<String> allNodeAddress = zkService.getAliveBrokersChildren();
Pair<String, String> cycTime = getCycTimeLimit();
Map<String, Map<Integer, QueueInfo>> allNodeJobInfo = Maps.newHashMap();
for (String nodeAddress : allNodeAddress) {
if (StringUtils.isBlank(nodeAddress)) {
continue;
}
allNodeJobInfo.computeIfAbsent(nodeAddress, na -> {
Map<Integer, QueueInfo> nodeJobInfo = Maps.newHashMap();
for (EScheduleType scheduleType : EScheduleType.values()) {
executors.forEach(executor -> nodeJobInfo.computeIfAbsent(scheduleType.getType(), k -> {
int queueSize = scheduleJobMapper.countTasksByCycTimeTypeAndAddress(nodeAddress, scheduleType.getType(), cycTime.getLeft(), cycTime.getRight());
QueueInfo queueInfo = new QueueInfo();
queueInfo.setSize(queueSize);
return queueInfo;
}));
}
return nodeJobInfo;
});
}
return allNodeJobInfo;
}
Aggregations