Unverified Commit 713aab46 authored by mydq's avatar mydq Committed by GitHub

Bug pr jobhistory field null (#756)

* fix:dlink平台详情查看信息对象兼容为null问题

* job history null

* fix:blink域名问题

* } add

* dlink文件问题

* superfluous dir remove
Co-authored-by: 's avatarsongshilian <songshilian@qiangungun.com>
parent d301cdd4
...@@ -32,6 +32,8 @@ import com.dlink.service.JobHistoryService; ...@@ -32,6 +32,8 @@ import com.dlink.service.JobHistoryService;
import com.dlink.utils.JSONUtil; import com.dlink.utils.JSONUtil;
import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.JsonNode;
import java.util.Objects;
/** /**
* JobHistoryServiceImpl * JobHistoryServiceImpl
* *
...@@ -92,7 +94,8 @@ public class JobHistoryServiceImpl extends SuperServiceImpl<JobHistoryMapper, Jo ...@@ -92,7 +94,8 @@ public class JobHistoryServiceImpl extends SuperServiceImpl<JobHistoryMapper, Jo
try { try {
JsonNode jobInfo = FlinkAPI.build(jobManagerHost).getJobInfo(jobId); JsonNode jobInfo = FlinkAPI.build(jobManagerHost).getJobInfo(jobId);
if(jobInfo.has(FlinkRestResultConstant.ERRORS)){ if(jobInfo.has(FlinkRestResultConstant.ERRORS)){
return jobHistory; final JobHistory dbHistory = getById(id);
return Objects.isNull(dbHistory) ? jobHistory : dbHistory;
} }
JsonNode exception = FlinkAPI.build(jobManagerHost).getException(jobId); JsonNode exception = FlinkAPI.build(jobManagerHost).getException(jobId);
JsonNode checkPoints = FlinkAPI.build(jobManagerHost).getCheckPoints(jobId); JsonNode checkPoints = FlinkAPI.build(jobManagerHost).getCheckPoints(jobId);
......
...@@ -45,7 +45,7 @@ const CheckPoints = (props: any) => { ...@@ -45,7 +45,7 @@ const CheckPoints = (props: any) => {
const {job} = props; const {job} = props;
const actionRef = useRef<ActionType>(); const actionRef = useRef<ActionType>();
const JsonParseObject = (item : any ) =>{ const JsonParseObject = (item: any) => {
return JSON.parse(JSON.stringify(item)) return JSON.parse(JSON.stringify(item))
} }
...@@ -57,9 +57,11 @@ const CheckPoints = (props: any) => { ...@@ -57,9 +57,11 @@ const CheckPoints = (props: any) => {
return ( return (
<> <>
{JSON.stringify(job?.jobHistory?.checkpoints).includes("errors") ?
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE}/> :
<Descriptions bordered size="small" column={1}> <Descriptions bordered size="small" column={1}>
<Descriptions.Item label="CheckPoint Counts"> <Descriptions.Item label="CheckPoint Counts">
<Tag color="blue" title={"Total"} > <Tag color="blue" title={"Total"}>
<RocketOutlined/> Total: {counts.total} <RocketOutlined/> Total: {counts.total}
</Tag> </Tag>
<Tag color="red" title={"Failed"}> <Tag color="red" title={"Failed"}>
...@@ -94,7 +96,7 @@ const CheckPoints = (props: any) => { ...@@ -94,7 +96,7 @@ const CheckPoints = (props: any) => {
{"id: " + JsonParseObject(latest.failed).id} {"id: " + JsonParseObject(latest.failed).id}
</Tag> </Tag>
<Tag color="red" title={"Latest Failed CheckPoint"}> <Tag color="red" title={"Latest Failed CheckPoint"}>
{ "Fail Time: " + moment(JsonParseObject(latest.failed).failure_timestamp).format('YYYY-MM-DD HH:mm:ss')} {"Fail Time: " + moment(JsonParseObject(latest.failed).failure_timestamp).format('YYYY-MM-DD HH:mm:ss')}
</Tag> </Tag>
<Tag color="red" title={"Latest Failed CheckPoint"}> <Tag color="red" title={"Latest Failed CheckPoint"}>
{"Cause: " + JsonParseObject(latest.failed).failure_message} {"Cause: " + JsonParseObject(latest.failed).failure_message}
...@@ -118,12 +120,12 @@ const CheckPoints = (props: any) => { ...@@ -118,12 +120,12 @@ const CheckPoints = (props: any) => {
</Tag> </Tag>
</Descriptions.Item> </Descriptions.Item>
</Descriptions> </Descriptions>
}
</> </>
) )
} }
const getSummary = (checkpoints: any) => {
const getSummary = (checkpoints : any) => {
let end_to_end_duration = JsonParseObject(JsonParseObject(checkpoints.summary)).end_to_end_duration let end_to_end_duration = JsonParseObject(JsonParseObject(checkpoints.summary)).end_to_end_duration
let state_size = JsonParseObject(JsonParseObject(checkpoints.summary)).state_size let state_size = JsonParseObject(JsonParseObject(checkpoints.summary)).state_size
...@@ -133,6 +135,8 @@ const CheckPoints = (props: any) => { ...@@ -133,6 +135,8 @@ const CheckPoints = (props: any) => {
return ( return (
<> <>
{JSON.stringify(job?.jobHistory?.checkpoints).includes("errors") ?
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE}/> :
<Descriptions bordered size="small" column={1}> <Descriptions bordered size="small" column={1}>
<Descriptions.Item label="End to End Duration"> <Descriptions.Item label="End to End Duration">
<Tag color="blue" title={"Max"}> <Tag color="blue" title={"Max"}>
...@@ -194,6 +198,7 @@ const CheckPoints = (props: any) => { ...@@ -194,6 +198,7 @@ const CheckPoints = (props: any) => {
</Tag> </Tag>
</Descriptions.Item> </Descriptions.Item>
</Descriptions> </Descriptions>
}
</> </>
) )
} }
...@@ -219,7 +224,7 @@ const CheckPoints = (props: any) => { ...@@ -219,7 +224,7 @@ const CheckPoints = (props: any) => {
}); });
} }
const getHistory = (checkpoints : any) => { const getHistory = (checkpoints: any) => {
const checkPointsList: CheckPointsDetailInfo[] = []; const checkPointsList: CheckPointsDetailInfo[] = [];
checkpoints?.history?.forEach((entity: CheckPointsDetailInfo) => { checkpoints?.history?.forEach((entity: CheckPointsDetailInfo) => {
...@@ -330,10 +335,12 @@ const CheckPoints = (props: any) => { ...@@ -330,10 +335,12 @@ const CheckPoints = (props: any) => {
} }
const getConfiguration = (checkpointsConfig : any) => { const getConfiguration = (checkpointsConfig: any) => {
let checkpointsConfigInfo = JsonParseObject(checkpointsConfig) let checkpointsConfigInfo = JsonParseObject(checkpointsConfig)
return ( return (
<> <>
{JSON.stringify(job?.jobHistory?.checkpointsConfig).includes("errors") ?
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE}/> :
<Descriptions bordered size="small" column={1}> <Descriptions bordered size="small" column={1}>
<Descriptions.Item label="Checkpointing Mode"> <Descriptions.Item label="Checkpointing Mode">
<Tag color="blue" title={"Checkpointing Mode"}> <Tag color="blue" title={"Checkpointing Mode"}>
...@@ -355,7 +362,7 @@ const CheckPoints = (props: any) => { ...@@ -355,7 +362,7 @@ const CheckPoints = (props: any) => {
<Descriptions.Item label="Interval"> <Descriptions.Item label="Interval">
<Tag color="blue" title={"Interval"}> <Tag color="blue" title={"Interval"}>
{checkpointsConfigInfo.interval } {checkpointsConfigInfo.interval}
</Tag> </Tag>
</Descriptions.Item> </Descriptions.Item>
...@@ -391,7 +398,7 @@ const CheckPoints = (props: any) => { ...@@ -391,7 +398,7 @@ const CheckPoints = (props: any) => {
{JsonParseObject(checkpointsConfigInfo.externalization).enabled && ( {JsonParseObject(checkpointsConfigInfo.externalization).enabled && (
<Descriptions.Item label="Delete On Cancellation"> <Descriptions.Item label="Delete On Cancellation">
<Tag color="blue" title={"Delete On Cancellation"}> <Tag color="blue" title={"Delete On Cancellation"}>
{ JsonParseObject(checkpointsConfigInfo.externalization).delete_on_cancellation ? 'Enabled' : 'Disabled'} {JsonParseObject(checkpointsConfigInfo.externalization).delete_on_cancellation ? 'Enabled' : 'Disabled'}
</Tag> </Tag>
</Descriptions.Item> </Descriptions.Item>
)} )}
...@@ -403,6 +410,7 @@ const CheckPoints = (props: any) => { ...@@ -403,6 +410,7 @@ const CheckPoints = (props: any) => {
</Tag> </Tag>
</Descriptions.Item> </Descriptions.Item>
</Descriptions> </Descriptions>
}
</> </>
) )
} }
...@@ -454,7 +462,11 @@ const CheckPoints = (props: any) => { ...@@ -454,7 +462,11 @@ const CheckPoints = (props: any) => {
<ProTable<SavePointTableListItem> <ProTable<SavePointTableListItem>
columns={columns} columns={columns}
style={{width: '100%'}} style={{width: '100%'}}
request={(params, sorter, filter) => queryData(url, {taskId: job?.instance.taskId, ...params, sorter, filter})} request={(params, sorter, filter) => queryData(url, {
taskId: job?.instance.taskId, ...params,
sorter,
filter
})}
actionRef={actionRef} actionRef={actionRef}
rowKey="id" rowKey="id"
pagination={{ pagination={{
...@@ -468,11 +480,12 @@ const CheckPoints = (props: any) => { ...@@ -468,11 +480,12 @@ const CheckPoints = (props: any) => {
} }
return (<> return (<>
{(job?.jobHistory?.checkpoints || job?.jobHistory?.checkpointsConfig) &&
<Tabs defaultActiveKey="overview" size="small" tabPosition="top" style={{ <Tabs defaultActiveKey="overview" size="small" tabPosition="top" style={{
border: "1px solid #f0f0f0", border: "1px solid #f0f0f0",
}}> }}>
<TabPane tab={<span>&nbsp; Overview &nbsp;</span>} key="overview"> <TabPane tab={<span>&nbsp; Overview &nbsp;</span>} key="overview">
{ !JSON.stringify(job?.jobHistory?.checkpoints).includes("errors") ? {!JSON.stringify(job?.jobHistory?.checkpoints).includes("errors") ?
getOverview(JsonParseObject(job?.jobHistory?.checkpoints)) : getOverview(JsonParseObject(job?.jobHistory?.checkpoints)) :
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE}/>} <Empty image={Empty.PRESENTED_IMAGE_SIMPLE}/>}
</TabPane> </TabPane>
...@@ -482,14 +495,14 @@ const CheckPoints = (props: any) => { ...@@ -482,14 +495,14 @@ const CheckPoints = (props: any) => {
</TabPane> </TabPane>
<TabPane tab={<span>&nbsp; Summary &nbsp;</span>} key="summary"> <TabPane tab={<span>&nbsp; Summary &nbsp;</span>} key="summary">
{ !JSON.stringify(job?.jobHistory?.checkpoints).includes("errors") ? {!JSON.stringify(job?.jobHistory?.checkpoints).includes("errors") ?
getSummary(JsonParseObject(job?.jobHistory?.checkpoints)) : getSummary(JsonParseObject(job?.jobHistory?.checkpoints)) :
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE}/> <Empty image={Empty.PRESENTED_IMAGE_SIMPLE}/>
} }
</TabPane> </TabPane>
<TabPane tab={<span>&nbsp; Configuration &nbsp;</span>} key="configuration"> <TabPane tab={<span>&nbsp; Configuration &nbsp;</span>} key="configuration">
{ !JSON.stringify(job?.jobHistory?.checkpointsConfig).includes("errors") ? {!JSON.stringify(job?.jobHistory?.checkpointsConfig).includes("errors") ?
getConfiguration(JsonParseObject(job?.jobHistory?.checkpointsConfig)) : getConfiguration(JsonParseObject(job?.jobHistory?.checkpointsConfig)) :
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE}/> <Empty image={Empty.PRESENTED_IMAGE_SIMPLE}/>
} }
...@@ -498,8 +511,7 @@ const CheckPoints = (props: any) => { ...@@ -498,8 +511,7 @@ const CheckPoints = (props: any) => {
<TabPane tab={<span>&nbsp; SavePoint &nbsp;</span>} key="savepoint"> <TabPane tab={<span>&nbsp; SavePoint &nbsp;</span>} key="savepoint">
{getSavePoint()} {getSavePoint()}
</TabPane> </TabPane>
</Tabs> </Tabs>}
</>) </>)
}; };
export default CheckPoints; export default CheckPoints;
...@@ -26,8 +26,9 @@ const {Text, Link} = Typography; ...@@ -26,8 +26,9 @@ const {Text, Link} = Typography;
const Config = (props: any) => { const Config = (props: any) => {
const {job} = props; const {job} = props;
return (<> return (<>
{
job?.jobHistory?.config && <>
<> <>
<Descriptions bordered size="small" title={"Dinky Job Configuration"}> <Descriptions bordered size="small" title={"Dinky Job Configuration"}>
<Descriptions.Item label="执行模式">{job?.history?.type ? ( <Descriptions.Item label="执行模式">{job?.history?.type ? (
...@@ -66,7 +67,7 @@ const Config = (props: any) => { ...@@ -66,7 +67,7 @@ const Config = (props: any) => {
</> </>
<br/><br/> <br/><br/>
<> <>
{ ! JSON.stringify(job?.jobHistory?.config).includes("errors") && {!JSON.stringify(job?.jobHistory?.config).includes("errors") &&
<Descriptions bordered size="small" title={"Flink Job Configuration"}> <Descriptions bordered size="small" title={"Flink Job Configuration"}>
<Descriptions.Item label="Execution Mode"> <Descriptions.Item label="Execution Mode">
<Tag color="blue" title={"Execution Mode"}> <Tag color="blue" title={"Execution Mode"}>
...@@ -98,6 +99,8 @@ const Config = (props: any) => { ...@@ -98,6 +99,8 @@ const Config = (props: any) => {
</Descriptions> </Descriptions>
} }
</> </>
</>
}
</>) </>)
}; };
......
...@@ -33,7 +33,7 @@ const DataMap = (props: any) => { ...@@ -33,7 +33,7 @@ const DataMap = (props: any) => {
setData(undefined); setData(undefined);
const res = getLineage(job.instance?.id); const res = getLineage(job.instance?.id);
res.then((result)=>{ res.then((result)=>{
result.datas.tables.forEach(table => { result.datas?.tables.forEach(table => {
table.isExpand = true; table.isExpand = true;
table.isFold = false; table.isFold = false;
}); });
......
...@@ -28,16 +28,17 @@ const Exception = (props: any) => { ...@@ -28,16 +28,17 @@ const Exception = (props: any) => {
const {job} = props; const {job} = props;
return (<> return (<>
<Tabs defaultActiveKey="RootException" size="small" tabPosition="top" style={{ {job.jobHistory?.exceptions && <Tabs defaultActiveKey="RootException" size="small" tabPosition="top" style={{
border: "1px solid #f0f0f0" border: "1px solid #f0f0f0"
}}> }}>
<TabPane tab={<span>Root Exception</span>} key="RootException"> <TabPane tab={<span>Root Exception</span>} key="RootException">
<CodeShow code={job.jobHistory?.exceptions['root-exception'] as string} language='java' height='500px'/> <CodeShow code={job.jobHistory?.exceptions['root-exception'] as string} language='java' height='500px'/>
</TabPane> </TabPane>
<TabPane tab={<span>Exception History</span>} key="ExceptionHistory"> <TabPane tab={<span>Exception History</span>} key="ExceptionHistory">
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE}/> <Empty image={Empty.PRESENTED_IMAGE_SIMPLE}/>
</TabPane> </TabPane>
</Tabs> </Tabs>}
</>) </>)
}; };
......
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