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 {
return Result.succeed(jobManagerConfiguration);
}
/** 获取 TaskManager 的信息 */
@GetMapping("/getTaskManagerInfo")
@ApiOperation("Get task manager info")
public Result<Set<TaskManagerConfiguration>> getTaskManagerInfo(@RequestParam String address) {
@GetMapping("/getJobManagerLog")
@ApiOperation("Get job manager log")
public Result<String> getJobManagerLog(@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<>();
if (Asserts.isNotNullString(address)) {
FlinkAPI flinkAPI = FlinkAPI.build(address);
......@@ -128,4 +145,11 @@ public class JobInstanceController {
}
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;
import org.dinky.data.dto.TaskVersionHistoryDTO;
import org.dinky.data.model.TaskVersion;
import org.dinky.data.result.ProTableResult;
import org.dinky.data.result.Result;
import org.dinky.service.TaskVersionService;
import java.util.List;
import java.util.stream.Collectors;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.fasterxml.jackson.databind.JsonNode;
import cn.hutool.core.bean.BeanUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
......@@ -54,22 +54,20 @@ public class TaskVersionController {
/**
* query task version list
*
* @param para {@link JsonNode} params
* @return {@link ProTableResult}<{@link TaskVersionHistoryDTO}>
*/
@PostMapping
public ProTableResult<TaskVersionHistoryDTO> listTaskVersions(@RequestBody JsonNode para) {
ProTableResult<TaskVersionHistoryDTO> versionHistoryDTOProTableResult = new ProTableResult<>();
ProTableResult<TaskVersion> versionProTableResult = versionService.selectForProTable(para);
BeanUtil.copyProperties(versionProTableResult, versionHistoryDTOProTableResult);
List<TaskVersionHistoryDTO> collect = versionProTableResult.getData().stream()
@GetMapping
public Result<List<TaskVersionHistoryDTO>> listTaskVersions(@RequestParam int taskId) {
List<TaskVersion> taskVersions = versionService.getTaskVersionByTaskId(taskId);
List<TaskVersionHistoryDTO> collect = taskVersions.stream()
.map(t -> BeanUtil.copyProperties(t, TaskVersionHistoryDTO.class))
.collect(Collectors.toList());
return Result.succeed(collect);
}
versionHistoryDTOProTableResult.setData(collect);
return versionHistoryDTOProTableResult;
@DeleteMapping
public Result<Boolean> deleteVersion(@RequestParam int versionId) {
boolean b = versionService.removeById(versionId);
return Result.succeed(b);
}
}
......@@ -111,27 +111,6 @@ public class BuildConfiguration {
String memoryConfiguration = JSONUtil.toJsonString(taskManagers.get("memoryConfiguration"));
// memoryConfiguration
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.setContainerId(containerId);
......@@ -148,10 +127,6 @@ public class BuildConfiguration {
/* TaskContainerConfigInfo 赋值 */
TaskContainerConfigInfo taskContainerConfigInfo = new TaskContainerConfigInfo();
taskContainerConfigInfo.setMetrics(taskManagerMetricsMap);
taskContainerConfigInfo.setTaskManagerLog(taskManagerLog);
taskContainerConfigInfo.setTaskManagerThreadDump(taskManagerThreadDumps);
taskContainerConfigInfo.setTaskManagerStdout(taskManagerStdOut);
taskManagerConfiguration.setTaskContainerConfigInfo(taskContainerConfigInfo);
......
......@@ -37,6 +37,8 @@ public class TaskVersionServiceImpl extends SuperServiceImpl<TaskVersionMapper,
@Override
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 {
public String getJobManagerLog() {
return getResult(FlinkRestAPIConstant.JOB_MANAGER + FlinkRestAPIConstant.LOG);
}
/** @return JsonNode */
public String getJobManagerThreadDump() {
return getResult(FlinkRestAPIConstant.JOB_MANAGER + FlinkRestAPIConstant.THREAD_DUMP);
}
/** @return String */
public String getJobManagerStdOut() {
......
......@@ -51,6 +51,7 @@ export type CodeShowFormProps = {
showFloatButton?: boolean;
refreshLogCallback?: () => void;
fullScreenBtn?: boolean;
};
const CodeShow = (props: CodeShowFormProps) => {
......@@ -98,6 +99,7 @@ const CodeShow = (props: CodeShowFormProps) => {
// id: language || "typescript",
// });
/**
* handle sync log
* @returns {Promise<void>}
......
This diff is collapsed.
This diff is collapsed.
/*
*
* 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";
import {useRequest} from "@@/exports";
import {API_CONSTANTS} from "@/services/constants";
import {JOB_LIFE_CYCLE} from "@/pages/DevOps/constants";
type OperatorProps = {
jobDetail: Jobs.JobInfoDetail;
};
import {JobProps} from "@/pages/DevOps/JobDetail/data";
const operatorType = {
RESTART_JOB: "restart",
......@@ -20,7 +17,7 @@ const operatorType = {
SAVEPOINT_TRIGGER: "trigger",
SAVEPOINT_STOP: "stop",
}
const JobOperator = (props: OperatorProps) => {
const JobOperator = (props: JobProps) => {
const {jobDetail} = props
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";
import {useLocation} from 'umi';
import {useRequest} from "@umijs/max";
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 {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 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.
*/
const OperatorEnum = {
JOB_BASE_INFO:"job_base_info",
JOB_OVERIVEW:"job_overivew",
JOB_EXCEPTION:"job_exception",
JOB_LOGS:"job_logs",
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) => {
// Define the components for each job operator
const JobOperatorItems = {
[OperatorEnum.JOB_BASE_INFO]: <JobConfigTab jobDetail={jobInfoDetail} />,
[OperatorEnum.JOB_OVERIVEW]: <JobConfigTab jobDetail={jobInfoDetail} />,
[OperatorEnum.JOB_EXCEPTION]: <JobConfigTab jobDetail={jobInfoDetail} />,
[OperatorEnum.JOB_LOGS]: <JobLogsTab 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
const JobOperatorTabs = [
{ 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.JobException'), key: OperatorEnum.JOB_EXCEPTION, },
{ tab: l('devops.jobinfo.config.JobLogs'), key: OperatorEnum.JOB_LOGS, },
{ 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 (
......
......@@ -201,9 +201,17 @@ export const API_CONSTANTS = {
GET_JOB_LIST: "/api/jobInstance",
GET_JOB_BY_ID: "/api/jobInstance/getOneById",
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",
OFFLINE_TASK: "/api/task/offLineTask",
RESTART_TASK: "/api/task/restartTask",
RESTART_TASK_FROM_CHECKPOINT: "/api/task/selectSavePointRestartTask",
GET_SAVEPOINTS: "/api/savepoints",
// -- LDAP
GET_LDAP_ENABLE: "/api/ldap/ldapEnableStatus",
......
......@@ -5,64 +5,77 @@ import {BaseBeanColumns} from "@/types/Public/data";
*/
declare namespace Jobs {
export type JobInstance = BaseBeanColumns & {
taskId: number,
step: number,
clusterId: number,
clusterName: string,
type: string,
jobManagerAddress: string,
jid: string,
status: string,
historyId: number,
error: string,
failedRestartCount: number,
duration: number,
finishTime: Date,
};
export type JobInstance = BaseBeanColumns & {
taskId: number,
step: number,
clusterId: number,
clusterName: string,
type: string,
jobManagerAddress: string,
jid: string,
status: string,
historyId: number,
error: string,
failedRestartCount: number,
duration: number,
finishTime: Date,
};
export type JobConfig = {
config:{},
savePointStrategy:string,
savePointPath:string,
useSqlFragment:string,
isJarTask:string,
useBatchModel:string,
};
export type JobConfig = {
config: {},
savePointStrategy: string,
savePointPath: string,
useSqlFragment: string,
isJarTask: string,
useBatchModel: string,
};
export type History = {
id: number;
tenantId: number;
clusterId: number;
clusterConfigurationId: number;
session: string;
jobId: string;
jobName: string;
jobManagerAddress: string;
status: number;
statement: string;
type: string;
error: string;
result: string;
config: JobConfig;
configJson: string;
startTime: string;
endTime: string;
taskId: number;
statusText: string;
clusterName: string;
};
export type History = {
id: number;
tenantId: number;
clusterId: number;
clusterConfigurationId: number;
session: string;
jobId: string;
jobName: string;
jobManagerAddress: string;
status: number;
statement: string;
type: string;
error: string;
result: string;
config: JobConfig;
configJson: string;
startTime: string;
endTime: string;
taskId: number;
statusText: string;
clusterName: string;
};
export type JobInfoDetail = {
id: number,
instance: JobInstance,
cluster: any,
clusterConfiguration: any,
history: History,
jobHistory: any,
jobManagerConfiguration: any,
taskManagerConfiguration: any,
};
export type JobHistoryItem = {
id: number,
job: any,
exceptions: any,
checkpoints: any,
checkpointsConfig: any,
config: any,
jar: string,
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) => {
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
* @param {number} second_time
* @returns {any}
*/
export function parseMilliSecondStr(second_time: number) {
if (second_time == null){
return "None"
}
if (((second_time / 1000) % 60) < 1) {
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