Skip to content

Commit

Permalink
[Feature-644][admin,web] add snapshotinfo ,taskmanagerConfig && updat…
Browse files Browse the repository at this point in the history
…e configInfo of DevOps

[Feature-644][admin,web] add snapshotinfo ,taskmanagerConfig && update configInfo of DevOps
  • Loading branch information
aiwenmo authored Jun 26, 2022
2 parents 5e71add + e8148e7 commit 4b36161
Show file tree
Hide file tree
Showing 8 changed files with 488 additions and 26 deletions.
8 changes: 8 additions & 0 deletions dlink-admin/src/main/java/com/dlink/model/JobInfoDetail.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public class JobInfoDetail {
private ClusterConfiguration clusterConfiguration;
private History history;
private JobHistory jobHistory;
private JobManagerConfiguration jobManagerConfiguration;
private Integer refreshCount;

public JobInfoDetail(Integer id) {
Expand Down Expand Up @@ -53,6 +54,13 @@ public void setClusterConfiguration(ClusterConfiguration clusterConfiguration) {
this.clusterConfiguration = clusterConfiguration;
}

public void setJobManagerConfiguration(JobManagerConfiguration jobMangerConfiguration) {
this.jobManagerConfiguration = jobMangerConfiguration;
}
public JobManagerConfiguration getJobManagerConfiguration() {
return jobManagerConfiguration;
}

public History getHistory() {
return history;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package com.dlink.model;

import lombok.Data;

import java.util.Map;

/**
* @program: dlink
* @description: JobManager 配置信息
* @author: zhumingye
* @create: 2022-06-26 10:53
*/

@Data
public class JobManagerConfiguration {

private Map<String, String> metrics ;

private Map<String, String> jobManagerConfig;

private String jobManagerLog;

private String jobManagerStdout;

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.dlink.alert.*;
import com.dlink.api.FlinkAPI;
import com.dlink.assertion.Assert;
import com.dlink.assertion.Asserts;
import com.dlink.assertion.Tips;
Expand Down Expand Up @@ -40,10 +41,7 @@
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.*;

/**
* 任务 服务实现类
Expand Down Expand Up @@ -572,6 +570,40 @@ public JobInstance refreshJobInstance(Integer id, boolean isCoercive) {
jobInfoDetail.setCluster(cluster);
History history = historyService.getById(jobInstance.getHistoryId());
history.setConfig(JSONUtil.parseObject(history.getConfigJson()));

JobManagerConfiguration jobManagerConfiguration = new JobManagerConfiguration();
if(Asserts.isNotNullString(history.getJobManagerAddress())) {
FlinkAPI flinkAPI = FlinkAPI.build(history.getJobManagerAddress());

Map<String, String> jobManagerMetricsMap = new HashMap<String, String>(); //获取jobManager metrics
List<LinkedHashMap> jobManagerMetricsItemsList = JSONUtil.toList(JSONUtil.toJsonString(flinkAPI.getJobManagerMetrics()), LinkedHashMap.class);
jobManagerMetricsItemsList.forEach(mapItems -> {
String configKey = (String) mapItems.get("id");
String configValue = (String) mapItems.get("value");
if (Asserts.isNotNullString( configKey) && Asserts.isNotNullString(configValue)) {
jobManagerMetricsMap.put(configKey, configValue);
}
});
Map<String, String> jobManagerConfigMap = new HashMap<String, String>();//获取jobManager配置信息
List<LinkedHashMap> jobManagerConfigMapItemsList = JSONUtil.toList(JSONUtil.toJsonString(flinkAPI.getJobManagerConfig()), LinkedHashMap.class);
jobManagerConfigMapItemsList.forEach(mapItems -> {
String configKey = (String) mapItems.get("key");
String configValue = (String) mapItems.get("value");
if (Asserts.isNotNullString( configKey) && Asserts.isNotNullString(configValue)) {
jobManagerConfigMap.put(configKey, configValue);
}
});
String jobMangerLog = flinkAPI.getJobManagerLog(); //获取jobManager日志
String jobManagerStdOut = flinkAPI.getJobManagerStdOut(); //获取jobManager标准输出日志

jobManagerConfiguration.setMetrics(jobManagerMetricsMap);
jobManagerConfiguration.setJobManagerConfig(jobManagerConfigMap);
jobManagerConfiguration.setJobManagerLog(jobMangerLog);
jobManagerConfiguration.setJobManagerStdout(jobManagerStdOut);

jobInfoDetail.setJobManagerConfiguration(jobManagerConfiguration);
}

if (Asserts.isNotNull(history) && Asserts.isNotNull(history.getClusterConfigurationId())) {
jobInfoDetail.setClusterConfiguration(clusterConfigurationService.getClusterConfigById(history.getClusterConfigurationId()));
}
Expand Down
266 changes: 266 additions & 0 deletions dlink-web/src/pages/DevOps/JobInfo/CheckPoints/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,266 @@
import {Descriptions, Empty, Tabs, Tag} from 'antd';
import {
CheckCircleOutlined,
CloseCircleOutlined,
ExclamationCircleOutlined,
RocketOutlined,
SyncOutlined
} from "@ant-design/icons";
import {parseByteStr, parseMilliSecondStr, parseSecondStr} from "@/components/Common/function";

const {TabPane} = Tabs;

const CheckPoints = (props: any) => {

const {job} = props;

const getOverview = () => {
return (
<>
{(job?.jobHistory?.checkpoints) ?
<Descriptions bordered size="small" column={1} >
<Descriptions.Item label="CheckPoint Counts">
<Tag color="blue" title={"Total"}>
<RocketOutlined/> Total: {job?.jobHistory?.checkpoints['counts']['total']}
</Tag>
<Tag color="red" title={"Failed"}>
<CloseCircleOutlined /> Failed: {job?.jobHistory?.checkpoints['counts']['failed']}
</Tag>
<Tag color="cyan" title={"Restored"}>
<ExclamationCircleOutlined /> Restored: {job?.jobHistory?.checkpoints['counts']['restored']}
</Tag>
<Tag color="green" title={"Completed"}>
<CheckCircleOutlined /> Completed: {job?.jobHistory?.checkpoints['counts']['completed']}
</Tag>
<Tag color="orange" title={"In Progress"}>
<SyncOutlined /> In Progress: {job?.jobHistory?.checkpoints['counts']['in_progress']}
</Tag>
</Descriptions.Item>

<Descriptions.Item label="Latest Completed CheckPoint">
<Tag color="green" title={"Latest Completed CheckPoint"}>
{job?.jobHistory?.checkpoints['latest']['completed'] === null ? 'None' :
job?.jobHistory?.checkpoints['latest']['completed']['external_path']
}
</Tag>
</Descriptions.Item>

<Descriptions.Item label="Latest Failed CheckPoint">
<Tag color="red" title={"Latest Failed CheckPoint"}>
{job?.jobHistory?.checkpoints['latest']['failed']=== null ? 'None' :
job?.jobHistory?.checkpoints['latest']['failed']['external_path']
}
</Tag>
</Descriptions.Item>

<Descriptions.Item label="Latest Restored">
<Tag color="cyan" title={"Latest Restored"}>
{job?.jobHistory?.checkpoints['latest']['restored'] === null ? 'None' :
job?.jobHistory?.checkpoints['latest']['restored']['external_path'] }
</Tag>
</Descriptions.Item>

<Descriptions.Item label="Latest Savepoint">
<Tag color="purple" title={"Latest Savepoint"}>
{job?.jobHistory?.checkpoints['latest']['savepoint'] === null ? 'None' :
job?.jobHistory?.checkpoints['latest']['savepoint']['external_path']
}
</Tag>
</Descriptions.Item>

</Descriptions>
: <Empty image={Empty.PRESENTED_IMAGE_SIMPLE}/>
}
</>
)
}

const getSummary = () => {


return (
<>
{(job?.jobHistory?.checkpoints) ?
<Descriptions bordered size="small" column={1} >
<Descriptions.Item label="End to End Duration">
<Tag color="blue" title={"Max"}>
<RocketOutlined/> Max: {parseSecondStr(job?.jobHistory?.checkpoints['summary']['end_to_end_duration']['max']) }
</Tag>
<Tag color="green" title={"Min"}>
<RocketOutlined/> Min: {parseSecondStr(job?.jobHistory?.checkpoints['summary']['end_to_end_duration']['min']) }
</Tag>
<Tag color="orange" title={"Avg"}>
<RocketOutlined/> Avg: {parseSecondStr(job?.jobHistory?.checkpoints['summary']['end_to_end_duration']['avg']) }
</Tag>
</Descriptions.Item>

<Descriptions.Item label="Checkpointed Data Size">
<Tag color="blue" title={"Max"}>
<RocketOutlined/> Max: {parseByteStr(job?.jobHistory?.checkpoints['summary']['state_size']['max']) }
</Tag>
<Tag color="green" title={"Min"}>
<RocketOutlined/> Min: {parseByteStr(job?.jobHistory?.checkpoints['summary']['state_size']['min']) }
</Tag>
<Tag color="orange" title={"Avg"}>
<RocketOutlined/> Avg: {parseByteStr(job?.jobHistory?.checkpoints['summary']['state_size']['avg']) }
</Tag>
</Descriptions.Item>

<Descriptions.Item label="Processed (persisted) in-flight data">
<Tag color="blue" title={"Max"}>
<RocketOutlined/> Max: {job?.jobHistory?.checkpoints['summary']['processed_data']['max']}
</Tag>
<Tag color="green" title={"Min"}>
<RocketOutlined/> Min: {job?.jobHistory?.checkpoints['summary']['processed_data']['min']}
</Tag>
<Tag color="orange" title={"Avg"}>
<RocketOutlined/> Avg: {job?.jobHistory?.checkpoints['summary']['processed_data']['avg']}
</Tag>
</Descriptions.Item>

<Descriptions.Item label="Persisted data">
<Tag color="blue" title={"Max"}>
<RocketOutlined/> Max: {job?.jobHistory?.checkpoints['summary']['persisted_data']['max']}
</Tag>
<Tag color="green" title={"Min"}>
<RocketOutlined/> Min: {job?.jobHistory?.checkpoints['summary']['persisted_data']['min']}
</Tag>
<Tag color="orange" title={"Avg"}>
<RocketOutlined/> Avg: {job?.jobHistory?.checkpoints['summary']['persisted_data']['avg']}
</Tag>
</Descriptions.Item>

<Descriptions.Item label="Alignment Buffered">
<Tag color="blue" title={"Max"}>
<RocketOutlined/> Max: {job?.jobHistory?.checkpoints['summary']['alignment_buffered']['max']}
</Tag>
<Tag color="green" title={"Min"}>
<RocketOutlined/> Min: {job?.jobHistory?.checkpoints['summary']['alignment_buffered']['min']}
</Tag>
<Tag color="orange" title={"Avg"}>
<RocketOutlined/> Avg: {job?.jobHistory?.checkpoints['summary']['alignment_buffered']['avg']}
</Tag>
</Descriptions.Item>
</Descriptions>
: <Empty image={Empty.PRESENTED_IMAGE_SIMPLE}/>
}
</>
)
}


const getHistory = () => {

return (
<>
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE}/>
</>
)
}


const getConfigraution = () => {

return (
<>
{(job?.jobHistory?.checkpointsConfig) ?
<Descriptions bordered size="small" column={1} >
<Descriptions.Item label="Checkpointing Mode">
<Tag color="blue" title={"Checkpointing Mode"}>
{job?.jobHistory?.checkpointsConfig['mode'].toUpperCase() }
</Tag>
</Descriptions.Item>

<Descriptions.Item label="Checkpoint Storage">
<Tag color="blue" title={"Checkpoint Storage"}>
{job?.jobHistory?.checkpointsConfig['checkpoint_storage']? job?.jobHistory?.checkpointsConfig['checkpoint_storage'] : 'Disabled'}
</Tag>
</Descriptions.Item>

<Descriptions.Item label="State Backend">
<Tag color="blue" title={"State Backend"}>
{job?.jobHistory?.checkpointsConfig['state_backend'] ? job?.jobHistory?.checkpointsConfig['state_backend'] : 'Disabled' }
</Tag>
</Descriptions.Item>

<Descriptions.Item label="Interval">
<Tag color="blue" title={"Interval"}>
{job?.jobHistory?.checkpointsConfig['interval'] }
</Tag>
</Descriptions.Item>

<Descriptions.Item label="Timeout">
<Tag color="blue" title={"Timeout"}>
{parseMilliSecondStr(job?.jobHistory?.checkpointsConfig['timeout'])}
</Tag>
</Descriptions.Item>

<Descriptions.Item label="Minimum Pause Between Checkpoints">
<Tag color="blue" title={"Minimum Pause Between Checkpoints"}>
{parseSecondStr(job?.jobHistory?.checkpointsConfig['min_pause']) }
</Tag>
</Descriptions.Item>

<Descriptions.Item label="Maximum Concurrent Checkpoints">
<Tag color="blue" title={"Maximum Concurrent Checkpoints"}>
{job?.jobHistory?.checkpointsConfig['max_concurrent'] }
</Tag>
</Descriptions.Item>

<Descriptions.Item label="Unaligned Checkpoints ">
<Tag color="blue" title={"Unaligned Checkpoints"}>
{job?.jobHistory?.checkpointsConfig['unaligned_checkpoints'] ? 'Enabled' : 'Disabled'}
</Tag>
</Descriptions.Item>

<Descriptions.Item label="Persist Checkpoints Externally Enabled">
<Tag color="blue" title={"Persist Checkpoints Externally Enabled"}>
{job?.jobHistory?.checkpointsConfig['externalization']['enabled'] ? 'Enabled' : 'Disabled'}
</Tag>
</Descriptions.Item>
{job?.jobHistory?.checkpointsConfig['externalization']['enabled'] && (
<Descriptions.Item label="Delete On Cancellation">
<Tag color="blue" title={"Delete On Cancellation"}>
{job?.jobHistory?.checkpointsConfig['externalization']['delete_on_cancellation'] ? 'Enabled' : 'Disabled'}
</Tag>
</Descriptions.Item>
)}


<Descriptions.Item label="Tolerable Failed Checkpoints">
<Tag color="blue" title={"Tolerable Failed Checkpoints"}>
{job?.jobHistory?.checkpointsConfig['tolerable_failed_checkpoints'] }
</Tag>
</Descriptions.Item>
</Descriptions>
: <Empty image={Empty.PRESENTED_IMAGE_SIMPLE}/>
}
</>
)
}


return (<>
<Tabs defaultActiveKey="overview" size="small" tabPosition="top" style={{
border: "1px solid #f0f0f0",
}}>
<TabPane tab={<span>&nbsp; Overview &nbsp;</span>} key="overview">
{getOverview()}
</TabPane>

<TabPane tab={<span>&nbsp; History &nbsp;</span>} key="history">
{getHistory()}
</TabPane>

<TabPane tab={<span>&nbsp; Summary &nbsp;</span>} key="summary">
{getSummary()}
</TabPane>

<TabPane tab={<span>&nbsp; Configraution &nbsp;</span>} key="configraution">
{getConfigraution()}
</TabPane>
</Tabs>
</>)
};

export default CheckPoints;
Loading

0 comments on commit 4b36161

Please sign in to comment.