fix(forest): 修复 yarn 查询集群信息顺序不对
Set 这个结构不保顺序,疏忽了,改回使用 List,不然查询的顺序和返回结果的顺序不一致
This commit is contained in:
@@ -19,7 +19,6 @@ import java.util.concurrent.Executors;
|
||||
import java.util.function.Function;
|
||||
import org.eclipse.collections.api.factory.Lists;
|
||||
import org.eclipse.collections.api.factory.Maps;
|
||||
import org.eclipse.collections.api.factory.Sets;
|
||||
import org.eclipse.collections.api.list.ImmutableList;
|
||||
import org.eclipse.collections.api.map.ImmutableMap;
|
||||
import org.slf4j.Logger;
|
||||
@@ -70,7 +69,7 @@ public class YarnController extends BaseController {
|
||||
boolean isSearchId = StrUtil.isNotBlank(searchId);
|
||||
boolean isSearchName = StrUtil.isNotBlank(searchName);
|
||||
Comparator<YarnApplication> comparator = ComparatorUtil.longComparator(order, direction, SORT_MAP);
|
||||
ImmutableList<YarnApplication> applications = yarnClusterService.jobList(Sets.immutable.ofAll(clusters))
|
||||
ImmutableList<YarnApplication> applications = yarnClusterService.jobList(Lists.immutable.ofAll(clusters))
|
||||
.asParallel(EXECUTOR, 1)
|
||||
.select(app -> !isFilterState || ObjectUtil.contains(filterState, app.getState()))
|
||||
.select(app -> !isFilterFinalStatus || ObjectUtil.contains(filterFinalStatus, app.getFinalStatus()))
|
||||
@@ -91,7 +90,7 @@ public class YarnController extends BaseController {
|
||||
|
||||
@GetMapping("job_current")
|
||||
public AmisResponse jobCurrent(@RequestParam("clusters") List<String> clusters, @RequestParam("name") String name) {
|
||||
Optional<YarnApplication> currentApp = yarnClusterService.jobListEquals(Sets.immutable.ofAll(clusters), name)
|
||||
Optional<YarnApplication> currentApp = yarnClusterService.jobListEquals(Lists.immutable.ofAll(clusters), name)
|
||||
.asParallel(EXECUTOR, 1)
|
||||
.select(app -> ObjectUtil.equals(app.getState(), "RUNNING"))
|
||||
.toSortedList(ComparatorUtil.longComparator("startedTime", ComparatorUtil.DESC, SORT_MAP))
|
||||
@@ -109,7 +108,7 @@ public class YarnController extends BaseController {
|
||||
public AmisResponse queueList(@RequestParam("clusters") List<String> clusters, @RequestParam(value = "names", defaultValue = "") String names) {
|
||||
boolean isFilterNames = StrUtil.isNotBlank(names);
|
||||
ImmutableList<String> filterNames = Lists.immutable.of(names.split(","));
|
||||
ImmutableList<YarnClusterVO> results = yarnClusterService.services(Sets.immutable.ofAll(clusters))
|
||||
ImmutableList<YarnClusterVO> results = yarnClusterService.services(Lists.immutable.ofAll(clusters))
|
||||
.asParallel(EXECUTOR, 1)
|
||||
.collect(yarnService -> {
|
||||
YarnRootQueue cluster = yarnService.cluster();
|
||||
@@ -123,11 +122,11 @@ public class YarnController extends BaseController {
|
||||
|
||||
@GetMapping("queue_names")
|
||||
public AmisResponse queueNames(@RequestParam("clusters") List<String> clusters) {
|
||||
return responseData(MapUtil.of("queueNames", yarnClusterService.queueList(Sets.immutable.ofAll(clusters)).collect(YarnQueue::getQueueName)));
|
||||
return responseData(MapUtil.of("queueNames", yarnClusterService.queueList(Lists.immutable.ofAll(clusters)).collect(YarnQueue::getQueueName)));
|
||||
}
|
||||
|
||||
@GetMapping("clusters")
|
||||
public AmisResponse clusters(@RequestParam("clusters") List<String> clusters) {
|
||||
return responseData(MapUtil.of("cluster", yarnClusterService.cluster(Sets.immutable.ofAll(clusters))));
|
||||
return responseData(MapUtil.of("cluster", yarnClusterService.cluster(Lists.immutable.ofAll(clusters))));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user