refactor(web): 优化部署打包方案
This commit is contained in:
@@ -8,27 +8,26 @@ import com.lanyuanxiaoyao.service.configuration.ExecutorProvider;
|
||||
import com.lanyuanxiaoyao.service.configuration.entity.info.JobIdAndAlias;
|
||||
import com.lanyuanxiaoyao.service.configuration.entity.monitor.MetricsProgress;
|
||||
import com.lanyuanxiaoyao.service.configuration.entity.yarn.YarnApplication;
|
||||
import com.lanyuanxiaoyao.service.configuration.entity.yarn.YarnQueue;
|
||||
import com.lanyuanxiaoyao.service.configuration.entity.yarn.YarnRootQueue;
|
||||
import com.lanyuanxiaoyao.service.configuration.entity.zookeeper.ZookeeperNode;
|
||||
import com.lanyuanxiaoyao.service.forest.service.InfoService;
|
||||
import com.lanyuanxiaoyao.service.forest.service.MonitorService;
|
||||
import com.lanyuanxiaoyao.service.forest.service.QueueService;
|
||||
import com.lanyuanxiaoyao.service.forest.service.ScheduleService;
|
||||
import com.lanyuanxiaoyao.service.forest.service.YarnService;
|
||||
import com.lanyuanxiaoyao.service.forest.service.ZookeeperService;
|
||||
import com.lanyuanxiaoyao.service.forest.service.*;
|
||||
import com.lanyuanxiaoyao.service.web.controller.base.AmisCrudResponse;
|
||||
import com.lanyuanxiaoyao.service.web.controller.base.AmisMapResponse;
|
||||
import com.lanyuanxiaoyao.service.web.controller.base.AmisResponse;
|
||||
import com.lanyuanxiaoyao.service.web.controller.base.BaseController;
|
||||
import com.lanyuanxiaoyao.service.web.entity.JobIdAndAliasVO;
|
||||
import com.lanyuanxiaoyao.service.web.entity.ScheduleTimeVO;
|
||||
import com.lanyuanxiaoyao.service.web.entity.overview.TableCountVO;
|
||||
import com.lanyuanxiaoyao.service.web.entity.overview.TaskCountVO;
|
||||
import com.lanyuanxiaoyao.service.web.entity.overview.VersionCountVO;
|
||||
import com.lanyuanxiaoyao.service.web.entity.overview.YarnCountVO;
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import org.eclipse.collections.api.factory.Lists;
|
||||
import org.eclipse.collections.api.factory.Maps;
|
||||
import org.eclipse.collections.api.list.ImmutableList;
|
||||
import org.eclipse.collections.api.list.MutableList;
|
||||
import org.slf4j.Logger;
|
||||
@@ -67,7 +66,7 @@ public class OverviewController extends BaseController {
|
||||
}
|
||||
|
||||
@GetMapping("")
|
||||
public AmisMapResponse overview() throws ExecutionException, InterruptedException {
|
||||
public AmisCrudResponse overview() throws ExecutionException, InterruptedException {
|
||||
CompletableFuture<Long> tableCountFuture = CompletableFuture.supplyAsync(infoService::tableCount, ExecutorProvider.EXECUTORS);
|
||||
CompletableFuture<Long> tableFocusCountFuture = CompletableFuture.supplyAsync(infoService::tableFocusCount, ExecutorProvider.EXECUTORS);
|
||||
CompletableFuture<Long> hudiCountFuture = CompletableFuture.supplyAsync(infoService::hudiCount, ExecutorProvider.EXECUTORS);
|
||||
@@ -82,13 +81,12 @@ public class OverviewController extends BaseController {
|
||||
hiveCountFuture,
|
||||
hiveFocusCountFuture
|
||||
).get();
|
||||
return AmisResponse.responseMapData()
|
||||
.setData("table_count", tableCountFuture.get())
|
||||
.setData("table_focus_count", tableFocusCountFuture.get())
|
||||
.setData("hudi_count", hudiCountFuture.get())
|
||||
.setData("hudi_focus_count", hudiFocusCountFuture.get())
|
||||
.setData("hive_count", hiveCountFuture.get())
|
||||
.setData("hive_focus_count", hiveFocusCountFuture.get());
|
||||
ImmutableList<TableCountVO> list = Lists.immutable.of(
|
||||
new TableCountVO("逻辑表", tableCountFuture.get(), tableFocusCountFuture.get()),
|
||||
new TableCountVO("湖底表", hudiCountFuture.get(), hudiFocusCountFuture.get()),
|
||||
new TableCountVO("嗨福表", hiveCountFuture.get(), hiveFocusCountFuture.get())
|
||||
);
|
||||
return AmisResponse.responseCrudData(list);
|
||||
}
|
||||
|
||||
@GetMapping("yarn-job")
|
||||
@@ -99,7 +97,6 @@ public class OverviewController extends BaseController {
|
||||
.setData("name", cluster)
|
||||
.setData("total", applications.size())
|
||||
.setData("running", applications.count(app -> StrUtil.equals(app.getState(), "RUNNING")))
|
||||
.setData("running", applications.count(app -> StrUtil.equals(app.getState(), "RUNNING")))
|
||||
.setData("scheduling", applications.count(app -> StrUtil.equals(app.getState(), "ACCEPTED")))
|
||||
.setData("failure", applications.count(app -> StrUtil.equals(app.getState(), "FAILED")));
|
||||
}
|
||||
@@ -131,10 +128,13 @@ public class OverviewController extends BaseController {
|
||||
CompletableFuture<Long> unScheduledNormalTableCount = CompletableFuture.supplyAsync(() -> infoService.unScheduledNormalTableCount(version), ExecutorProvider.EXECUTORS);
|
||||
CompletableFuture<Long> unScheduledFocusTableCount = CompletableFuture.supplyAsync(() -> infoService.unScheduledFocusTableCount(version), ExecutorProvider.EXECUTORS);
|
||||
CompletableFuture.allOf(unReceiveNormalTableCount, unReceiveFocusCount, unScheduledNormalTableCount, unScheduledFocusTableCount).get();
|
||||
ImmutableList<VersionCountVO> list = Lists.immutable.of(
|
||||
new VersionCountVO("focus", "重点表", unReceiveFocusCount.get(), unScheduledFocusTableCount.get()),
|
||||
new VersionCountVO("normal", "普通表", unReceiveNormalTableCount.get(), unScheduledNormalTableCount.get())
|
||||
);
|
||||
return AmisResponse.responseMapData()
|
||||
.setData("version", version)
|
||||
.setData("unReceive", Maps.immutable.of("normal", unReceiveNormalTableCount.get(), "focus", unReceiveFocusCount.get()))
|
||||
.setData("unSchedule", Maps.immutable.of("normal", unScheduledNormalTableCount.get(), "focus", unScheduledFocusTableCount.get()));
|
||||
.setData("items", list);
|
||||
}
|
||||
|
||||
@GetMapping("version_detail")
|
||||
@@ -175,7 +175,7 @@ public class OverviewController extends BaseController {
|
||||
}
|
||||
|
||||
@GetMapping("sync_running_status")
|
||||
public AmisMapResponse syncRunningStatus() {
|
||||
public AmisCrudResponse syncRunningStatus() {
|
||||
ImmutableList<String> locks = zookeeperService.getChildren(NameHelper.ZK_SYNC_RUNNING_LOCK_PATH).collect(ZookeeperNode::getPath);
|
||||
MutableList<JobIdAndAlias> runningJob = Lists.mutable.<JobIdAndAlias>empty().asSynchronized();
|
||||
MutableList<JobIdAndAlias> unRunningJob = Lists.mutable.<JobIdAndAlias>empty().asSynchronized();
|
||||
@@ -203,17 +203,11 @@ public class OverviewController extends BaseController {
|
||||
unRunningTable.add(ia);
|
||||
}
|
||||
});
|
||||
return AmisResponse.responseMapData()
|
||||
.setData("totalJob", ids.size())
|
||||
.setData("runningJob", runningJob.size())
|
||||
.setData("runningJobList", runningJob)
|
||||
.setData("unRunningJob", unRunningJob.size())
|
||||
.setData("unRunningJobList", unRunningJob)
|
||||
.setData("totalTable", idAliases.size())
|
||||
.setData("runningTable", runningTable.size())
|
||||
.setData("runningTableList", runningTable)
|
||||
.setData("unRunningTable", unRunningTable.size())
|
||||
.setData("unRunningTableList", unRunningTable);
|
||||
ImmutableList<TaskCountVO> list = Lists.immutable.of(
|
||||
new TaskCountVO("同步任务数", ids.size(), runningJob.size(), unRunningJob.size(), unRunningJob.toImmutable()),
|
||||
new TaskCountVO("同步表数", idAliases.size(), runningTable.size(), unRunningTable.size(), unRunningTable.toImmutable())
|
||||
);
|
||||
return AmisResponse.responseCrudData(list);
|
||||
}
|
||||
|
||||
@GetMapping("monitor_progress")
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.lanyuanxiaoyao.service.web.entity.overview;
|
||||
|
||||
/**
|
||||
* @author lanyuanxiaoyao
|
||||
* @version 20250509
|
||||
*/
|
||||
public class TableCountVO {
|
||||
private final String type;
|
||||
private final Long total;
|
||||
private final Long focus;
|
||||
|
||||
public TableCountVO(String type, Long total, Long focus) {
|
||||
this.type = type;
|
||||
this.total = total;
|
||||
this.focus = focus;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public Long getTotal() {
|
||||
return total;
|
||||
}
|
||||
|
||||
public Long getFocus() {
|
||||
return focus;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "TableCountVO{" +
|
||||
"type='" + type + '\'' +
|
||||
", total=" + total +
|
||||
", focus=" + focus +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.lanyuanxiaoyao.service.web.entity.overview;
|
||||
|
||||
import com.lanyuanxiaoyao.service.configuration.entity.info.JobIdAndAlias;
|
||||
import org.eclipse.collections.api.list.ImmutableList;
|
||||
|
||||
/**
|
||||
* @author lanyuanxiaoyao
|
||||
* @version 20250509
|
||||
*/
|
||||
public class TaskCountVO {
|
||||
private final String type;
|
||||
private final Integer total;
|
||||
private final Integer running;
|
||||
private final Integer stopped;
|
||||
private final ImmutableList<JobIdAndAlias> list;
|
||||
|
||||
public TaskCountVO(String type, Integer total, Integer running, Integer stopped, ImmutableList<JobIdAndAlias> list) {
|
||||
this.type = type;
|
||||
this.total = total;
|
||||
this.running = running;
|
||||
this.stopped = stopped;
|
||||
this.list = list;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public Integer getTotal() {
|
||||
return total;
|
||||
}
|
||||
|
||||
public Integer getRunning() {
|
||||
return running;
|
||||
}
|
||||
|
||||
public Integer getStopped() {
|
||||
return stopped;
|
||||
}
|
||||
|
||||
public ImmutableList<JobIdAndAlias> getList() {
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "TaskCountVO{" +
|
||||
"type='" + type + '\'' +
|
||||
", total=" + total +
|
||||
", running=" + running +
|
||||
", stopped=" + stopped +
|
||||
", list=" + list +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.lanyuanxiaoyao.service.web.entity.overview;
|
||||
|
||||
/**
|
||||
* @author lanyuanxiaoyao
|
||||
* @version 20250509
|
||||
*/
|
||||
public class VersionCountVO {
|
||||
private final String key;
|
||||
private final String type;
|
||||
private final Long unReceive;
|
||||
private final Long unScheduled;
|
||||
|
||||
public VersionCountVO(String key, String type, Long unReceive, Long unScheduled) {
|
||||
this.key = key;
|
||||
this.type = type;
|
||||
this.unReceive = unReceive;
|
||||
this.unScheduled = unScheduled;
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public Long getUnReceive() {
|
||||
return unReceive;
|
||||
}
|
||||
|
||||
public Long getUnScheduled() {
|
||||
return unScheduled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "VersionCountVO{" +
|
||||
"key='" + key + '\'' +
|
||||
", type='" + type + '\'' +
|
||||
", unReceive=" + unReceive +
|
||||
", unScheduled=" + unScheduled +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.lanyuanxiaoyao.service.web.entity.overview;
|
||||
|
||||
import com.lanyuanxiaoyao.service.configuration.entity.yarn.YarnQueue;
|
||||
import com.lanyuanxiaoyao.service.configuration.entity.yarn.YarnRootQueue;
|
||||
|
||||
/**
|
||||
* @author lanyuanxiaoyao
|
||||
* @version 20250509
|
||||
*/
|
||||
public class YarnCountVO {
|
||||
private final String cluster;
|
||||
private final Integer total;
|
||||
private final Integer running;
|
||||
private final Integer scheduling;
|
||||
private final Integer failure;
|
||||
private final YarnRootQueue root;
|
||||
private final YarnQueue target;
|
||||
private final Integer queue;
|
||||
|
||||
public YarnCountVO(String cluster, Integer total, Integer running, Integer scheduling, Integer failure, YarnRootQueue root, YarnQueue target, Integer queue) {
|
||||
this.cluster = cluster;
|
||||
this.total = total;
|
||||
this.running = running;
|
||||
this.scheduling = scheduling;
|
||||
this.failure = failure;
|
||||
this.root = root;
|
||||
this.target = target;
|
||||
this.queue = queue;
|
||||
}
|
||||
|
||||
public String getCluster() {
|
||||
return cluster;
|
||||
}
|
||||
|
||||
public Integer getTotal() {
|
||||
return total;
|
||||
}
|
||||
|
||||
public Integer getRunning() {
|
||||
return running;
|
||||
}
|
||||
|
||||
public Integer getScheduling() {
|
||||
return scheduling;
|
||||
}
|
||||
|
||||
public Integer getFailure() {
|
||||
return failure;
|
||||
}
|
||||
|
||||
public YarnRootQueue getRoot() {
|
||||
return root;
|
||||
}
|
||||
|
||||
public YarnQueue getTarget() {
|
||||
return target;
|
||||
}
|
||||
|
||||
public Integer getQueue() {
|
||||
return queue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "YarnCountVO{" +
|
||||
"cluster='" + cluster + '\'' +
|
||||
", total=" + total +
|
||||
", running=" + running +
|
||||
", scheduling=" + scheduling +
|
||||
", failure=" + failure +
|
||||
", root=" + root +
|
||||
", target=" + target +
|
||||
", queue=" + queue +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user