Unverified Commit c8143978 authored by gaoyan's avatar gaoyan Committed by GitHub

refacotr devops (#2210)

* refacotr k8s gateway * refacotr devops * fix code style * fix codeshow loading * add version delete * fix code style * delete comment * delete comment
parent 1511cac9
...@@ -115,10 +115,27 @@ public class JobInstanceController { ...@@ -115,10 +115,27 @@ public class JobInstanceController {
return Result.succeed(jobManagerConfiguration); return Result.succeed(jobManagerConfiguration);
} }
/** 获取 TaskManager 的信息 */ @GetMapping("/getJobManagerLog")
@GetMapping("/getTaskManagerInfo") @ApiOperation("Get job manager log")
@ApiOperation("Get task manager info") public Result<String> getJobManagerLog(@RequestParam String address) {
public Result<Set<TaskManagerConfiguration>> getTaskManagerInfo(@RequestParam String address) { return Result.succeed(FlinkAPI.build(address).getJobManagerLog(), "");
}
@GetMapping("/getJobManagerStdOut")
@ApiOperation("Get job manager stdout")
public Result<String> getJobManagerStdOut(@RequestParam String address) {
return Result.succeed(FlinkAPI.build(address).getJobManagerStdOut(), "");
}
@GetMapping("/getJobManagerThreadDump")
@ApiOperation("Get job manager ThreadDump")
public Result<String> getJobManagerThreadDump(@RequestParam String address) {
return Result.succeed(FlinkAPI.build(address).getJobManagerThreadDump(), "");
}
@GetMapping("/getTaskManagerList")
@ApiOperation("Get task manager List")
public Result<Set<TaskManagerConfiguration>> getTaskManagerList(@RequestParam String address) {
Set<TaskManagerConfiguration> taskManagerConfigurationList = new HashSet<>(); Set<TaskManagerConfiguration> taskManagerConfigurationList = new HashSet<>();
if (Asserts.isNotNullString(address)) { if (Asserts.isNotNullString(address)) {
FlinkAPI flinkAPI = FlinkAPI.build(address); FlinkAPI flinkAPI = FlinkAPI.build(address);
...@@ -128,4 +145,11 @@ public class JobInstanceController { ...@@ -128,4 +145,11 @@ public class JobInstanceController {
} }
return Result.succeed(taskManagerConfigurationList); return Result.succeed(taskManagerConfigurationList);
} }
/** 获取 TaskManager 的信息 */
@GetMapping("/getTaskManagerLog")
@ApiOperation("Get task manager log")
public Result<String> getTaskManagerLog(@RequestParam String address, @RequestParam String containerId) {
return Result.succeed(FlinkAPI.build(address).getTaskManagerLog(containerId), "");
}
} }
...@@ -22,18 +22,18 @@ package org.dinky.controller; ...@@ -22,18 +22,18 @@ package org.dinky.controller;
import org.dinky.data.dto.TaskVersionHistoryDTO; import org.dinky.data.dto.TaskVersionHistoryDTO;
import org.dinky.data.model.TaskVersion; import org.dinky.data.model.TaskVersion;
import org.dinky.data.result.ProTableResult; import org.dinky.data.result.ProTableResult;
import org.dinky.data.result.Result;
import org.dinky.service.TaskVersionService; import org.dinky.service.TaskVersionService;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.fasterxml.jackson.databind.JsonNode;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -54,22 +54,20 @@ public class TaskVersionController { ...@@ -54,22 +54,20 @@ public class TaskVersionController {
/** /**
* query task version list * query task version list
* *
* @param para {@link JsonNode} params
* @return {@link ProTableResult}<{@link TaskVersionHistoryDTO}> * @return {@link ProTableResult}<{@link TaskVersionHistoryDTO}>
*/ */
@PostMapping @GetMapping
public ProTableResult<TaskVersionHistoryDTO> listTaskVersions(@RequestBody JsonNode para) { public Result<List<TaskVersionHistoryDTO>> listTaskVersions(@RequestParam int taskId) {
ProTableResult<TaskVersionHistoryDTO> versionHistoryDTOProTableResult = new ProTableResult<>(); List<TaskVersion> taskVersions = versionService.getTaskVersionByTaskId(taskId);
List<TaskVersionHistoryDTO> collect = taskVersions.stream()
ProTableResult<TaskVersion> versionProTableResult = versionService.selectForProTable(para);
BeanUtil.copyProperties(versionProTableResult, versionHistoryDTOProTableResult);
List<TaskVersionHistoryDTO> collect = versionProTableResult.getData().stream()
.map(t -> BeanUtil.copyProperties(t, TaskVersionHistoryDTO.class)) .map(t -> BeanUtil.copyProperties(t, TaskVersionHistoryDTO.class))
.collect(Collectors.toList()); .collect(Collectors.toList());
return Result.succeed(collect);
}
versionHistoryDTOProTableResult.setData(collect); @DeleteMapping
public Result<Boolean> deleteVersion(@RequestParam int versionId) {
return versionHistoryDTOProTableResult; boolean b = versionService.removeById(versionId);
return Result.succeed(b);
} }
} }
...@@ -111,27 +111,6 @@ public class BuildConfiguration { ...@@ -111,27 +111,6 @@ public class BuildConfiguration {
String memoryConfiguration = JSONUtil.toJsonString(taskManagers.get("memoryConfiguration")); String memoryConfiguration = JSONUtil.toJsonString(taskManagers.get("memoryConfiguration"));
// memoryConfiguration // memoryConfiguration
Asserts.checkNull(containerId, "获取不到 containerId , containerId不能为空"); Asserts.checkNull(containerId, "获取不到 containerId , containerId不能为空");
// 获取taskManager metrics
JsonNode taskManagerMetrics = flinkAPI.getTaskManagerMetrics(containerId);
// 获取taskManager日志
String taskManagerLog = flinkAPI.getTaskManagerLog(containerId);
// 获取taskManager线程dumps
String taskManagerThreadDumps = JSONUtil.toJsonString(
flinkAPI.getTaskManagerThreadDump(containerId).get("threadInfos"));
// 获取taskManager标准输出日志
String taskManagerStdOut = flinkAPI.getTaskManagerStdOut(containerId);
// 获取taskManager metrics
Map<String, String> taskManagerMetricsMap = new HashMap<>(8);
List<LinkedHashMap> taskManagerMetricsItemsList =
JSONUtil.toList(JSONUtil.toJsonString(taskManagerMetrics), LinkedHashMap.class);
taskManagerMetricsItemsList.forEach(mapItems -> {
String configKey = (String) mapItems.get("id");
String configValue = (String) mapItems.get("value");
if (Asserts.isNotNullString(configKey) && Asserts.isNotNullString(configValue)) {
taskManagerMetricsMap.put(configKey, configValue);
}
});
/* TaskManagerConfiguration 赋值 */ /* TaskManagerConfiguration 赋值 */
taskManagerConfiguration.setContainerId(containerId); taskManagerConfiguration.setContainerId(containerId);
...@@ -148,10 +127,6 @@ public class BuildConfiguration { ...@@ -148,10 +127,6 @@ public class BuildConfiguration {
/* TaskContainerConfigInfo 赋值 */ /* TaskContainerConfigInfo 赋值 */
TaskContainerConfigInfo taskContainerConfigInfo = new TaskContainerConfigInfo(); TaskContainerConfigInfo taskContainerConfigInfo = new TaskContainerConfigInfo();
taskContainerConfigInfo.setMetrics(taskManagerMetricsMap);
taskContainerConfigInfo.setTaskManagerLog(taskManagerLog);
taskContainerConfigInfo.setTaskManagerThreadDump(taskManagerThreadDumps);
taskContainerConfigInfo.setTaskManagerStdout(taskManagerStdOut);
taskManagerConfiguration.setTaskContainerConfigInfo(taskContainerConfigInfo); taskManagerConfiguration.setTaskContainerConfigInfo(taskContainerConfigInfo);
......
...@@ -37,6 +37,8 @@ public class TaskVersionServiceImpl extends SuperServiceImpl<TaskVersionMapper, ...@@ -37,6 +37,8 @@ public class TaskVersionServiceImpl extends SuperServiceImpl<TaskVersionMapper,
@Override @Override
public List<TaskVersion> getTaskVersionByTaskId(Integer taskId) { public List<TaskVersion> getTaskVersionByTaskId(Integer taskId) {
return baseMapper.selectList(new LambdaQueryWrapper<TaskVersion>().eq(TaskVersion::getTaskId, taskId)); return baseMapper.selectList(new LambdaQueryWrapper<TaskVersion>()
.eq(TaskVersion::getTaskId, taskId)
.orderByDesc(true, TaskVersion::getVersionId));
} }
} }
...@@ -280,6 +280,10 @@ public class FlinkAPI { ...@@ -280,6 +280,10 @@ public class FlinkAPI {
public String getJobManagerLog() { public String getJobManagerLog() {
return getResult(FlinkRestAPIConstant.JOB_MANAGER + FlinkRestAPIConstant.LOG); return getResult(FlinkRestAPIConstant.JOB_MANAGER + FlinkRestAPIConstant.LOG);
} }
/** @return JsonNode */
public String getJobManagerThreadDump() {
return getResult(FlinkRestAPIConstant.JOB_MANAGER + FlinkRestAPIConstant.THREAD_DUMP);
}
/** @return String */ /** @return String */
public String getJobManagerStdOut() { public String getJobManagerStdOut() {
......
...@@ -51,6 +51,7 @@ export type CodeShowFormProps = { ...@@ -51,6 +51,7 @@ export type CodeShowFormProps = {
showFloatButton?: boolean; showFloatButton?: boolean;
refreshLogCallback?: () => void; refreshLogCallback?: () => void;
fullScreenBtn?: boolean; fullScreenBtn?: boolean;
}; };
const CodeShow = (props: CodeShowFormProps) => { const CodeShow = (props: CodeShowFormProps) => {
...@@ -98,6 +99,7 @@ const CodeShow = (props: CodeShowFormProps) => { ...@@ -98,6 +99,7 @@ const CodeShow = (props: CodeShowFormProps) => {
// id: language || "typescript", // id: language || "typescript",
// }); // });
/** /**
* handle sync log * handle sync log
* @returns {Promise<void>} * @returns {Promise<void>}
......
...@@ -88,7 +88,6 @@ export default { ...@@ -88,7 +88,6 @@ export default {
'home.develop.re.git': 'Git Project', 'home.develop.re.git': 'Git Project',
//-------------------------------- devops -------------------------------- //-------------------------------- devops --------------------------------
// devops // devops
...@@ -96,8 +95,8 @@ export default { ...@@ -96,8 +95,8 @@ export default {
'devops.joblist.history': 'History', 'devops.joblist.history': 'History',
'devops.joblist.detail': 'Job Detail', 'devops.joblist.detail': 'Job Detail',
'devops.jobinfo.savepoint.trigger':'SavePoint Triggers', 'devops.jobinfo.savepoint.trigger': 'SavePoint Triggers',
'devops.jobinfo.savepoint.stop':'SavePoint Pause', 'devops.jobinfo.savepoint.stop': 'SavePoint Pause',
'devops.jobinfo.savepoint.cancel': 'SavePoint Stop', 'devops.jobinfo.savepoint.cancel': 'SavePoint Stop',
'devops.jobinfo.savepoint.canceljob': 'Normal Stop', 'devops.jobinfo.savepoint.canceljob': 'Normal Stop',
'devops.jobinfo.localenv': 'Local Environment', 'devops.jobinfo.localenv': 'Local Environment',
...@@ -113,27 +112,63 @@ export default { ...@@ -113,27 +112,63 @@ export default {
'devops.jobinfo.stopJobConfirm': 'Are you sure to just stop this job without SavePoint operation? ', 'devops.jobinfo.stopJobConfirm': 'Are you sure to just stop this job without SavePoint operation? ',
'devops.jobinfo.canceljob.success': 'Normal stop succeeded', 'devops.jobinfo.canceljob.success': 'Normal stop succeeded',
'devops.jobinfo.canceljob.failed': 'Normal stop failed', 'devops.jobinfo.canceljob.failed': 'Normal stop failed',
'devops.jobinfo.job.key':'{key} Job', 'devops.jobinfo.job.key': '{key} Job',
'devops.jobinfo.job.key.success':'{key} Success', 'devops.jobinfo.job.key.success': '{key} Success',
'devops.jobinfo.job.keyConfirm':'{key} this Job?', 'devops.jobinfo.job.keyConfirm': '{key} this Job?',
'devops.jobinfo.config.JobInfo': 'Job Info',
'devops.jobinfo.config.JobLogs': 'Job Logs',
'devops.jobinfo.config.JobVersion': 'History Info',
'devops.jobinfo.config.JobCheckpoints': 'Checkpoints Info',
'devops.jobinfo.config.JobMonitor': 'Monitor',
'devops.jobinfo.config.JobLineage': 'Lineage',
'devops.jobinfo.config.JobAlert': 'Alert',
'devops.jobinfo.config.JobBaseInfo': 'Job Base Info',
'devops.jobinfo.config.UserCustomConf': 'Custom Config',
'devops.jobinfo.config.taskId': 'Dinky Job ID',
'devops.jobinfo.config.JobId': 'Flink Job ID',
'devops.jobinfo.config.submitType': 'Submit Mode',
'devops.jobinfo.config.execmode': 'Exec Mode',
'devops.jobinfo.config.ClusterInstanceName': 'Flink Instance',
'devops.jobinfo.config.ClusterConfigName': 'Cluster Config',
'devops.jobinfo.config.useSqlFragment': 'Sql Fragment',
'devops.jobinfo.config.JobType': 'Job Type',
'devops.jobinfo.config.startFromSavePoint': 'Start from SavePoint',
'devops.jobinfo.config.savePointPath': 'savePoint path',
'devops.jobinfo.config.RestartStrategy': 'RestartStrategy',
'devops.jobinfo.config.JobParallelism': 'JobParallelism',
'devops.jobinfo.version.versionList': 'Job Version',
'devops.jobinfo.version.latestVersion': 'Current Version',
'devops.jobinfo.version.delete': 'Delete Version',
'devops.jobinfo.version.delete.sure': 'Are you sure you want to remove this version?V{version}',
'devops.jobinfo.config.JobInfo':'Job Info', 'devops.jobinfo.ck.id': 'ID',
'devops.jobinfo.config.JobOveriew':'Job Overview', 'devops.jobinfo.ck.taskid': 'Task ID',
'devops.jobinfo.config.JobException':'Exception Info', 'devops.jobinfo.ck.status': 'Status',
'devops.jobinfo.config.JobBaseInfo':'Job Base Info', 'devops.jobinfo.ck.name': 'Name',
'devops.jobinfo.config.UserCustomConf':'Custom Config', 'devops.jobinfo.ck.duration': 'Duration',
'devops.jobinfo.config.taskId':'Dinky Job ID', 'devops.jobinfo.ck.checkpoint_type': 'Type',
'devops.jobinfo.config.JobId':'Flink Job ID', 'devops.jobinfo.ck.external_path': 'Storage Location',
'devops.jobinfo.config.submitType':'Submit Mode', 'devops.jobinfo.ck.latest_ack_timestamp': 'Last Response Time',
'devops.jobinfo.config.execmode':'Exec Mode', 'devops.jobinfo.ck.state_size': 'State Size',
'devops.jobinfo.config.ClusterInstanceName':'Flink Instance', 'devops.jobinfo.ck.trigger_timestamp': 'Trigger Time',
'devops.jobinfo.config.ClusterConfigName':'Cluster Config', 'devops.jobinfo.ck.recovery': 'Recovering from Checkpoint! ',
'devops.jobinfo.config.useSqlFragment':'Sql Fragment', 'devops.jobinfo.ck.recoveryConfirm': 'Are you sure to Recover from Checkpoint [{path}]?',
'devops.jobinfo.config.JobType':'Job Type', 'devops.jobinfo.ck.recovery.success': 'Recovery job succeeded',
'devops.jobinfo.config.startFromSavePoint':'Start from SavePoint', 'devops.jobinfo.ck.recovery.failed': 'Recovery job failed',
'devops.jobinfo.config.savePointPath':'savePoint path', 'devops.jobinfo.ck.recovery.recoveryTo': 'Recovery Here',
'devops.jobinfo.config.RestartStrategy':'RestartStrategy',
'devops.jobinfo.config.JobParallelism':'JobParallelism', 'devops.baseinfo.taskid': 'Task Id',
'devops.baseinfo.name': 'Job Name',
'devops.baseinfo.status': 'Status',
'devops.baseinfo.readbytes': 'Receive Bytes',
'devops.baseinfo.readrecords': 'Receive Records',
'devops.baseinfo.writebytes': 'Send Bytes',
'devops.baseinfo.writerecords': 'Send Records',
'devops.baseinfo.parallelism': 'Parallelism',
'devops.baseinfo.tasks': 'Operator',
'devops.baseinfo.restart_number': 'Number of Restarts',
//-------------------------------- auth center -------------------------------- //-------------------------------- auth center --------------------------------
// user // user
...@@ -765,14 +800,14 @@ export default { ...@@ -765,14 +800,14 @@ export default {
'sys.ldap.settings.loadable': 'Whether it can be imported', 'sys.ldap.settings.loadable': 'Whether it can be imported',
// Metrics // Metrics
'sys.metrics.settings.sys.enable':'Dinky JVM Monitor switch', 'sys.metrics.settings.sys.enable': 'Dinky JVM Monitor switch',
'sys.metrics.settings.sys.enable.note':'This switch is related to Dinky JVM Monitor, which determines the display of Dinky Server in the monitoring page and the collection of JVM Metrics', 'sys.metrics.settings.sys.enable.note': 'This switch is related to Dinky JVM Monitor, which determines the display of Dinky Server in the monitoring page and the collection of JVM Metrics',
'sys.metrics.settings.sys.gatherTiming':'Dinky JVM Metrics collection time granularity', 'sys.metrics.settings.sys.gatherTiming': 'Dinky JVM Metrics collection time granularity',
'sys.metrics.settings.sys.gatherTiming.note':'Dinky JVM Metrics collection time granularity, timed task interval trigger', 'sys.metrics.settings.sys.gatherTiming.note': 'Dinky JVM Metrics collection time granularity, timed task interval trigger',
'sys.metrics.settings.flink.gatherTiming':'Flink Metrics collection time granularity', 'sys.metrics.settings.flink.gatherTiming': 'Flink Metrics collection time granularity',
'sys.metrics.settings.flink.gatherTiming.note':'Flink Metrics collection time granularity, scheduled task interval trigger', 'sys.metrics.settings.flink.gatherTiming.note': 'Flink Metrics collection time granularity, scheduled task interval trigger',
'sys.metrics.settings.flink.gatherTimeout':'Flink Metrics collection time granularity, scheduled task interval trigger', 'sys.metrics.settings.flink.gatherTimeout': 'Flink Metrics collection time granularity, scheduled task interval trigger',
'sys.metrics.settings.flink.gatherTimeout.note':'Flink Metrics collection timeout period, scheduled task interval trigger (this configuration item should be smaller than Flink Metrics collection time granularity)', 'sys.metrics.settings.flink.gatherTimeout.note': 'Flink Metrics collection timeout period, scheduled task interval trigger (this configuration item should be smaller than Flink Metrics collection time granularity)',
// process // process
'sys.process.id': 'Process ID', 'sys.process.id': 'Process ID',
...@@ -794,26 +829,26 @@ export default { ...@@ -794,26 +829,26 @@ export default {
'sys.info.logList.tips': 'Click left log file to viewing', 'sys.info.logList.tips': 'Click left log file to viewing',
// Resource // Resource
'sys.resource.settings.enable':'Whether to enable Resource', 'sys.resource.settings.enable': 'Whether to enable Resource',
'sys.resource.settings.enable.note':'Enable the resource management function. If you switch the storage mode, you need to turn off this switch. After the relevant configuration is completed, turn it on again.', 'sys.resource.settings.enable.note': 'Enable the resource management function. If you switch the storage mode, you need to turn off this switch. After the relevant configuration is completed, turn it on again.',
'sys.resource.settings.upload.base.path':'The root path of the upload directory', 'sys.resource.settings.upload.base.path': 'The root path of the upload directory',
'sys.resource.settings.upload.base.path.note':'resource store on HDFS/OSS path, resource file will store to this base path, self configuration, please make sure the directory exists on hdfs and have read write permissions. /dinky is recommended', 'sys.resource.settings.upload.base.path.note': 'resource store on HDFS/OSS path, resource file will store to this base path, self configuration, please make sure the directory exists on hdfs and have read write permissions. /dinky is recommended',
'sys.resource.settings.model':'Storage mode: support HDFS, OSS', 'sys.resource.settings.model': 'Storage mode: support HDFS, OSS',
'sys.resource.settings.model.note':'Storage mode: support HDFS, OSS, it will take effect after switching the option, and migrate resource files at the same time', 'sys.resource.settings.model.note': 'Storage mode: support HDFS, OSS, it will take effect after switching the option, and migrate resource files at the same time',
'sys.resource.settings.hdfs.root.user':'HDFS operation user name', 'sys.resource.settings.hdfs.root.user': 'HDFS operation user name',
'sys.resource.settings.hdfs.root.user.note':'HDFS operation user name', 'sys.resource.settings.hdfs.root.user.note': 'HDFS operation user name',
'sys.resource.settings.hdfs.fs.defaultFS':'HDFS defaultFS', 'sys.resource.settings.hdfs.fs.defaultFS': 'HDFS defaultFS',
'sys.resource.settings.hdfs.fs.defaultFS.note':'fs.defaultFS configuration items, such as remote: hdfs://localhost:9000, local: file:///', 'sys.resource.settings.hdfs.fs.defaultFS.note': 'fs.defaultFS configuration items, such as remote: hdfs://localhost:9000, local: file:///',
'sys.resource.settings.oss.endpoint':'URL of the object storage service', 'sys.resource.settings.oss.endpoint': 'URL of the object storage service',
'sys.resource.settings.oss.endpoint.note':'The URL of the object storage service, for example: https://oss-cn-hangzhou.aliyuncs.com', 'sys.resource.settings.oss.endpoint.note': 'The URL of the object storage service, for example: https://oss-cn-hangzhou.aliyuncs.com',
'sys.resource.settings.oss.accessKey':'Access key is like a user ID, which can uniquely identify your account', 'sys.resource.settings.oss.accessKey': 'Access key is like a user ID, which can uniquely identify your account',
'sys.resource.settings.oss.accessKey.note':'Access key is like a user ID, which can uniquely identify your account', 'sys.resource.settings.oss.accessKey.note': 'Access key is like a user ID, which can uniquely identify your account',
'sys.resource.settings.oss.secretKey':'Secret key is your account password', 'sys.resource.settings.oss.secretKey': 'Secret key is your account password',
'sys.resource.settings.oss.secretKey.note':'Secret key is your account password', 'sys.resource.settings.oss.secretKey.note': 'Secret key is your account password',
'sys.resource.settings.oss.bucketName':'default bucket name', 'sys.resource.settings.oss.bucketName': 'default bucket name',
'sys.resource.settings.oss.bucketName.note':'default bucket name', 'sys.resource.settings.oss.bucketName.note': 'default bucket name',
'sys.resource.settings.oss.region':'region', 'sys.resource.settings.oss.region': 'region',
'sys.resource.settings.oss.region.note':'region', 'sys.resource.settings.oss.region.note': 'region',
// metrics // metrics
// server // server
...@@ -906,7 +941,7 @@ export default { ...@@ -906,7 +941,7 @@ export default {
'pages.datastudio.label.execConfig.autostop.tip': 'Enable autostop, it will automatically stop the task after capturing the maximum number of records', 'pages.datastudio.label.execConfig.autostop.tip': 'Enable autostop, it will automatically stop the task after capturing the maximum number of records',
'pages.datastudio.label.savepoint': 'Savepoint', 'pages.datastudio.label.savepoint': 'Savepoint',
'pages.task.savePointPath' : 'SavePoint Path', 'pages.task.savePointPath': 'SavePoint Path',
'pages.datastudio.label.version': 'Version History', 'pages.datastudio.label.version': 'Version History',
'pages.datastudio.label.version.id': 'Version ID', 'pages.datastudio.label.version.id': 'Version ID',
...@@ -1012,7 +1047,6 @@ export default { ...@@ -1012,7 +1047,6 @@ export default {
'pages.datastudio.label.result.query.latest.data': 'Get the latest data', 'pages.datastudio.label.result.query.latest.data': 'Get the latest data',
'datastudio.middle.qg': 'Quick Guide', 'datastudio.middle.qg': 'Quick Guide',
'datastudio.middle.qg.clusterInstance': 'Register Session Cluster', 'datastudio.middle.qg.clusterInstance': 'Register Session Cluster',
'datastudio.middle.qg.clusterConfiguration': 'Register Cluster Configuration', 'datastudio.middle.qg.clusterConfiguration': 'Register Cluster Configuration',
......
...@@ -90,45 +90,81 @@ export default { ...@@ -90,45 +90,81 @@ export default {
'devops.joblist.history': '历史', 'devops.joblist.history': '历史',
'devops.joblist.detail': '详情', 'devops.joblist.detail': '详情',
'devops.jobinfo.savepoint.trigger':'SavePoint 触发', 'devops.jobinfo.savepoint.trigger': 'SavePoint 触发',
'devops.jobinfo.savepoint.stop':'SavePoint 暂停', 'devops.jobinfo.savepoint.stop': 'SavePoint 暂停',
'devops.jobinfo.savepoint.cancel':'SavePoint 停止', 'devops.jobinfo.savepoint.cancel': 'SavePoint 停止',
'devops.jobinfo.savepoint.canceljob':'普通停止', 'devops.jobinfo.savepoint.canceljob': '普通停止',
'devops.jobinfo.localenv':'本地环境', 'devops.jobinfo.localenv': '本地环境',
'devops.jobinfo.offline':'下线', 'devops.jobinfo.offline': '下线',
'devops.jobinfo.smart_stop':'智能停止', 'devops.jobinfo.smart_stop': '智能停止',
'devops.jobinfo.reonline':'重新上线', 'devops.jobinfo.reonline': '重新上线',
'devops.jobinfo.reonlineJob':'重新上线任务', 'devops.jobinfo.reonlineJob': '重新上线任务',
'devops.jobinfo.reonlineJobConfirm':'确定重新上线该作业吗?', 'devops.jobinfo.reonlineJobConfirm': '确定重新上线该作业吗?',
'devops.jobinfo.reonline.success':'重新上线成功', 'devops.jobinfo.reonline.success': '重新上线成功',
'devops.jobinfo.reonline.failed':'重新上线失败', 'devops.jobinfo.reonline.failed': '重新上线失败',
'devops.jobinfo.restart':'重新启动', 'devops.jobinfo.restart': '重新启动',
'devops.jobinfo.stopJob':'停止任务', 'devops.jobinfo.stopJob': '停止任务',
'devops.jobinfo.stopJobConfirm':'确定只停止该作业,不进行 SavePoint 操作吗?', 'devops.jobinfo.stopJobConfirm': '确定只停止该作业,不进行 SavePoint 操作吗?',
'devops.jobinfo.canceljob.success':'普通停止成功', 'devops.jobinfo.canceljob.success': '普通停止成功',
'devops.jobinfo.canceljob.failed':'普通停止失败', 'devops.jobinfo.canceljob.failed': '普通停止失败',
'devops.jobinfo.job.key':'{key} 任务', 'devops.jobinfo.job.key': '{key} 任务',
'devops.jobinfo.job.key.success':'{key} 成功', 'devops.jobinfo.job.key.success': '{key} 成功',
'devops.jobinfo.job.keyConfirm':'确定{key} 该作业吗?', 'devops.jobinfo.job.keyConfirm': '确定{key} 该作业吗?',
'devops.jobinfo.config.JobInfo':'作业信息',
'devops.jobinfo.config.JobOveriew':'作业概览',
'devops.jobinfo.config.JobException':'异常信息',
'devops.jobinfo.config.JobBaseInfo':'作业基本信息',
'devops.jobinfo.config.UserCustomConf':'用户自定义配置',
'devops.jobinfo.config.taskId':'Dinky作业ID',
'devops.jobinfo.config.JobId':'Flink Job ID',
'devops.jobinfo.config.submitType':'提交模式',
'devops.jobinfo.config.execmode':'执行模式',
'devops.jobinfo.config.ClusterInstanceName':'Flink实例',
'devops.jobinfo.config.ClusterConfigName':'集群配置',
'devops.jobinfo.config.useSqlFragment':'语句集',
'devops.jobinfo.config.JobType':'任务类型',
'devops.jobinfo.config.startFromSavePoint':'从SavePoint启动',
'devops.jobinfo.config.savePointPath':'savePoint路径',
'devops.jobinfo.config.RestartStrategy':'重启策略',
'devops.jobinfo.config.JobParallelism':'作业并行度',
'devops.jobinfo.config.JobInfo': '作业信息',
'devops.jobinfo.config.JobLogs': '作业日志',
'devops.jobinfo.config.JobVersion': '版本信息',
'devops.jobinfo.config.JobCheckpoints': '作业快照',
'devops.jobinfo.config.JobMonitor': '监控',
'devops.jobinfo.config.JobLineage': 'Sql 血缘',
'devops.jobinfo.config.JobAlert': '告警记录',
'devops.jobinfo.config.JobBaseInfo': '作业基本信息',
'devops.jobinfo.config.UserCustomConf': '用户自定义配置',
'devops.jobinfo.config.taskId': 'Dinky作业ID',
'devops.jobinfo.config.JobId': 'Flink Job ID',
'devops.jobinfo.config.submitType': '提交模式',
'devops.jobinfo.config.execmode': '执行模式',
'devops.jobinfo.config.ClusterInstanceName': 'Flink实例',
'devops.jobinfo.config.ClusterConfigName': '集群配置',
'devops.jobinfo.config.useSqlFragment': '语句集',
'devops.jobinfo.config.JobType': '任务类型',
'devops.jobinfo.config.startFromSavePoint': '从SavePoint启动',
'devops.jobinfo.config.savePointPath': 'savePoint路径',
'devops.jobinfo.config.RestartStrategy': '重启策略',
'devops.jobinfo.config.JobParallelism': '作业并行度',
'devops.jobinfo.version.versionList': '版本列表',
'devops.jobinfo.version.latestVersion': '当前版本',
'devops.jobinfo.version.delete': '删除版本',
'devops.jobinfo.version.delete.sure': '确定删除此版本吗?V{version}',
'devops.jobinfo.ck.id': 'ID',
'devops.jobinfo.ck.taskid': '任务ID',
'devops.jobinfo.ck.status': '状态',
'devops.jobinfo.ck.name': '名称',
'devops.jobinfo.ck.duration': '耗时',
'devops.jobinfo.ck.checkpoint_type': '类型',
'devops.jobinfo.ck.external_path': '存储位置',
'devops.jobinfo.ck.latest_ack_timestamp': '最后响应时间',
'devops.jobinfo.ck.state_size': '状态大小',
'devops.jobinfo.ck.trigger_timestamp': '触发时间',
'devops.jobinfo.ck.recovery': '从检查点恢复!',
'devops.jobinfo.ck.recoveryConfirm': '确定从检查点【{path}】恢复吗?',
'devops.jobinfo.ck.recovery.success': '恢复作业成功',
'devops.jobinfo.ck.recovery.failed': '恢复作业失败',
'devops.jobinfo.ck.recovery.recoveryTo': '此处恢复',
'devops.baseinfo.taskid': '任务ID',
'devops.baseinfo.name': '任务名称',
'devops.baseinfo.status': '状态',
'devops.baseinfo.readbytes': '接收字节',
'devops.baseinfo.readrecords': '接收记录',
'devops.baseinfo.writebytes': '发送字节',
'devops.baseinfo.writerecords': '发送记录',
'devops.baseinfo.parallelism': '并行度',
'devops.baseinfo.tasks': '算子',
'devops.baseinfo.restart_number': '重启次数',
//-------------------------------- auth center -------------------------------- //-------------------------------- auth center --------------------------------
// user // user
...@@ -778,27 +814,27 @@ export default { ...@@ -778,27 +814,27 @@ export default {
'sys.metrics.settings.flink.gatherTimeout.note': 'Flink Metrics 采集超时时长,定时任务间隔触发(此配置项应小于Flink Metrics 采集时间粒度)', 'sys.metrics.settings.flink.gatherTimeout.note': 'Flink Metrics 采集超时时长,定时任务间隔触发(此配置项应小于Flink Metrics 采集时间粒度)',
// Resource // Resource
'sys.resource.settings.enable':'是否启用Resource', 'sys.resource.settings.enable': '是否启用Resource',
'sys.resource.settings.enable.note':'启用资源管理功能,如果切换存储模式时,需关闭此开关,相关配置完成后,再开启', 'sys.resource.settings.enable.note': '启用资源管理功能,如果切换存储模式时,需关闭此开关,相关配置完成后,再开启',
'sys.resource.settings.upload.base.path':'上传目录的根路径', 'sys.resource.settings.upload.base.path': '上传目录的根路径',
// 'sys.resource.settings.upload.base.path.note':'resource store on HDFS/OSS path, resource file will store to this base path, self configuration, please make sure the directory exists on hdfs and have read write permissions. /dinky is recommended', // 'sys.resource.settings.upload.base.path.note':'resource store on HDFS/OSS path, resource file will store to this base path, self configuration, please make sure the directory exists on hdfs and have read write permissions. /dinky is recommended',
'sys.resource.settings.upload.base.path.note':'资源存储在HDFS/OSS路径上,资源文件将存储到此基本路径,自行配置,请确保该目录存在于hdfs上并具有读写权限。推荐:/dinky', 'sys.resource.settings.upload.base.path.note': '资源存储在HDFS/OSS路径上,资源文件将存储到此基本路径,自行配置,请确保该目录存在于hdfs上并具有读写权限。推荐:/dinky',
'sys.resource.settings.model':'存储模式:支持HDFS、OSS', 'sys.resource.settings.model': '存储模式:支持HDFS、OSS',
'sys.resource.settings.model.note':'存储模式:支持HDFS、OSS,切换选项后即可生效,同时并迁移资源文件', 'sys.resource.settings.model.note': '存储模式:支持HDFS、OSS,切换选项后即可生效,同时并迁移资源文件',
'sys.resource.settings.hdfs.root.user':'HDFS操作用户名', 'sys.resource.settings.hdfs.root.user': 'HDFS操作用户名',
'sys.resource.settings.hdfs.root.user.note':'HDFS操作用户名', 'sys.resource.settings.hdfs.root.user.note': 'HDFS操作用户名',
'sys.resource.settings.hdfs.fs.defaultFS':'HDFS defaultFS', 'sys.resource.settings.hdfs.fs.defaultFS': 'HDFS defaultFS',
'sys.resource.settings.hdfs.fs.defaultFS.note':'fs.defaultFS 配置项,例如远程:hdfs://localhost:9000,本地:file:///', 'sys.resource.settings.hdfs.fs.defaultFS.note': 'fs.defaultFS 配置项,例如远程:hdfs://localhost:9000,本地:file:///',
'sys.resource.settings.oss.endpoint':'对象存储服务的URL', 'sys.resource.settings.oss.endpoint': '对象存储服务的URL',
'sys.resource.settings.oss.endpoint.note':'对象存储服务的URL,例如:https://oss-cn-hangzhou.aliyuncs.com', 'sys.resource.settings.oss.endpoint.note': '对象存储服务的URL,例如:https://oss-cn-hangzhou.aliyuncs.com',
'sys.resource.settings.oss.accessKey':'Access key就像用户ID,可以唯一标识你的账户', 'sys.resource.settings.oss.accessKey': 'Access key就像用户ID,可以唯一标识你的账户',
'sys.resource.settings.oss.accessKey.note':'Access key就像用户ID,可以唯一标识你的账户', 'sys.resource.settings.oss.accessKey.note': 'Access key就像用户ID,可以唯一标识你的账户',
'sys.resource.settings.oss.secretKey':'Secret key是你账户的密码', 'sys.resource.settings.oss.secretKey': 'Secret key是你账户的密码',
'sys.resource.settings.oss.secretKey.note':'Secret key是你账户的密码', 'sys.resource.settings.oss.secretKey.note': 'Secret key是你账户的密码',
'sys.resource.settings.oss.bucketName':'默认的存储桶名称', 'sys.resource.settings.oss.bucketName': '默认的存储桶名称',
'sys.resource.settings.oss.bucketName.note':'默认的存储桶名称', 'sys.resource.settings.oss.bucketName.note': '默认的存储桶名称',
'sys.resource.settings.oss.region':'区域', 'sys.resource.settings.oss.region': '区域',
'sys.resource.settings.oss.region.note':'区域', 'sys.resource.settings.oss.region.note': '区域',
// process // process
'sys.process.id': '进程ID', 'sys.process.id': '进程ID',
...@@ -918,7 +954,7 @@ export default { ...@@ -918,7 +954,7 @@ export default {
'pages.datastudio.label.execConfig.autostop.tip': '开启自动停止,将在捕获最大行数记录后自动停止任务', 'pages.datastudio.label.execConfig.autostop.tip': '开启自动停止,将在捕获最大行数记录后自动停止任务',
'pages.datastudio.label.savepoint': '保存点', 'pages.datastudio.label.savepoint': '保存点',
'pages.task.savePointPath' : '保存点路径', 'pages.task.savePointPath': '保存点路径',
'pages.datastudio.label.version': '版本历史', 'pages.datastudio.label.version': '版本历史',
'pages.datastudio.label.version.id': '版本ID', 'pages.datastudio.label.version.id': '版本ID',
......
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
import {Button, Descriptions, message, Modal, Tag} from "antd";
import {
CheckCircleOutlined,
CloseCircleOutlined,
ExclamationCircleOutlined, MinusCircleOutlined,
RocketOutlined,
SyncOutlined
} from "@ant-design/icons";
import {Jobs} from "@/types/DevOps/data";
import moment from "moment";
import ProTable, {ActionType, ProColumns} from "@ant-design/pro-table";
import {l} from "@/utils/intl";
import {parseByteStr, parseMilliSecondStr} from "@/utils/function";
import {useRef} from "react";
import {JOB_LIFE_CYCLE} from "@/pages/DevOps/constants";
import {useRequest} from "@@/exports";
import {API_CONSTANTS} from "@/services/constants";
import {JobProps} from "@/pages/DevOps/JobDetail/data";
import {getData} from "@/services/api";
export type CheckPointsDetailInfo = {
id: number,
status: string,
checkpoint_type: string,
end_to_end_duration: number,
external_path: string,
latest_ack_timestamp: number,
state_size: number,
trigger_timestamp: number,
}
const CheckpointTable = (props: JobProps) => {
const {jobDetail} = props;
const actionRef = useRef<ActionType>();
const checkpoints = jobDetail?.jobHistory?.checkpoints;
// const restartFromCheckpoint = useRequest((id: number, isOnLine: boolean, savePointPath: string) => (
// {
// url: API_CONSTANTS.RESTART_TASK_FROM_CHECKPOINT,
// params: {id: id, isOnLine: isOnLine, savePointPath: savePointPath}
// }
// ),
// {manual: true});
function recoveryCheckPoint(row: CheckPointsDetailInfo) {
Modal.confirm({
title: l('devops.jobinfo.ck.recovery'),
content: l('devops.jobinfo.ck.recoveryConfirm', '', {path: row.external_path}),
okText: l('button.confirm'),
cancelText: l('button.cancel'),
onOk: async () => {
const param = {
id: jobDetail?.instance?.taskId,
isOnLine: jobDetail?.instance?.step == JOB_LIFE_CYCLE.ONLINE,
savePointPath: row.external_path
}
const result = await getData(API_CONSTANTS.RESTART_TASK_FROM_CHECKPOINT, param);
if (result.code == 0) {
message.success(l('devops.jobinfo.ck.recovery.success'));
} else {
message.error(l('devops.jobinfo.ck.recovery.failed'));
}
}
});
}
const columns: ProColumns<CheckPointsDetailInfo>[] = [
{
title: l('devops.jobinfo.ck.id'),
align: 'center',
dataIndex: 'id',
},
{
title: l('devops.jobinfo.ck.status'),
align: 'center',
copyable: true,
render: (dom, entity) => {
if (entity.status === 'COMPLETED') {
return <Tag icon={<CheckCircleOutlined/>} color="success">{entity.status}</Tag>
}
if (entity.status === 'IN_PROGRESS') {
return <Tag icon={<SyncOutlined spin/>} color="processing">{entity.status}</Tag>
}
if (entity.status === 'FAILED') {
return <Tag icon={<CloseCircleOutlined/>} color="error">{entity.status}</Tag>
}
return <Tag icon={<MinusCircleOutlined/>} color="default">{entity.status}</Tag>
},
},
{
title: l('devops.jobinfo.ck.duration'),
align: 'center',
copyable: true,
render: (_, entity) => parseMilliSecondStr(entity.end_to_end_duration),
},
{
title: l('devops.jobinfo.ck.checkpoint_type'),
align: 'center',
dataIndex: 'checkpoint_type',
},
{
title: l('devops.jobinfo.ck.external_path'),
align: 'center',
copyable: true,
dataIndex: 'external_path',
},
{
title: l('devops.jobinfo.ck.latest_ack_timestamp'),
align: 'center',
dataIndex: 'latest_ack_timestamp',
valueType: 'dateTime',
},
{
title: l('devops.jobinfo.ck.state_size'),
align: 'center',
render: (dom, entity) => parseByteStr(entity.state_size),
},
{
title: l('devops.jobinfo.ck.trigger_timestamp'),
align: 'center',
valueType: 'dateTime',
dataIndex: 'trigger_timestamp',
},
{
title: l('global.table.operate'),
align: 'center',
render: (dom, entity) => {
return <>
{entity.status === 'COMPLETED' ?
<Button onClick={() => recoveryCheckPoint(entity)}>{l('devops.jobinfo.ck.recovery.recoveryTo')}</Button> : undefined}
</>
},
},
];
return (
<>
<ProTable<CheckPointsDetailInfo>
columns={columns}
style={{width: '100%'}}
dataSource={checkpoints?.history}
onDataSourceChange={(_) => actionRef.current?.reload()}
actionRef={actionRef}
rowKey="id"
pagination={{
defaultPageSize: 10,
showSizeChanger: true,
}}
toolBarRender={false}
dateFormatter="string"
search={false}
size="small"
/>
</>
)
};
export default CheckpointTable;
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
import {Descriptions, Tag} from "antd";
import {
CheckCircleOutlined,
CloseCircleOutlined,
ExclamationCircleOutlined,
RocketOutlined,
SyncOutlined
} from "@ant-design/icons";
import {JobProps} from "@/pages/DevOps/JobDetail/data";
const CkDesc = (props: JobProps) => {
const {jobDetail} = props;
let counts = jobDetail?.jobHistory?.checkpoints.counts
let latest = jobDetail?.jobHistory?.checkpoints.latest
let checkpointsConfigInfo = jobDetail?.jobHistory?.checkpointsConfig
return (
<>
<Descriptions bordered size="small" column={3}>
<Descriptions.Item label="Checkpointing Mode">
<Tag color="blue" title={"Checkpointing Mode"}>
{checkpointsConfigInfo.mode.toUpperCase()}
</Tag>
</Descriptions.Item>
<Descriptions.Item label="Interval">
<Tag color="blue" title={"Interval"}>
{checkpointsConfigInfo.interval}
</Tag>
</Descriptions.Item>
<Descriptions.Item label="Timeout">
<Tag color="blue" title={"Timeout"}>
{checkpointsConfigInfo.timeout}
</Tag>
</Descriptions.Item>
<Descriptions.Item label="Unaligned Checkpoints ">
<Tag color="blue" title={"Unaligned Checkpoints"}>
{checkpointsConfigInfo.unaligned_checkpoints ? 'Enabled' : 'Disabled'}
</Tag>
</Descriptions.Item>
<Descriptions.Item label="Persist Checkpoints Externally Enabled">
<Tag color="blue" title={"Persist Checkpoints Externally Enabled"}>
{checkpointsConfigInfo.externalization.enabled ? 'Enabled' : 'Disabled'}
</Tag>
</Descriptions.Item>
<Descriptions.Item label="CheckPoint Counts">
<Tag color="blue" title={"Total"}>
<RocketOutlined/> Total: {counts.total}
</Tag>
<Tag color="red" title={"Failed"}>
<CloseCircleOutlined/> Failed: {counts.failed}
</Tag>
<Tag color="cyan" title={"Restored"}>
<ExclamationCircleOutlined/> Restored: {counts.restored}
</Tag>
<Tag color="green" title={"Completed"}>
<CheckCircleOutlined/> Completed: {counts.completed}
</Tag>
<Tag color="orange" title={"In Progress"}>
<SyncOutlined spin/> In Progress: {counts.in_progress}
</Tag>
</Descriptions.Item>
<Descriptions.Item label="Latest Failed CheckPoint">
{latest.failed === null ?
<Tag color="red" title={"Latest Failed CheckPoint"}>
{'None'}
</Tag> :
<>
<Tag color="red" title={"Latest Failed CheckPoint"}>
{"id: " + latest.failed.id}
</Tag>
<Tag color="red" title={"Latest Failed CheckPoint"}>
{"Cause: " + latest.failed.failure_message}
</Tag>
</>
}
</Descriptions.Item>
<Descriptions.Item label="Latest Restored">
<Tag color="cyan" title={"Latest Restored"}>
{latest.restored === null ? 'None' :
latest.restored.external_path}
</Tag>
</Descriptions.Item>
<Descriptions.Item label="Latest Savepoint">
<Tag color="purple" title={"Latest Savepoint"}>
{latest.savepoint === null ? 'None' :
latest.savepoint.external_path
}
</Tag>
</Descriptions.Item>
<Descriptions.Item label="Latest Completed CheckPoint">
<Tag color="green" title={"Latest Completed CheckPoint"}>
{latest.completed === null ? 'None' :
latest.completed.external_path
}
</Tag>
</Descriptions.Item>
</Descriptions>
</>
)
};
export default CkDesc;
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
import ProTable, {ActionType, ProColumns} from "@ant-design/pro-table";
import {l} from "@/utils/intl";
import {useRef} from "react";
import {SavePointTableListItem} from "@/pages/DataStudio/RightContainer/SavePoints";
import {queryList} from "@/services/api";
import {JobProps} from "@/pages/DevOps/JobDetail/data";
import {API_CONSTANTS} from "@/services/constants";
const SavepointTable = (props: JobProps) => {
const {jobDetail} = props;
const actionRef = useRef<ActionType>();
const columns: ProColumns<SavePointTableListItem>[] = [
{
title: l('devops.jobinfo.ck.id'),
align: 'center',
dataIndex: 'id',
hideInTable: true,
},
{
title: l('devops.jobinfo.ck.taskid'),
align: 'center',
dataIndex: 'taskId',
hideInTable: true,
},
{
title: l('devops.jobinfo.ck.name'),
align: 'center',
dataIndex: 'name',
},
{
title: l('devops.jobinfo.ck.checkpoint_type'),
align: 'center',
dataIndex: 'type',
},
{
title: l('devops.jobinfo.ck.external_path'),
align: 'center',
copyable: true,
dataIndex: 'path',
},
{
title: l('devops.jobinfo.ck.trigger_timestamp'),
align: 'center',
valueType: 'dateTime',
dataIndex: 'createTime',
},
];
return (
<>
<ProTable<SavePointTableListItem>
columns={columns}
style={{width: '100%'}}
request={(params, sorter, filter) => queryList(API_CONSTANTS.GET_SAVEPOINTS, {
...params,
sorter,
filter:{taskId: [jobDetail?.instance.taskId]}
})}
actionRef={actionRef}
toolBarRender={false}
rowKey="id"
pagination={{
pageSize: 10,
}}
search={false}
size="small"
/>
</>
)
};
export default SavepointTable;
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
import { Tabs} from 'antd';
import {Jobs} from "@/types/DevOps/data";
import {ProCard} from "@ant-design/pro-components";
import CkDesc from "@/pages/DevOps/JobDetail/CheckPointsTab/components/CkDesc";
import CheckpointTable from "@/pages/DevOps/JobDetail/CheckPointsTab/components/CheckpointTable";
import SavepointTable from "@/pages/DevOps/JobDetail/CheckPointsTab/components/SavePointTable";
import {JobProps} from "@/pages/DevOps/JobDetail/data";
const {TabPane} = Tabs;
const CheckPoints = (props: JobProps) => {
const {jobDetail} = props;
return (
<>
<ProCard>
<CkDesc jobDetail={jobDetail}/>
</ProCard>
<br/>
<ProCard>
<Tabs defaultActiveKey="history" size="small">
<TabPane tab={"History"} key="history">
<CheckpointTable jobDetail={jobDetail}/>
</TabPane>
<TabPane tab={"SavePoint"} key="savepoint">
<SavepointTable jobDetail={jobDetail} />
</TabPane>
</Tabs>
</ProCard>
</>)
};
export default CheckPoints;
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
import {Descriptions, Tabs, Tag, Typography} from 'antd';
import {Jobs} from "@/types/DevOps/data";
import {ProCard} from "@ant-design/pro-components";
import ExceptionTab from "@/pages/DevOps/JobDetail/JobLogs/components/ExceptionTab";
import JobManagerLogsTab from "@/pages/DevOps/JobDetail/JobLogs/components/JobManagerLogsTab";
import React from "react";
import TaskManagerLogsTab from "@/pages/DevOps/JobDetail/JobLogs/components/TaskManagerLogsTab";
import {JobProps} from "@/pages/DevOps/JobDetail/data";
const {Text, Paragraph} = Typography;
const JobLogsTab = (props: JobProps) => {
const {jobDetail} = props;
return <>
{/*<ProCard>*/}
<Tabs
tabPosition={'left'}
size={"small"}
items={
[
{
label: 'Exception',
key: 'Exception',
children: <ExceptionTab jobDetail={jobDetail}/>,
},
{
label: 'JobManager',
key: 'JobManager',
children: <JobManagerLogsTab jobDetail={jobDetail}/>,
},
{
label: 'TaskManager',
key: 'TaskManager',
children: <TaskManagerLogsTab jobDetail={jobDetail}/>,
},
]
}
/>
{/*</ProCard>*/}
</>
};
export default JobLogsTab;
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
import {Jobs} from "@/types/DevOps/data";
import {ProCard} from "@ant-design/pro-components";
import {Card, Col, List, Row, Tabs, Typography} from "antd";
import moment from "moment";
import CodeShow from "@/components/CustomEditor/CodeShow";
import React, {useState} from "react";
import {JobProps} from "@/pages/DevOps/JobDetail/data";
const {Paragraph, Text} = Typography;
type Exceptions = {
location: string;
taskName: string;
timestamp: string;
stacktrace: string;
exceptionName: string;
}
const ExceptionTab = (props: JobProps) => {
const {jobDetail} = props;
const [currentLog, setCurrentLog] = useState<Exceptions>({
exceptionName: "",
location: "",
stacktrace: "",
taskName: "",
timestamp: ""
});
const renderLogTab = () => {
var logs = [];
const rte = jobDetail?.jobHistory?.exceptions["root-exception"];
logs.push({"taskName": "RootException", "stacktrace": rte, "exceptionName": rte});
logs.push(...jobDetail.jobHistory?.exceptions["exceptionHistory"]["entries"]);
return (
<Row>
<Col span={3}>
<div id="scrollableDiv">
<List
size={"small"}
header={'Exception List'}
dataSource={logs}
renderItem={(item: Exceptions) => (
<List.Item onClick={() => setCurrentLog(item)}>
<Paragraph ellipsis={true}>{item.taskName}</Paragraph>
</List.Item>
)}
/>
</div>
</Col>
<Col span={21}>
<Card title={currentLog.taskName} bordered={false}
extra={<Paragraph>{moment(currentLog.timestamp).format('YYYY-MM-DD HH:mm:ss.SSS')}</Paragraph>}>
<Paragraph ellipsis={{rows: 1, expandable: false}}>
<blockquote>{currentLog.exceptionName}</blockquote>
</Paragraph>
<CodeShow
code={currentLog.stacktrace?currentLog.stacktrace:"No Exception"}
height={500}
/>
</Card>
</Col>
</Row>
);
};
return <>
<ProCard>
{renderLogTab()}
</ProCard>
</>
};
export default ExceptionTab;
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
import {Descriptions, Spin, Tabs, Tag, Typography} from 'antd';
import {ProCard} from "@ant-design/pro-components";
import {Jobs} from "@/types/DevOps/data";
import CodeShow from "@/components/CustomEditor/CodeShow";
import React, {useState} from "react";
import {useRequest} from "@@/exports";
import {API_CONSTANTS} from "@/services/constants";
import {getData} from "@/services/api";
import {JobProps} from "@/pages/DevOps/JobDetail/data";
const {Text, Paragraph} = Typography;
const JobManagerLogsTab = (props: JobProps) => {
const {jobDetail} = props;
const jmaddr = jobDetail?.history?.jobManagerAddress;
const log = useRequest({
url: API_CONSTANTS.GET_JOBMANAGER_LOG,
params: {address: jmaddr},
});
const stdout = useRequest({
url: API_CONSTANTS.GET_JOBMANAGER_STDOUT,
params: {address: jmaddr},
});
const dump = useRequest({
url: API_CONSTANTS.GET_JOBMANAGER_THREAD_DUMP,
params: {address: jmaddr},
});
const getLog = (ur: any) => {
return <Spin spinning={ur.loading}>
<CodeShow
code={ur.data ? ur.data : "No Log"}
height={600}
/>
</Spin>
}
return <>
<ProCard>
<Tabs
size={"small"}
items={[
{label: 'Log', key: "LOG", children: getLog(log)},
{label: 'Std Out', key: "STDOUT", children: getLog(stdout)},
{label: 'Thread Dump', key: "DUMP", children: getLog(dump)},
]}
/>
</ProCard>
</>
};
export default JobManagerLogsTab;
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
import {Jobs} from "@/types/DevOps/data";
import {ProCard} from "@ant-design/pro-components";
import {Card, Col, List, Row, Spin, Tabs, Typography} from "antd";
import moment from "moment";
import CodeShow from "@/components/CustomEditor/CodeShow";
import React, {useState} from "react";
import {useRequest} from "@@/exports";
import {API_CONSTANTS} from "@/services/constants";
import {JobProps} from "@/pages/DevOps/JobDetail/data";
const {Paragraph, Text} = Typography;
type Taskmanager = {
containerId: string;
containerPath: string;
dataPort: string;
slotsNumber: string;
freeSlots: string;
timeSinceLastHeartbeat: string;
}
const TaskManagerLogsTab = (props: JobProps) => {
const {jobDetail} = props;
const [currentTM, setCurrentTm] = useState<Taskmanager>({
containerId: "1",
containerPath: "",
dataPort: "",
freeSlots: "",
slotsNumber: "",
timeSinceLastHeartbeat: ""
});
const jmaddr = jobDetail?.history?.jobManagerAddress;
const taskManagerList = useRequest({
url: API_CONSTANTS.GET_TASKMANAGER_LIST,
params: {address: jmaddr},
});
const tmLog = useRequest((cid) => ({
url: API_CONSTANTS.GET_TASKMANAGER_LOG,
params: {address: jmaddr, containerId: cid}
}
),
{manual: true});
const refeshLog = (tm: Taskmanager) => {
setCurrentTm(tm);
tmLog.run(tm.containerId);
}
const renderLogTab = () => {
return (
<Row>
<Col span={3}>
<div id="scrollableDiv">
<List
size={"small"}
header={'TaskManager List'}
dataSource={taskManagerList.data}
renderItem={(item: Taskmanager) => (
<List.Item onClick={() => refeshLog(item)}>
<Paragraph ellipsis={true}>{item.containerId}</Paragraph>
</List.Item>
)}
/>
</div>
</Col>
<Col span={21}>
<Card title={currentTM.containerId} bordered={false}
extra={<Paragraph>{currentTM.containerPath}</Paragraph>}>
<Spin spinning={tmLog.loading}>
<CodeShow
code={tmLog.data}
height={500}
/>
</Spin>
</Card>
</Col>
</Row>
);
};
return <>
<ProCard>
{renderLogTab()}
</ProCard>
</>
};
export default TaskManagerLogsTab;
...@@ -8,10 +8,7 @@ import {isStatusDone} from "@/pages/DevOps/function"; ...@@ -8,10 +8,7 @@ import {isStatusDone} from "@/pages/DevOps/function";
import {useRequest} from "@@/exports"; import {useRequest} from "@@/exports";
import {API_CONSTANTS} from "@/services/constants"; import {API_CONSTANTS} from "@/services/constants";
import {JOB_LIFE_CYCLE} from "@/pages/DevOps/constants"; import {JOB_LIFE_CYCLE} from "@/pages/DevOps/constants";
import {JobProps} from "@/pages/DevOps/JobDetail/data";
type OperatorProps = {
jobDetail: Jobs.JobInfoDetail;
};
const operatorType = { const operatorType = {
RESTART_JOB: "restart", RESTART_JOB: "restart",
...@@ -20,7 +17,7 @@ const operatorType = { ...@@ -20,7 +17,7 @@ const operatorType = {
SAVEPOINT_TRIGGER: "trigger", SAVEPOINT_TRIGGER: "trigger",
SAVEPOINT_STOP: "stop", SAVEPOINT_STOP: "stop",
} }
const JobOperator = (props: OperatorProps) => { const JobOperator = (props: JobProps) => {
const {jobDetail} = props const {jobDetail} = props
const webUri = `http://${jobDetail?.history?.jobManagerAddress}/#/job/${jobDetail?.instance?.jid}/overview`; const webUri = `http://${jobDetail?.history?.jobManagerAddress}/#/job/${jobDetail?.instance?.jid}/overview`;
......
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
import {Descriptions, Tag, Typography} from 'antd';
import {Link} from 'umi';
import {Jobs} from "@/types/DevOps/data";
import {l} from '@/utils/intl';
import {ProCard} from "@ant-design/pro-components";
import {TagJobStatus} from "@/pages/DevOps/function";
import {RocketOutlined} from "@ant-design/icons";
import { parseSecondStr } from '@/utils/function';
import JobDesc from "@/pages/DevOps/JobDetail/JobOverview/components/JobDesc";
import FlinkTable from "@/pages/DevOps/JobDetail/JobOverview/components/FlinkTable";
import {JobProps} from "@/pages/DevOps/JobDetail/data";
const JobConfigTab = (props: JobProps) => {
const {jobDetail} = props;
return <>
<JobDesc jobDetail={jobDetail}/>
<FlinkTable jobDetail={jobDetail}/>
</>
};
export default JobConfigTab;
import {Jobs} from "@/types/DevOps/data";
import {ProCard, ProColumns, ProTable} from "@ant-design/pro-components";
import {Descriptions, Tag, Typography} from "antd";
import {l} from "@/utils/intl";
import {TagJobStatus} from "@/pages/DevOps/function";
import {parseByteStr, parseMilliSecondStr, parseNumStr} from "@/utils/function";
import {JobProps} from "@/pages/DevOps/JobDetail/data";
const {Text,Link } = Typography;
export type VerticesTableListItem = {
name: string,
status: string,
metrics: any,
parallelism: number,
startTime: string,
duration: number,
endTime: string,
tasks: any,
}
/**
* Renders the JobConfigTab component.
*
* @param {JobProps} props - The component props containing the job detail.
* @returns {JSX.Element} - The rendered JobConfigTab component.
*/
const FlinkTable = (props: JobProps) => {
const {jobDetail} = props;
const columns: ProColumns<VerticesTableListItem>[] = [
{
title: l('devops.baseinfo.name'),
dataIndex: 'name',
ellipsis: true,
width: 400,
render: (dom, entity) => {
return <Link>{entity.name}</Link>;
},
},
{
title: l('devops.baseinfo.status'),
dataIndex: 'status',
sorter: true,
render: (dom, entity) => {
return <>{TagJobStatus(entity.status)}</>;
},
},
{
title: l('devops.baseinfo.readbytes'),
render: (dom, entity) => {
return parseByteStr(entity.metrics['read-bytes']);
},
},
{
title: l('devops.baseinfo.readrecords'),
render: (dom, entity) => {
return parseNumStr(entity.metrics['read-records']);
},
},
{
title: l('devops.baseinfo.writebytes'),
render: (dom, entity) => {
return parseByteStr(entity.metrics['write-bytes']);
},
},
{
title: l('devops.baseinfo.writerecords'),
render: (dom, entity) => {
return parseNumStr(entity.metrics['write-records']);
},
},
{
title: l('devops.baseinfo.parallelism'),
sorter: true,
dataIndex: 'parallelism',
},
{
title: l('global.table.startTime'),
dataIndex: 'start-time',
valueType: 'dateTime',
},
{
title: l('global.table.useTime'),
render: (dom, entity) => {
return parseMilliSecondStr(entity.duration);
},
},
{
title: l('global.table.endTime'),
dataIndex: 'end-time',
valueType: 'dateTime',
},
// {
// title: l('devops.baseinfo.tasks'),
// render: (dom, entity) => {
// return <StatusCounts statusCounts={entity.tasks}/>;
// },
// },
];
return(
<>
<ProCard>
<ProTable
columns={columns}
style={{width: '100%'}}
dataSource={jobDetail?.jobHistory?.job.vertices}
rowKey="name"
pagination={{
defaultPageSize: 10,
showSizeChanger: true,
}}
toolBarRender={false}
search={false}
size="small"
/>
</ProCard>
<br/>
</>
)
}
export default FlinkTable;
import {Jobs} from "@/types/DevOps/data";
import {ProCard} from "@ant-design/pro-components";
import {Descriptions, Tag, Typography} from "antd";
import {l} from "@/utils/intl";
import {TagJobStatus} from "@/pages/DevOps/function";
import {RocketOutlined} from "@ant-design/icons";
import {Link} from "@@/exports";
import {parseSecondStr} from "@/utils/function";
import {JobProps} from "@/pages/DevOps/JobDetail/data";
const {Text,Paragraph } = Typography;
/**
* Renders the JobConfigTab component.
*
* @param {JobProps} props - The component props containing the job detail.
* @returns {JSX.Element} - The rendered JobConfigTab component.
*/
const JobDesc = (props: JobProps) => {
const {jobDetail} = props;
/**
* Retrieves the savepoint strategy based on the provided strategy value.
*
* @param {string} strategy - The savepoint strategy value.
* @returns {string} - The localized savepoint strategy label.
*/
const getSavePointStrategy = (strategy:string) => {
switch (strategy) {
case "NONE":return l('global.savepoint.strategy.disabled');
case "LATEST":return l('global.savepoint.strategy.latest');
case "EARLIEST":return l('global.savepoint.strategy.earliest');
case "CUSTOM":return l('global.savepoint.strategy.custom');
default:return l('global.savepoint.strategy.disabled');
}
}
/**
* Generates the user custom flink configuration description items.
*
* @param {object} config - The user configuration object.
* @returns {JSX.Element[]} - An array of Descriptions.Item components representing the user configuration.
*/
const getUserConfig = (config:any) =>{
let formList = [];
for (let configKey in config) {
formList.push(
<Descriptions.Item label={configKey}>
{config[configKey]}
</Descriptions.Item>
)
}
return formList;
}
return(
<>
<ProCard>
<Descriptions title={l('devops.jobinfo.config.JobBaseInfo')} bordered size="small">
<Descriptions.Item label={l('global.table.status')}>
{TagJobStatus(jobDetail?.instance?.status)}
</Descriptions.Item>
<Descriptions.Item label={l('devops.jobinfo.config.submitType')}>
<Tag color="pink"><RocketOutlined/> {jobDetail?.history?.type}</Tag>
</Descriptions.Item>
<Descriptions.Item label={l('devops.jobinfo.config.RestartStrategy')}>
<Tag color="blue" title={"Restart Strategy"}>
{jobDetail?.jobHistory?.config['execution-config']['restart-strategy']}
</Tag>
</Descriptions.Item>
<Descriptions.Item label={l('devops.jobinfo.config.ClusterInstanceName')}>
<Link to={"/registration/cluster/instance"}>{jobDetail?.cluster?.alias}</Link>
</Descriptions.Item>
<Descriptions.Item label={l('devops.jobinfo.config.JobId')}>
<Text copyable><a>{jobDetail?.instance?.jid}</a></Text>
</Descriptions.Item>
<Descriptions.Item label={l('devops.jobinfo.config.taskId')}>
<Text copyable><a>{jobDetail?.instance?.taskId}</a></Text>
</Descriptions.Item>
{jobDetail?.clusterConfiguration ?
<Descriptions.Item label={l('devops.jobinfo.config.clusterConfiguration')}>
<Link to={"/registration/cluster/instance"}>{jobDetail?.clusterConfiguration?.name}</Link>
</Descriptions.Item> : undefined
}
<Descriptions.Item label={l('devops.jobinfo.config.useSqlFragment')}>
{jobDetail?.history?.config?.useSqlFragment ? l('button.enable') : l('button.disable')}
</Descriptions.Item>
<Descriptions.Item label={l('devops.jobinfo.config.JobType')}>
{jobDetail?.history?.config?.isJarTask ? 'Jar' : 'FlinkSQL'}
</Descriptions.Item>
<Descriptions.Item label={l('devops.jobinfo.config.execmode')}>
{jobDetail?.history?.config?.useBatchModel ? l('global.table.execmode.batch') : l('global.table.execmode.streaming')}
</Descriptions.Item>
<Descriptions.Item label={l('global.table.createTime')}>
{jobDetail?.instance?.createTime?.toString()}
</Descriptions.Item>
<Descriptions.Item label={l('devops.jobinfo.config.JobParallelism')}>
{jobDetail?.jobHistory?.config['execution-config']['job-parallelism']}
</Descriptions.Item>
<Descriptions.Item label={l('global.table.useTime')}>
{parseSecondStr(jobDetail?.instance?.duration)}
</Descriptions.Item>
<Descriptions.Item label={l('devops.jobinfo.config.startFromSavePoint')}>
{getSavePointStrategy(jobDetail?.history?.config?.savePointStrategy)}
</Descriptions.Item>
<Descriptions.Item label={l('devops.jobinfo.config.savePointPath')} span={2}>
{jobDetail?.history?.config.savePointPath}
</Descriptions.Item>
</Descriptions>
</ProCard>
<br/>
{/*<ProCard>*/}
{/* <Descriptions title={l('devops.jobinfo.config.UserCustomConf')} bordered size="small">*/}
{/* {getUserConfig(jobDetail?.history?.config?.config)}*/}
{/* </Descriptions>*/}
{/*</ProCard>*/}
</>
)
}
export default JobDesc;
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
import {Jobs} from "@/types/DevOps/data";
import {ProCard} from "@ant-design/pro-components";
import {Card, Col, List, message, Modal, Row, Skeleton, Tabs, Tag, Typography} from "antd";
import moment from "moment";
import CodeShow from "@/components/CustomEditor/CodeShow";
import React, {useState} from "react";
import {useRequest} from "@@/exports";
import {API_CONSTANTS} from "@/services/constants";
import {DeleteOutlined, DeleteTwoTone, RocketOutlined} from "@ant-design/icons";
import {l} from "@/utils/intl";
import {JobProps} from "@/pages/DevOps/JobDetail/data";
import {JOB_LIFE_CYCLE} from "@/pages/DevOps/constants";
import {getData, removeById, removeData} from "@/services/api";
type Version = {
id?: number,
taskId?: number,
name?: string,
dialect?: string,
type?: string,
statement: string,
versionId?: string,
createTime?: string
isLatest?: boolean
}
const JobVersionTab = (props: JobProps) => {
const {jobDetail} = props;
const latestVersion: Version = {
type: jobDetail.history.type,
statement: jobDetail.history.statement,
createTime: jobDetail.history.startTime,
versionId: "LATEST",
isLatest: true
};
const [currentVersion, setCurrentVersion] = useState<Version>({statement: ""})
const versionList = useRequest({
url: API_CONSTANTS.GET_JOB_VERSION,
params: {taskId: jobDetail.history.taskId},
}, {
onSuccess: (data: Version[], params) => {
data.splice(0, 0, latestVersion)
}
});
const deleteVersion = (item: Version) => {
Modal.confirm({
title: l('devops.jobinfo.version.delete'),
content: l('devops.jobinfo.version.delete.sure', '', {version: item.versionId}),
okText: l('button.confirm'),
cancelText: l('button.cancel'),
onOk: async () => {
const result = await removeById(API_CONSTANTS.GET_JOB_VERSION, {versionId: item.id});
if (result) {
message.success("Delete Success");
} else {
message.error("Delete faile");
}
versionList.run()
}
});
}
const renderVersionList = () => {
return (
<Row>
<Col span={3}>
<div id="scrollableDiv">
<List
size={"small"}
header={l('devops.jobinfo.version.versionList')}
dataSource={versionList.data}
renderItem={(item: Version) => (<>
<List.Item onClick={() => {
setCurrentVersion(item)
}}>
<Skeleton avatar title={false} loading={versionList.loading} active>
<List.Item.Meta
title={<a>{!item.isLatest ? "V" + item.versionId :
<Tag key={"v-latest"} color="green">{l('devops.jobinfo.version.latestVersion')}</Tag>}</a>}
description={item.createTime}
/>
{!item.isLatest ? <DeleteTwoTone onClick={() => deleteVersion(item)}/> : <></>}
</Skeleton>
</List.Item>
</>
)}
>
</List>
</div>
</Col>
<Col span={21}>
<Card title={"V" + currentVersion?.versionId} bordered={false}
extra={<>
<Tag key={"v-type"} color="blue">{currentVersion?.type}</Tag>
<Tag key={"v-dialect"} color="yellow">{currentVersion?.dialect}</Tag>
</>}>
<CodeShow
code={currentVersion?.statement}
height={500}
language={"sql"}
/>
</Card>
</Col>
</Row>
);
};
return <>
<ProCard>
{renderVersionList()}
</ProCard>
</>
};
export default JobVersionTab;
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
import {Descriptions, Tag, Typography} from 'antd';
import {Link} from 'umi';
import {Jobs} from "@/types/DevOps/data";
import {l} from '@/utils/intl';
import {ProCard} from "@ant-design/pro-components";
import {TagJobStatus} from "@/pages/DevOps/function";
import {RocketOutlined} from "@ant-design/icons";
import { parseSecondStr } from '@/utils/function';
const {Text,Paragraph } = Typography;
type JobProps = {
jobDetail: Jobs.JobInfoDetail;
};
/**
* Renders the JobConfigTab component.
*
* @param {JobProps} props - The component props containing the job detail.
* @returns {JSX.Element} - The rendered JobConfigTab component.
*/
const JobConfigTab = (props: JobProps) => {
const {jobDetail} = props;
/**
* Retrieves the savepoint strategy based on the provided strategy value.
*
* @param {string} strategy - The savepoint strategy value.
* @returns {string} - The localized savepoint strategy label.
*/
const getSavePointStrategy = (strategy:string) => {
switch (strategy) {
case "NONE":return l('global.savepoint.strategy.disabled');
case "LATEST":return l('global.savepoint.strategy.latest');
case "EARLIEST":return l('global.savepoint.strategy.earliest');
case "CUSTOM":return l('global.savepoint.strategy.custom');
default:return l('global.savepoint.strategy.disabled');
}
}
/**
* Generates the user custom flink configuration description items.
*
* @param {object} config - The user configuration object.
* @returns {JSX.Element[]} - An array of Descriptions.Item components representing the user configuration.
*/
const getUserConfig = (config:any) =>{
let formList = [];
for (let configKey in config) {
formList.push(
<Descriptions.Item label={configKey}>
{config[configKey]}
</Descriptions.Item>
)
}
return formList;
}
return <>
<ProCard>
<Descriptions title={l('devops.jobinfo.config.JobBaseInfo')} bordered size="small">
<Descriptions.Item label={l('global.table.status')}>
{TagJobStatus(jobDetail?.instance?.status)}
</Descriptions.Item>
<Descriptions.Item label={l('devops.jobinfo.config.submitType')}>
<Tag color="pink"><RocketOutlined/> {jobDetail?.history?.type}</Tag>
</Descriptions.Item>
<Descriptions.Item label={l('devops.jobinfo.config.RestartStrategy')}>
<Tag color="blue" title={"Restart Strategy"}>
{jobDetail?.jobHistory?.config['execution-config']['restart-strategy']}
</Tag>
</Descriptions.Item>
<Descriptions.Item label={l('devops.jobinfo.config.ClusterInstanceName')}>
<Link to={"/registration/cluster/instance"}>{jobDetail?.cluster?.alias}</Link>
</Descriptions.Item>
<Descriptions.Item label={l('devops.jobinfo.config.JobId')}>
<Text copyable><a>{jobDetail?.instance?.jid}</a></Text>
</Descriptions.Item>
<Descriptions.Item label={l('devops.jobinfo.config.taskId')}>
<Text copyable><a>{jobDetail?.instance?.taskId}</a></Text>
</Descriptions.Item>
{jobDetail?.clusterConfiguration ?
<Descriptions.Item label={l('devops.jobinfo.config.clusterConfiguration')}>
<Link to={"/registration/cluster/instance"}>{jobDetail?.clusterConfiguration?.name}</Link>
</Descriptions.Item> : undefined
}
<Descriptions.Item label={l('devops.jobinfo.config.useSqlFragment')}>
{jobDetail?.history?.config?.useSqlFragment ? l('button.enable') : l('button.disable')}
</Descriptions.Item>
<Descriptions.Item label={l('devops.jobinfo.config.JobType')}>
{jobDetail?.history?.config?.isJarTask ? 'Jar' : 'FlinkSQL'}
</Descriptions.Item>
<Descriptions.Item label={l('devops.jobinfo.config.execmode')}>
{jobDetail?.history?.config?.useBatchModel ? l('global.table.execmode.batch') : l('global.table.execmode.streaming')}
</Descriptions.Item>
<Descriptions.Item label={l('global.table.createTime')}>
{jobDetail?.instance?.createTime?.toString()}
</Descriptions.Item>
<Descriptions.Item label={l('devops.jobinfo.config.JobParallelism')}>
{jobDetail?.jobHistory?.config['execution-config']['job-parallelism']}
</Descriptions.Item>
<Descriptions.Item label={l('global.table.useTime')}>
{parseSecondStr(jobDetail?.instance?.duration)}
</Descriptions.Item>
<Descriptions.Item label={l('devops.jobinfo.config.startFromSavePoint')}>
{getSavePointStrategy(jobDetail?.history?.config?.savePointStrategy)}
</Descriptions.Item>
<Descriptions.Item label={l('devops.jobinfo.config.savePointPath')} span={2}>
{jobDetail?.history?.config.savePointPath}
</Descriptions.Item>
</Descriptions>
</ProCard>
<br/>
<ProCard>
<Descriptions title={l('devops.jobinfo.config.UserCustomConf')} bordered size="small">
{getUserConfig(jobDetail?.history?.config?.config)}
</Descriptions>
</ProCard>
</>
};
export default JobConfigTab;
import {Jobs} from "@/types/DevOps/data";
type JobProps = {
jobDetail: Jobs.JobInfoDetail;
};
...@@ -6,19 +6,26 @@ import {ClusterOutlined, FireOutlined, RocketOutlined} from "@ant-design/icons"; ...@@ -6,19 +6,26 @@ import {ClusterOutlined, FireOutlined, RocketOutlined} from "@ant-design/icons";
import {useLocation} from 'umi'; import {useLocation} from 'umi';
import {useRequest} from "@umijs/max"; import {useRequest} from "@umijs/max";
import {API_CONSTANTS} from "@/services/constants"; import {API_CONSTANTS} from "@/services/constants";
import JobOperator from "@/pages/DevOps/JobDetail/components/JobOperator"; import JobOperator from "@/pages/DevOps/JobDetail/JobOperator/JobOperator";
import type {FC} from 'react'; import type {FC} from 'react';
import {useState} from "react"; import {useState} from "react";
import JobConfigTab from "@/pages/DevOps/JobDetail/components/JobConfigTab"; import JobConfigTab from "@/pages/DevOps/JobDetail/JobOverview/JobOverview";
import {l} from "@/utils/intl"; import {l} from "@/utils/intl";
import JobLogsTab from "@/pages/DevOps/JobDetail/JobLogs/JobLogsTab";
import JobVersionTab from "@/pages/DevOps/JobDetail/JobVersion/JobVersionTab";
import CheckPoints from "@/pages/DevOps/JobDetail/CheckPointsTab";
/** /**
* Enum defining different operators for the JobDetail component. * Enum defining different operators for the JobDetail component.
*/ */
const OperatorEnum = { const OperatorEnum = {
JOB_BASE_INFO:"job_base_info", JOB_BASE_INFO:"job_base_info",
JOB_OVERIVEW:"job_overivew", JOB_LOGS:"job_logs",
JOB_EXCEPTION:"job_exception", JOB_VERSION:"job_version",
JOB_CHECKPOINTS:"job_checkpoints",
JOB_ALERT:"job_alert",
JOB_MONITOR:"job_monitor",
JOB_LINEAGE:"job_lineage",
} }
/** /**
...@@ -50,15 +57,23 @@ const JobDetail:FC = (props: any) => { ...@@ -50,15 +57,23 @@ const JobDetail:FC = (props: any) => {
// Define the components for each job operator // Define the components for each job operator
const JobOperatorItems = { const JobOperatorItems = {
[OperatorEnum.JOB_BASE_INFO]: <JobConfigTab jobDetail={jobInfoDetail} />, [OperatorEnum.JOB_BASE_INFO]: <JobConfigTab jobDetail={jobInfoDetail} />,
[OperatorEnum.JOB_OVERIVEW]: <JobConfigTab jobDetail={jobInfoDetail} />, [OperatorEnum.JOB_LOGS]: <JobLogsTab jobDetail={jobInfoDetail} />,
[OperatorEnum.JOB_EXCEPTION]: <JobConfigTab jobDetail={jobInfoDetail} />, [OperatorEnum.JOB_VERSION]: <JobVersionTab jobDetail={jobInfoDetail} />,
[OperatorEnum.JOB_CHECKPOINTS]: <CheckPoints jobDetail={jobInfoDetail} />,
[OperatorEnum.JOB_MONITOR]: <CheckPoints jobDetail={jobInfoDetail} />,
[OperatorEnum.JOB_LINEAGE]: <CheckPoints jobDetail={jobInfoDetail} />,
[OperatorEnum.JOB_ALERT]: <CheckPoints jobDetail={jobInfoDetail} />,
}; };
// Define the tabs config for job operators // Define the tabs config for job operators
const JobOperatorTabs = [ const JobOperatorTabs = [
{ tab: l('devops.jobinfo.config.JobInfo'), key: OperatorEnum.JOB_BASE_INFO, }, { tab: l('devops.jobinfo.config.JobInfo'), key: OperatorEnum.JOB_BASE_INFO, },
{ tab: l('devops.jobinfo.config.JobOveriew'), key: OperatorEnum.JOB_OVERIVEW, }, { tab: l('devops.jobinfo.config.JobLogs'), key: OperatorEnum.JOB_LOGS, },
{ tab: l('devops.jobinfo.config.JobException'), key: OperatorEnum.JOB_EXCEPTION, }, { tab: l('devops.jobinfo.config.JobVersion'), key: OperatorEnum.JOB_VERSION, },
{ tab: l('devops.jobinfo.config.JobCheckpoints'), key: OperatorEnum.JOB_CHECKPOINTS, },
{ tab: l('devops.jobinfo.config.JobMonitor'), key: OperatorEnum.JOB_MONITOR, },
{ tab: l('devops.jobinfo.config.JobLineage'), key: OperatorEnum.JOB_LINEAGE, },
{ tab: l('devops.jobinfo.config.JobAlert'), key: OperatorEnum.JOB_ALERT, },
]; ];
return ( return (
......
...@@ -201,9 +201,17 @@ export const API_CONSTANTS = { ...@@ -201,9 +201,17 @@ export const API_CONSTANTS = {
GET_JOB_LIST: "/api/jobInstance", GET_JOB_LIST: "/api/jobInstance",
GET_JOB_BY_ID: "/api/jobInstance/getOneById", GET_JOB_BY_ID: "/api/jobInstance/getOneById",
GET_JOB_DETAIL: "/api/jobInstance/getJobInfoDetail", GET_JOB_DETAIL: "/api/jobInstance/getJobInfoDetail",
GET_JOB_VERSION: "/api/task/version",
GET_JOBMANAGER_LOG: "api/jobInstance/getJobManagerLog",
GET_JOBMANAGER_STDOUT: "api/jobInstance/getJobManagerStdOut",
GET_JOBMANAGER_THREAD_DUMP: "api/jobInstance/getJobManagerThreadDump",
GET_TASKMANAGER_LIST: "api/jobInstance/getTaskManagerList",
GET_TASKMANAGER_LOG: "api/jobInstance/getTaskManagerLog",
CANCEL_JOB: "/api/studio/cancel", CANCEL_JOB: "/api/studio/cancel",
OFFLINE_TASK: "/api/task/offLineTask", OFFLINE_TASK: "/api/task/offLineTask",
RESTART_TASK: "/api/task/restartTask", RESTART_TASK: "/api/task/restartTask",
RESTART_TASK_FROM_CHECKPOINT: "/api/task/selectSavePointRestartTask",
GET_SAVEPOINTS: "/api/savepoints",
// -- LDAP // -- LDAP
GET_LDAP_ENABLE: "/api/ldap/ldapEnableStatus", GET_LDAP_ENABLE: "/api/ldap/ldapEnableStatus",
......
...@@ -5,64 +5,77 @@ import {BaseBeanColumns} from "@/types/Public/data"; ...@@ -5,64 +5,77 @@ import {BaseBeanColumns} from "@/types/Public/data";
*/ */
declare namespace Jobs { declare namespace Jobs {
export type JobInstance = BaseBeanColumns & { export type JobInstance = BaseBeanColumns & {
taskId: number, taskId: number,
step: number, step: number,
clusterId: number, clusterId: number,
clusterName: string, clusterName: string,
type: string, type: string,
jobManagerAddress: string, jobManagerAddress: string,
jid: string, jid: string,
status: string, status: string,
historyId: number, historyId: number,
error: string, error: string,
failedRestartCount: number, failedRestartCount: number,
duration: number, duration: number,
finishTime: Date, finishTime: Date,
}; };
export type JobConfig = { export type JobConfig = {
config:{}, config: {},
savePointStrategy:string, savePointStrategy: string,
savePointPath:string, savePointPath: string,
useSqlFragment:string, useSqlFragment: string,
isJarTask:string, isJarTask: string,
useBatchModel:string, useBatchModel: string,
}; };
export type History = { export type History = {
id: number; id: number;
tenantId: number; tenantId: number;
clusterId: number; clusterId: number;
clusterConfigurationId: number; clusterConfigurationId: number;
session: string; session: string;
jobId: string; jobId: string;
jobName: string; jobName: string;
jobManagerAddress: string; jobManagerAddress: string;
status: number; status: number;
statement: string; statement: string;
type: string; type: string;
error: string; error: string;
result: string; result: string;
config: JobConfig; config: JobConfig;
configJson: string; configJson: string;
startTime: string; startTime: string;
endTime: string; endTime: string;
taskId: number; taskId: number;
statusText: string; statusText: string;
clusterName: string; clusterName: string;
}; };
export type JobInfoDetail = { export type JobHistoryItem = {
id: number, id: number,
instance: JobInstance, job: any,
cluster: any, exceptions: any,
clusterConfiguration: any, checkpoints: any,
history: History, checkpointsConfig: any,
jobHistory: any, config: any,
jobManagerConfiguration: any, jar: string,
taskManagerConfiguration: any, cluster: string,
}; clusterConfiguration: string,
updateTime: string,
}
export type JobInfoDetail = {
id: number,
instance: JobInstance,
cluster: any,
clusterConfiguration: any,
history: History,
jobHistory: JobHistoryItem,
jobManagerConfiguration: any,
taskManagerConfiguration: any,
};
} }
...@@ -354,12 +354,44 @@ export const parseSecondStr = (s_time: number) => { ...@@ -354,12 +354,44 @@ export const parseSecondStr = (s_time: number) => {
return time; return time;
}; };
export function parseByteStr(limit: number) {
if (limit == null){
return "None"
}
let size = "";
if (limit < 0.1 * 1024) { //小于0.1KB,则转化成B
size = limit.toFixed(2) + "B"
} else if (limit < 0.1 * 1024 * 1024) { //小于0.1MB,则转化成KB
size = (limit / 1024).toFixed(2) + "KB"
} else if (limit < 0.1 * 1024 * 1024 * 1024) { //小于0.1GB,则转化成MB
size = (limit / (1024 * 1024)).toFixed(2) + "MB"
} else { //其他转化成GB
size = (limit / (1024 * 1024 * 1024)).toFixed(2) + "GB"
}
let sizeStr = size + ""; //转成字符串
let index = sizeStr.indexOf("."); //获取小数点处的索引
let dou = sizeStr.substr(index + 1, 2) //获取小数点后两位的值
if (dou == "00") { //判断后两位是否为00,如果是则删除00
return sizeStr.substring(0, index) + sizeStr.substr(index + 3, 2)
}
return size;
}
export function parseNumStr(num: number) {
let c = (num.toString().indexOf('.') !== -1) ? num.toLocaleString() : num.toString().replace(/(\d)(?=(\d{3})+$)/g, '$1,');
return c;
}
/** /**
* Generate MilliSecond time string * Generate MilliSecond time string
* @param {number} second_time * @param {number} second_time
* @returns {any} * @returns {any}
*/ */
export function parseMilliSecondStr(second_time: number) { export function parseMilliSecondStr(second_time: number) {
if (second_time == null){
return "None"
}
if (((second_time / 1000) % 60) < 1) { if (((second_time / 1000) % 60) < 1) {
return second_time + l('global.time.millisecond'); return second_time + l('global.time.millisecond');
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment