refactor(web): 优化 yarn 信息的获取
This commit is contained in:
@@ -96,8 +96,8 @@ public class YarnClusterService {
|
||||
return Lists.immutable.empty();
|
||||
}
|
||||
return clusters.collect(this::service)
|
||||
.asParallel(EXECUTOR, 1)
|
||||
.reject(ObjectUtil::isNull)
|
||||
.asParallel(EXECUTOR, 1)
|
||||
.flatCollect(getter::apply)
|
||||
.toList()
|
||||
.toImmutable();
|
||||
@@ -113,19 +113,14 @@ public class YarnClusterService {
|
||||
return servicesMap.containsKey(cluster) ? service(cluster).queueList() : Lists.immutable.empty();
|
||||
}
|
||||
|
||||
public ImmutableMap<String, ImmutableList<YarnQueue>> queueList(ImmutableSet<String> clusters) {
|
||||
public ImmutableList<YarnQueue> queueList(ImmutableSet<String> clusters) {
|
||||
//noinspection DataFlowIssue
|
||||
return clusters
|
||||
.select(servicesMap::containsKey)
|
||||
.asParallel(EXECUTOR, 1)
|
||||
.collect(cluster -> {
|
||||
YarnService service = service(cluster);
|
||||
@SuppressWarnings("DataFlowIssue")
|
||||
ImmutableList<YarnQueue> queues = service.queueList();
|
||||
return new Pair<>(cluster, queues);
|
||||
})
|
||||
.toMap(Pair::getKey, Pair::getValue)
|
||||
.flatCollect(cluster -> service(cluster).queueList())
|
||||
.toList()
|
||||
.toImmutable();
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("DataFlowIssue")
|
||||
@@ -133,17 +128,13 @@ public class YarnClusterService {
|
||||
return servicesMap.containsKey(cluster) ? service(cluster).queueDetail(name) : null;
|
||||
}
|
||||
|
||||
public ImmutableMap<String, YarnQueue> queueDetail(ImmutableSet<String> clusters, String name) {
|
||||
public ImmutableList<YarnQueue> queueDetail(ImmutableSet<String> clusters, String name) {
|
||||
//noinspection DataFlowIssue
|
||||
return clusters
|
||||
.select(servicesMap::containsKey)
|
||||
.asParallel(EXECUTOR, 1)
|
||||
.collect(cluster -> {
|
||||
YarnService service = service(cluster);
|
||||
@SuppressWarnings("DataFlowIssue")
|
||||
YarnQueue queue = service.queueDetail(name);
|
||||
return new Pair<>(cluster, queue);
|
||||
})
|
||||
.toMap(Pair::getKey, Pair::getValue)
|
||||
.collect(cluster -> service(cluster).queueDetail(name))
|
||||
.toList()
|
||||
.toImmutable();
|
||||
}
|
||||
|
||||
@@ -152,18 +143,13 @@ public class YarnClusterService {
|
||||
return servicesMap.containsKey(cluster) ? service(cluster).cluster() : null;
|
||||
}
|
||||
|
||||
public ImmutableMap<String, YarnRootQueue> cluster(ImmutableSet<String> clusters) {
|
||||
public ImmutableList<YarnRootQueue> cluster(ImmutableSet<String> clusters) {
|
||||
//noinspection DataFlowIssue
|
||||
return clusters
|
||||
.select(servicesMap::containsKey)
|
||||
.asParallel(EXECUTOR, 1)
|
||||
.collect(cluster -> {
|
||||
YarnService service = service(cluster);
|
||||
@SuppressWarnings("DataFlowIssue")
|
||||
YarnRootQueue queues = service.cluster();
|
||||
return new Pair<>(cluster, queues);
|
||||
})
|
||||
.toMap(Pair::getKey, Pair::getValue)
|
||||
.collect(cluster -> service(cluster).cluster())
|
||||
.toList()
|
||||
.toImmutable();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user