From 713aab46a0cca0e3b50c9df7d5e7f318301858f2 Mon Sep 17 00:00:00 2001 From: mydq <42607771+mydq@users.noreply.github.com> Date: Fri, 22 Jul 2022 10:37:24 +0800 Subject: [PATCH] Bug pr jobhistory field null (#756) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix:dlink平台详情查看信息对象兼容为null问题 * job history null * fix:blink域名问题 * } add * dlink文件问题 * superfluous dir remove Co-authored-by: songshilian --- .../service/impl/JobHistoryServiceImpl.java | 5 +- .../DevOps/JobInfo/CheckPoints/index.tsx | 68 +++++---- .../src/pages/DevOps/JobInfo/Config/index.tsx | 139 +++++++++--------- .../pages/DevOps/JobInfo/DataMap/index.tsx | 2 +- .../pages/DevOps/JobInfo/Exception/index.tsx | 5 +- 5 files changed, 119 insertions(+), 100 deletions(-) diff --git a/dlink-admin/src/main/java/com/dlink/service/impl/JobHistoryServiceImpl.java b/dlink-admin/src/main/java/com/dlink/service/impl/JobHistoryServiceImpl.java index f82000adaa..247c3cf28f 100644 --- a/dlink-admin/src/main/java/com/dlink/service/impl/JobHistoryServiceImpl.java +++ b/dlink-admin/src/main/java/com/dlink/service/impl/JobHistoryServiceImpl.java @@ -32,6 +32,8 @@ import com.dlink.utils.JSONUtil; import com.fasterxml.jackson.databind.JsonNode; +import java.util.Objects; + /** * JobHistoryServiceImpl * @@ -92,7 +94,8 @@ public JobHistory refreshJobHistory(Integer id, String jobManagerHost, String jo try { JsonNode jobInfo = FlinkAPI.build(jobManagerHost).getJobInfo(jobId); 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 checkPoints = FlinkAPI.build(jobManagerHost).getCheckPoints(jobId); diff --git a/dlink-web/src/pages/DevOps/JobInfo/CheckPoints/index.tsx b/dlink-web/src/pages/DevOps/JobInfo/CheckPoints/index.tsx index e8c6408395..ad0d60544b 100644 --- a/dlink-web/src/pages/DevOps/JobInfo/CheckPoints/index.tsx +++ b/dlink-web/src/pages/DevOps/JobInfo/CheckPoints/index.tsx @@ -45,8 +45,8 @@ const CheckPoints = (props: any) => { const {job} = props; const actionRef = useRef(); - const JsonParseObject = (item : any ) =>{ - return JSON.parse(JSON.stringify(item)) + const JsonParseObject = (item: any) => { + return JSON.parse(JSON.stringify(item)) } @@ -57,9 +57,11 @@ const CheckPoints = (props: any) => { return ( <> + {JSON.stringify(job?.jobHistory?.checkpoints).includes("errors") ? + : - + Total: {counts.total} @@ -78,7 +80,7 @@ const CheckPoints = (props: any) => { - {latest.completed === null ? 'None' : + {latest.completed === null ? 'None' : JsonParseObject(latest.completed).external_path } @@ -86,19 +88,19 @@ const CheckPoints = (props: any) => { {latest.failed === null ? - - {'None'} - : + + {'None'} + : <> {"id: " + JsonParseObject(latest.failed).id} - { "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')} + {"Cause: " + JsonParseObject(latest.failed).failure_message} - + } @@ -118,12 +120,12 @@ const CheckPoints = (props: any) => { + } ) } - - const getSummary = (checkpoints : any) => { + const getSummary = (checkpoints: any) => { let end_to_end_duration = JsonParseObject(JsonParseObject(checkpoints.summary)).end_to_end_duration let state_size = JsonParseObject(JsonParseObject(checkpoints.summary)).state_size @@ -133,6 +135,8 @@ const CheckPoints = (props: any) => { return ( <> + {JSON.stringify(job?.jobHistory?.checkpoints).includes("errors") ? + : @@ -194,6 +198,7 @@ const CheckPoints = (props: any) => { + } ) } @@ -219,7 +224,7 @@ const CheckPoints = (props: any) => { }); } - const getHistory = (checkpoints : any) => { + const getHistory = (checkpoints: any) => { const checkPointsList: CheckPointsDetailInfo[] = []; checkpoints?.history?.forEach((entity: CheckPointsDetailInfo) => { @@ -299,7 +304,7 @@ const CheckPoints = (props: any) => { render: (dom, entity) => { return <> {entity.status === 'COMPLETED' ? - : undefined} + : undefined} }, }, @@ -330,10 +335,12 @@ const CheckPoints = (props: any) => { } - const getConfiguration = (checkpointsConfig : any) => { + const getConfiguration = (checkpointsConfig: any) => { let checkpointsConfigInfo = JsonParseObject(checkpointsConfig) return ( <> + {JSON.stringify(job?.jobHistory?.checkpointsConfig).includes("errors") ? + : @@ -343,19 +350,19 @@ const CheckPoints = (props: any) => { - {checkpointsConfigInfo.checkpoint_storage ? checkpointsConfigInfo.checkpoint_storage : 'Disabled'} + {checkpointsConfigInfo.checkpoint_storage ? checkpointsConfigInfo.checkpoint_storage : 'Disabled'} - {checkpointsConfigInfo.state_backend ? checkpointsConfigInfo.state_backend : 'Disabled'} + {checkpointsConfigInfo.state_backend ? checkpointsConfigInfo.state_backend : 'Disabled'} - {checkpointsConfigInfo.interval } + {checkpointsConfigInfo.interval} @@ -379,7 +386,7 @@ const CheckPoints = (props: any) => { - {checkpointsConfigInfo.unaligned_checkpoints ? 'Enabled' : 'Disabled'} + {checkpointsConfigInfo.unaligned_checkpoints ? 'Enabled' : 'Disabled'} @@ -391,7 +398,7 @@ const CheckPoints = (props: any) => { {JsonParseObject(checkpointsConfigInfo.externalization).enabled && ( - { JsonParseObject(checkpointsConfigInfo.externalization).delete_on_cancellation ? 'Enabled' : 'Disabled'} + {JsonParseObject(checkpointsConfigInfo.externalization).delete_on_cancellation ? 'Enabled' : 'Disabled'} )} @@ -403,6 +410,7 @@ const CheckPoints = (props: any) => { + } ) } @@ -454,7 +462,11 @@ const CheckPoints = (props: any) => { columns={columns} 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} rowKey="id" pagination={{ @@ -468,11 +480,12 @@ const CheckPoints = (props: any) => { } return (<> + {(job?.jobHistory?.checkpoints || job?.jobHistory?.checkpointsConfig) &&   Overview  } key="overview"> - { !JSON.stringify(job?.jobHistory?.checkpoints).includes("errors") ? + {!JSON.stringify(job?.jobHistory?.checkpoints).includes("errors") ? getOverview(JsonParseObject(job?.jobHistory?.checkpoints)) : } @@ -482,24 +495,23 @@ const CheckPoints = (props: any) => {   Summary  } key="summary"> - { !JSON.stringify(job?.jobHistory?.checkpoints).includes("errors") ? + {!JSON.stringify(job?.jobHistory?.checkpoints).includes("errors") ? getSummary(JsonParseObject(job?.jobHistory?.checkpoints)) : }   Configuration  } key="configuration"> - { !JSON.stringify(job?.jobHistory?.checkpointsConfig).includes("errors") ? + {!JSON.stringify(job?.jobHistory?.checkpointsConfig).includes("errors") ? getConfiguration(JsonParseObject(job?.jobHistory?.checkpointsConfig)) : }   SavePoint  } key="savepoint"> - {getSavePoint()} - - + {getSavePoint()} + + } ) }; - export default CheckPoints; diff --git a/dlink-web/src/pages/DevOps/JobInfo/Config/index.tsx b/dlink-web/src/pages/DevOps/JobInfo/Config/index.tsx index 381ee32313..7c0a1eda6b 100644 --- a/dlink-web/src/pages/DevOps/JobInfo/Config/index.tsx +++ b/dlink-web/src/pages/DevOps/JobInfo/Config/index.tsx @@ -26,78 +26,81 @@ const {Text, Link} = Typography; const Config = (props: any) => { const {job} = props; - return (<> - <> - - {job?.history?.type ? ( - - {job?.history?.type} - - ) : undefined} - - - {job?.cluster?.alias ? {job?.cluster?.alias} : '-'} - - - {job?.clusterConfiguration?.alias ? {job?.clusterConfiguration?.alias} : '-'} - - - {job?.history?.session ? {job?.history?.session} : '禁用'} - - {job?.history?.config.useSqlFragment ? '启用' : '禁用'} - {job?.history?.config.useStatementSet ? '启用' : '禁用'} - {job?.history?.config.isJarTask ? 'Jar' : 'FlinkSQL'} - {job?.history?.config.useBatchModel ? '启用' : '禁用'} - {job?.history?.config.checkpoint} - - {job?.history?.config.savePointStrategy == 'NONE' ? '禁用' : - job?.history?.config.savePointStrategy == 'LATEST' ? '最近一次' : - job?.history?.config.savePointStrategy == 'EARLIEST' ? '最早一次' : - job?.history?.config.savePointStrategy == 'CUSTOM' ? '指定一次' : '禁用'} - - {job?.history?.config.savePointPath} - {job?.jar ? <> - {job?.jar?.path} - {job?.jar?.mainClass} - {job?.jar?.paras} - : undefined} - - -

- <> - { ! JSON.stringify(job?.jobHistory?.config).includes("errors") && - - - - {job?.jobHistory?.config['execution-config']['execution-mode']} - - - - - {job?.jobHistory?.config['execution-config']['restart-strategy']} - - + { + job?.jobHistory?.config && <> + <> + + {job?.history?.type ? ( + + {job?.history?.type} + + ) : undefined} + + + {job?.cluster?.alias ? {job?.cluster?.alias} : '-'} + + + {job?.clusterConfiguration?.alias ? {job?.clusterConfiguration?.alias} : '-'} + + + {job?.history?.session ? {job?.history?.session} : '禁用'} + + {job?.history?.config.useSqlFragment ? '启用' : '禁用'} + {job?.history?.config.useStatementSet ? '启用' : '禁用'} + {job?.history?.config.isJarTask ? 'Jar' : 'FlinkSQL'} + {job?.history?.config.useBatchModel ? '启用' : '禁用'} + {job?.history?.config.checkpoint} + + {job?.history?.config.savePointStrategy == 'NONE' ? '禁用' : + job?.history?.config.savePointStrategy == 'LATEST' ? '最近一次' : + job?.history?.config.savePointStrategy == 'EARLIEST' ? '最早一次' : + job?.history?.config.savePointStrategy == 'CUSTOM' ? '指定一次' : '禁用'} + + {job?.history?.config.savePointPath} + {job?.jar ? <> + {job?.jar?.path} + {job?.jar?.mainClass} + {job?.jar?.paras} + : undefined} + + +

+ <> + {!JSON.stringify(job?.jobHistory?.config).includes("errors") && + + + + {job?.jobHistory?.config['execution-config']['execution-mode']} + + + + + {job?.jobHistory?.config['execution-config']['restart-strategy']} + + - - - {job?.jobHistory?.config['execution-config']['job-parallelism']} - - + + + {job?.jobHistory?.config['execution-config']['job-parallelism']} + + - - - {job?.jobHistory?.config['execution-config']['object-reuse-mode'].toString()} - - + + + {job?.jobHistory?.config['execution-config']['object-reuse-mode'].toString()} + + - - {JSON.stringify(job?.jobHistory?.config['execution-config']['user-config'])} - - - } - + + {JSON.stringify(job?.jobHistory?.config['execution-config']['user-config'])} + +
+ } + + + } ) }; diff --git a/dlink-web/src/pages/DevOps/JobInfo/DataMap/index.tsx b/dlink-web/src/pages/DevOps/JobInfo/DataMap/index.tsx index 092930bcf2..6361a4112d 100644 --- a/dlink-web/src/pages/DevOps/JobInfo/DataMap/index.tsx +++ b/dlink-web/src/pages/DevOps/JobInfo/DataMap/index.tsx @@ -33,7 +33,7 @@ const DataMap = (props: any) => { setData(undefined); const res = getLineage(job.instance?.id); res.then((result)=>{ - result.datas.tables.forEach(table => { + result.datas?.tables.forEach(table => { table.isExpand = true; table.isFold = false; }); diff --git a/dlink-web/src/pages/DevOps/JobInfo/Exception/index.tsx b/dlink-web/src/pages/DevOps/JobInfo/Exception/index.tsx index 83f8049556..9d0d894fc4 100644 --- a/dlink-web/src/pages/DevOps/JobInfo/Exception/index.tsx +++ b/dlink-web/src/pages/DevOps/JobInfo/Exception/index.tsx @@ -28,16 +28,17 @@ const Exception = (props: any) => { const {job} = props; return (<> - + Root Exception} key="RootException"> Exception History} key="ExceptionHistory"> - + } ) };