feature(web): 增加调度计划显示

This commit is contained in:
2023-06-27 10:31:08 +08:00
parent 5d77f5c29b
commit a15fb1857f
5 changed files with 120 additions and 2 deletions

View File

@@ -0,0 +1,53 @@
package com.lanyuanxiaoyao.service.configuration.entity.schedule;
/**
* @author lanyuanxiaoyao
* @date 2023-06-27
*/
public class ScheduleStrategy {
private String name;
private String comment;
private String job;
private String trigger;
private Long lastFireTime;
private Long nextFireTime;
public ScheduleStrategy() {
}
public String getName() {
return name;
}
public String getComment() {
return comment;
}
public String getJob() {
return job;
}
public String getTrigger() {
return trigger;
}
public Long getLastFireTime() {
return lastFireTime;
}
public Long getNextFireTime() {
return nextFireTime;
}
@Override
public String toString() {
return "ScheduleStrategy{" +
"name='" + name + '\'' +
", comment='" + comment + '\'' +
", job='" + job + '\'' +
", trigger='" + trigger + '\'' +
", lastFireTime=" + lastFireTime +
", nextFireTime=" + nextFireTime +
'}';
}
}

View File

@@ -0,0 +1,35 @@
package com.lanyuanxiaoyao.service.forest.service;
import com.dtflys.forest.annotation.BaseRequest;
import com.dtflys.forest.annotation.Get;
import com.dtflys.forest.annotation.Query;
import com.lanyuanxiaoyao.service.configuration.entity.schedule.ScheduleStrategy;
import org.eclipse.collections.api.list.ImmutableList;
/**
* @author lanyuanxiaoyao
* @date 2023-06-27
*/
@BaseRequest(baseURL = "http://service-scheduler/schedule")
public interface ScheduleService {
@Get("/schedule_jobs")
ImmutableList<ScheduleStrategy> scheduleJobs();
@Get("/all")
void scheduleAllTable();
@Get("/all_focus")
void scheduleAllFocus();
@Get("/all_un_scheduled")
void scheduleAllUnScheduledTable();
@Get("/table")
void scheduleTable(@Query("flink_job_id") Long flinkJobId, @Query("alias") String alias);
@Get("/table")
void scheduleTableForce(@Query("flink_job_id") Long flinkJobId, @Query("alias") String alias, @Query("force") String forceCluster);
@Get("/table")
void scheduleTableRecommend(@Query("flink_job_id") Long flinkJobId, @Query("alias") String alias, @Query("recommend") String recommendCluster);
}

View File

@@ -9,6 +9,7 @@ import com.lanyuanxiaoyao.service.configuration.entity.yarn.YarnApplication;
import com.lanyuanxiaoyao.service.configuration.entity.yarn.YarnRootQueue;
import com.lanyuanxiaoyao.service.forest.service.InfoService;
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.web.entity.JobIdAndAliasVO;
import java.time.LocalDateTime;
@@ -41,12 +42,14 @@ public class OverviewController extends BaseController {
private final InfoService infoService;
private final YarnService yarnService;
private final QueueService queueService;
private final ScheduleService scheduleService;
@SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection")
public OverviewController(InfoService infoService, YarnService yarnService, QueueService queueService) {
public OverviewController(InfoService infoService, YarnService yarnService, QueueService queueService, ScheduleService scheduleService) {
this.infoService = infoService;
this.yarnService = yarnService;
this.queueService = queueService;
this.scheduleService = scheduleService;
}
@GetMapping("")
@@ -158,4 +161,9 @@ public class OverviewController extends BaseController {
}
return responseCrudData(jobIdAndAliases.collect(JobIdAndAliasVO::new));
}
@GetMapping("schedule_jobs")
public AmisResponse scheduleJobs() {
return responseCrudData(scheduleService.scheduleJobs());
}
}

View File

@@ -4,6 +4,7 @@
@password = cYxg3b4PtWoVD5SjFayWxtnSVsjzRsg4
@url = http://{{username}}:{{password}}@{{host}}:{{port}}
@queue-url = {{url}}/hudi_services/queue
@scheduler-url = {{url}}/hudi_services/service_scheduler
### 队列名称
GET {{queue-url}}/queue/names
@@ -41,4 +42,7 @@ Content-Type: application/json
GET http://{{username}}:{{password}}@132.122.116.146:18166/info/compaction_metrics?flink_job_id=1542097996099055616&alias=acct_acct_item_fs&filter_completes=true
### Info
GET http://{{username}}:{{password}}@132.122.116.150:27510/table/list_compaction_metrics?search_flink_job_id=1542097996099055616&search_alias=acct_acct_item_fs
GET http://{{username}}:{{password}}@132.122.116.150:27510/table/list_compaction_metrics?search_flink_job_id=1542097996099055616&search_alias=acct_acct_item_fs
### Query Scheduler
GET {{scheduler-url}}/schedule/schedule_jobs

View File

@@ -292,6 +292,24 @@ function overviewTab() {
},
versionDetailDialog('unSchedule.normal', 'unScheduled_normal'),
]
},
{type: 'divider'},
{
type: 'service',
api: '${base}/overview/schedule_jobs',
interval: 60000,
silentPolling: true,
body: [
'调度策略',
{
type: 'each',
name: 'items',
items: {
type: 'tpl',
tpl: '<div class="font-mono"><span class="font-bold">${trigger}</span> <span class="text-gray-500">(${job})</span></div>'
}
}
]
}
]
}