Unverified Commit 383babb2 authored by Pandas886's avatar Pandas886 Committed by GitHub

[Improvement] Optimize paimon to store monitoring data, causing threads not to be released (#3547)

parent 295eb6cd
......@@ -25,11 +25,20 @@ import org.dinky.data.vo.MetricsVO;
import org.dinky.utils.PaimonUtil;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicLong;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import cn.hutool.core.text.StrFormatter;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
/**
......@@ -39,38 +48,48 @@ import lombok.extern.slf4j.Slf4j;
@Slf4j
public class MetricsContextHolder {
@Getter
protected static final MetricsContextHolder instance = new MetricsContextHolder();
public static MetricsContextHolder getInstances() {
return instance;
}
private final List<MetricsVO> metricsVOS = new CopyOnWriteArrayList<>();
private final AtomicLong lastDumpTime = new AtomicLong(System.currentTimeMillis());
/**
* Temporary cache monitoring information, mainly to prevent excessive buffering of write IO,
* when metricsVOS data reaches 1000 or the time exceeds 5 seconds
*/
private final List<MetricsVO> metricsVOS = Collections.synchronizedList(new ArrayList<>());
// Create a ThreadFactory with custom naming
ThreadFactory namedThreadFactory =
new ThreadFactoryBuilder().setNameFormat("metrics-send-thread-%d").build();
private final Long lastDumpTime = System.currentTimeMillis();
// Create a custom ThreadPoolExecutor
ExecutorService pool = new ThreadPoolExecutor(
5, // Core pool size
10, // Maximum pool size, allows the pool to expand as needed
60L, // Keep alive time for idle threads
TimeUnit.SECONDS, // Unit of keep alive time
new LinkedBlockingQueue<Runnable>(10), // Use a larger queue to hold excess tasks
namedThreadFactory);
public void sendAsync(String key, MetricsVO o) {
CompletableFuture.runAsync(() -> {
Thread.currentThread().setContextClassLoader(MetricsContextHolder.class.getClassLoader());
metricsVOS.add(o);
long duration = System.currentTimeMillis() - lastDumpTime;
synchronized (metricsVOS) {
if (metricsVOS.size() > 1000 || duration > 1000 * 5) {
PaimonUtil.write(PaimonTableConstant.DINKY_METRICS, metricsVOS, MetricsVO.class);
metricsVOS.clear();
}
}
String topic = StrFormatter.format("{}/{}", SseTopic.METRICS.getValue(), key);
SseSessionContextHolder.sendTopic(topic, o);
})
.whenComplete((v, t) -> {
if (t != null) {
log.error("send metrics async error", t);
}
});
Object content = o.getContent();
if (content == null
|| (content instanceof ConcurrentHashMap && ((ConcurrentHashMap<?, ?>) content).isEmpty())) {
return; // Return early to avoid unnecessary operations
}
pool.execute(() -> {
metricsVOS.add(o);
long current = System.currentTimeMillis();
long duration = current - lastDumpTime.get();
// Temporary cache monitoring information, mainly to prevent excessive buffering of write IO,
// when metricsVOS data reaches 1000 or the time exceeds 15 seconds
if (metricsVOS.size() >= 1000 || duration >= 15000) {
List<MetricsVO> snapshot;
synchronized (this) { // Enter synchronized block only when necessary
snapshot = new ArrayList<>(metricsVOS);
metricsVOS.clear();
lastDumpTime.set(current);
}
PaimonUtil.write(PaimonTableConstant.DINKY_METRICS, snapshot, MetricsVO.class);
}
String topic = StrFormatter.format("{}/{}", SseTopic.METRICS.getValue(), key);
SseSessionContextHolder.sendTopic(topic, o); // Ensure only successfully added metrics are sent
});
}
}
......@@ -73,7 +73,7 @@ public class JobMetricsHandler {
metricsVO.setHeartTime(LocalDateTime.now());
metricsVO.setModel(jobId);
metricsVO.setDate(TimeUtil.nowStr("yyyy-MM-dd"));
MetricsContextHolder.getInstances().sendAsync(metricsVO.getModel(), metricsVO);
MetricsContextHolder.getInstance().sendAsync(metricsVO.getModel(), metricsVO);
} catch (Exception e) {
log.error("Get and save Flink metrics error", e);
}
......
......@@ -49,7 +49,7 @@ public class SystemMetricsHandler {
metrics.setHeartTime(now);
metrics.setModel(MetricsType.LOCAL.getType());
metrics.setDate(now.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
MetricsContextHolder.getInstances().sendAsync(metrics.getModel(), metrics);
MetricsContextHolder.getInstance().sendAsync(metrics.getModel(), metrics);
log.debug("Collecting jvm information ends.");
}
......
......@@ -7,7 +7,7 @@ This project uses [Ant Design Pro](https://pro.ant.design) for initialization. H
## Environment preparation
| Environment | Version | Remarks |
|-------------|---------|---------|
| ----------- | ------- | ------- |
| node | 18+ | |
| npm | 10+ | |
......
......@@ -4,10 +4,10 @@
## 环境准备
| 环境 | 版本 | 备注 |
|------|-----|----|
| node | 18+ | |
| npm | 10+ | |
| 环境 | 版本 | 备注 |
| ---- | ---- | ---- |
| node | 18+ | |
| npm | 10+ | |
> 自行配置相关环境变量
......
......@@ -43,10 +43,10 @@ const DagDataNode = (props: any) => {
ratio > 0.75
? '#cf1322'
: ratio > 0.5
? '#d46b08'
: ratio > 0.25
? '#d4b106'
: '#3f8600',
? '#d46b08'
: ratio > 0.25
? '#d4b106'
: '#3f8600',
fontSize: 10
}}
/>
......@@ -65,10 +65,10 @@ const DagDataNode = (props: any) => {
ratio > 0.75
? '#3f8600'
: ratio > 0.5
? '#d4b106'
: ratio > 0.25
? '#d46b08'
: '#cf1322',
? '#d4b106'
: ratio > 0.25
? '#d46b08'
: '#cf1322',
fontSize: 10
}}
/>
......
......@@ -21,7 +21,7 @@ import { l } from '@/utils/intl';
import { ProFormSelect } from '@ant-design/pro-components';
import { ProFormSelectProps } from '@ant-design/pro-form/es/components/Select';
import { Divider, Typography } from 'antd';
import React from "react";
import React from 'react';
const { Link } = Typography;
......
......@@ -17,29 +17,28 @@
*
*/
import {ProFormSelect} from '@ant-design/pro-components';
import {ProFormSelectProps} from '@ant-design/pro-form/es/components/Select';
import {Divider} from 'antd';
import React from "react";
import { ProFormSelect } from '@ant-design/pro-components';
import { ProFormSelectProps } from '@ant-design/pro-form/es/components/Select';
import { Divider } from 'antd';
import React from 'react';
export type FlinkUdfOptionsProps = ProFormSelectProps & {};
const FlinkUdfOptionsSelect = (props: FlinkUdfOptionsProps) => {
const renderTemplateDropDown = (item: any) => {
return (
<>
<Divider style={{ margin: '8px 0' }} />
{item}
</>
<>
<Divider style={{ margin: '8px 0' }} />
{item}
</>
);
};
return (
<ProFormSelect
{...props}
fieldProps={{ dropdownRender: (item) => renderTemplateDropDown(item), ...props.fieldProps}}
/>
<ProFormSelect
{...props}
fieldProps={{ dropdownRender: (item) => renderTemplateDropDown(item), ...props.fieldProps }}
/>
);
};
......
......@@ -92,54 +92,57 @@ export default class LineageDagExt extends LineageDag {
edges: result.edges
};
setTimeout(() => {
let tmpEdges = result.edges;
result.edges = [];
// this.canvas.wrapper.style.visibility = 'hidden';
this.canvas.draw(result, () => {
this.canvas.relayout(
{
edges: tmpEdges.map((item) => {
return {
source: item.sourceNode,
target: item.targetNode
};
})
},
true
);
// this.canvas.wrapper.style.visibility = 'visible';
this.canvas.addEdges(tmpEdges, true);
let minimap = _.get(this, 'props.config.minimap', {});
const minimapCfg = _.assign({}, minimap.config, {
events: ['system.node.click', 'system.canvas.click']
});
if (minimap && minimap.enable) {
this.canvas.setMinimap(true, minimapCfg);
}
setTimeout(
() => {
let tmpEdges = result.edges;
result.edges = [];
// this.canvas.wrapper.style.visibility = 'hidden';
this.canvas.draw(result, () => {
this.canvas.relayout(
{
edges: tmpEdges.map((item) => {
return {
source: item.sourceNode,
target: item.targetNode
};
})
},
true
);
// this.canvas.wrapper.style.visibility = 'visible';
this.canvas.addEdges(tmpEdges, true);
let minimap = _.get(this, 'props.config.minimap', {});
const minimapCfg = _.assign({}, minimap.config, {
events: ['system.node.click', 'system.canvas.click']
});
if (minimap && minimap.enable) {
this.canvas.setMinimap(true, minimapCfg);
}
if (_.get(this, 'props.config.gridMode')) {
this.canvas.setGridMode(true, _.assign({}, _.get(this, 'props.config.gridMode', {})));
}
if (_.get(this, 'props.config.gridMode')) {
this.canvas.setGridMode(true, _.assign({}, _.get(this, 'props.config.gridMode', {})));
}
if (result.nodes.length !== 0) {
this.canvas.focusCenterWithAnimate();
this._isFirstFocus = true;
}
if (result.nodes.length !== 0) {
this.canvas.focusCenterWithAnimate();
this._isFirstFocus = true;
}
this.forceUpdate();
this.props.onLoaded && this.props.onLoaded(this.canvas);
});
this.canvas.on('system.node.click', (data) => {
let node = data.node;
this.canvas.focus(node.id);
});
this.canvas.on('system.canvas.click', () => {
this.canvas.unfocus();
});
}, _.get(this.props, 'config.delayDraw', 0));
this.forceUpdate();
this.props.onLoaded && this.props.onLoaded(this.canvas);
});
this.canvas.on('system.node.click', (data) => {
let node = data.node;
this.canvas.focus(node.id);
});
this.canvas.on('system.canvas.click', () => {
this.canvas.unfocus();
});
},
_.get(this.props, 'config.delayDraw', 0)
);
}
}
......@@ -450,8 +450,10 @@ export default {
'pages.datastudio.label.jobConfig.addConfig.params': 'parameters',
'pages.datastudio.label.jobConfig.addConfig.value': 'value',
'pages.datastudio.label.udf': 'Udf Item',
'pages.datastudio.label.udf.tip': 'Inject UDF item, Automatically add statement `create temporary function [functionName] as [className]` at the beginning of the SQL statement',
'pages.datastudio.label.udf.duplicate.tip': 'The class [className] selected this time already exists and duplicate injection is not allowed. Please reselect or cancel injection (delete and change line).',
'pages.datastudio.label.udf.tip':
'Inject UDF item, Automatically add statement `create temporary function [functionName] as [className]` at the beginning of the SQL statement',
'pages.datastudio.label.udf.duplicate.tip':
'The class [className] selected this time already exists and duplicate injection is not allowed. Please reselect or cancel injection (delete and change line).',
'pages.datastudio.label.udf.injectUdf': 'Inject UDF item',
'pages.datastudio.label.udf.name': 'function name',
'pages.datastudio.label.udf.className': 'class name',
......@@ -1006,7 +1008,8 @@ export default {
'Support for a single or bulk upload. Strictly prohibited from uploading company data or\n other banned files.',
'rc.resource.filelist': 'File list',
'rc.resource.sync': 'Sync remote files',
'rc.resource.sync.confirm': 'Please note that this operation will delete all records in the database and will affect running jobs as well as corresponding resource files referenced in UDF management, resulting in job failure. And UDF cannot be used in UDF management Please operate with caution!! Please confirm if you want to continue?',
'rc.resource.sync.confirm':
'Please note that this operation will delete all records in the database and will affect running jobs as well as corresponding resource files referenced in UDF management, resulting in job failure. And UDF cannot be used in UDF management Please operate with caution!! Please confirm if you want to continue?',
'rc.resource.copy_to_add_custom_jar': 'Copy as ADD CUSTOMJAR syntax',
'rc.resource.copy_to_add_jar': 'Copy as ADD JAR syntax',
'rc.resource.copy_to_add_file': 'Copy as ADD FILE syntax',
......
......@@ -429,8 +429,10 @@ export default {
'pages.datastudio.label.jobConfig.addConfig.params': '参数',
'pages.datastudio.label.jobConfig.addConfig.value': '值',
'pages.datastudio.label.udf': '注入UDF算子',
'pages.datastudio.label.udf.tip': '注入UDF算子, 自动在所有语句前注入`create temporary function [functionName] as [className]` 语句',
'pages.datastudio.label.udf.duplicate.tip': '此次选择的类[className]已经存在,不允许重复注入,请重新选择,或者取消注入(删除改行即可)。',
'pages.datastudio.label.udf.tip':
'注入UDF算子, 自动在所有语句前注入`create temporary function [functionName] as [className]` 语句',
'pages.datastudio.label.udf.duplicate.tip':
'此次选择的类[className]已经存在,不允许重复注入,请重新选择,或者取消注入(删除改行即可)。',
'pages.datastudio.label.udf.injectUdf': '注入UDF',
'pages.datastudio.label.udf.name': '函数名称',
'pages.datastudio.label.udf.className': '类名',
......@@ -962,7 +964,8 @@ export default {
'rc.resource.upload.tip2': '支持单个或批量上传。严禁上传公司数据或其他禁止上传的文件。',
'rc.resource.filelist': '文件列表',
'rc.resource.sync': '同步目录结构',
'rc.resource.sync.confirm': '请注意: 该操作会删除数据库内的所有记录,且会关系到运行中的作业,以及UDF管理中引用的对应资源文件.从而导致作业运行失败。以及在 UDF管理中的 UDF 无法被使用. 请谨慎操作!! 请确认是否继续? ',
'rc.resource.sync.confirm':
'请注意: 该操作会删除数据库内的所有记录,且会关系到运行中的作业,以及UDF管理中引用的对应资源文件.从而导致作业运行失败。以及在 UDF管理中的 UDF 无法被使用. 请谨慎操作!! 请确认是否继续? ',
'rc.resource.copy_to_add_custom_jar': '复制为 ADD CUSTOMJAR 语法',
'rc.resource.copy_to_add_jar': '复制为 ADD JAR 语法',
'rc.resource.copy_to_add_file': '复制为 ADD FILE 语法',
......
......@@ -325,10 +325,10 @@ const MenuList: React.FC = () => {
{sysMenuValue?.id && editOpen
? l('menu.edit')
: !sysMenuValue?.id && addedOpen && !isRootMenu
? l('right.menu.addSub')
: !sysMenuValue?.id && addedOpen && isRootMenu
? l('right.menu.createRoot')
: ''}
? l('right.menu.addSub')
: !sysMenuValue?.id && addedOpen && isRootMenu
? l('right.menu.createRoot')
: ''}
</>
);
};
......
......@@ -87,11 +87,11 @@ const TokenModalForm: React.FC<TokenModalFormProps & connect> = (props) => {
value.expireType === 2
? parseDateStringToDate(value.expireEndTime)
: value.expireType === 3
? [
parseDateStringToDate(value.expireStartTime),
parseDateStringToDate(value.expireEndTime)
]
: undefined
? [
parseDateStringToDate(value.expireStartTime),
parseDateStringToDate(value.expireEndTime)
]
: undefined
});
}, [visible, value, form, selectUserId]);
......
......@@ -61,8 +61,8 @@ export const JobConfigInfo: React.FC<JobDetailInfoModelProps> = (props) => {
{row?.clusterId
? l('pages.datastudio.label.history.clusterInstance')
: row?.clusterConfigurationId
? l('pages.datastudio.label.history.clusterConfig')
: l('pages.datastudio.label.history.local')}
? l('pages.datastudio.label.history.clusterConfig')
: l('pages.datastudio.label.history.local')}
</ProDescriptions.Item>
<ProDescriptions.Item
......
......@@ -52,8 +52,8 @@ const JobRunningModal: React.FC<JobRunningModalProps> = (props) => {
? value?.jobState === 'RUNNING'
? 50
: value?.jobState === 'FINISHED'
? 100
: 0
? 100
: 0
: 0
}
status='active'
......
......@@ -338,8 +338,8 @@ export function getRightSelectKeyFromNodeClickJobType(jobType: string): string {
return isFlinkJob(jobType)
? RightMenuKey.JOB_CONFIG_KEY
: isSql(jobType)
? RightMenuKey.PREVIEW_CONFIG_KEY
: RightMenuKey.JOB_INFO_KEY;
? RightMenuKey.PREVIEW_CONFIG_KEY
: RightMenuKey.JOB_INFO_KEY;
}
export function getBottomSelectKeyFromNodeClickJobType(jobType: string): string {
......
......@@ -197,8 +197,8 @@ const Project: React.FC = (props: connect) => {
options.parentId = projectState.isCreateTask
? projectState.value.id
: projectState.isEdit
? projectState.value.parentId
: options.parentId;
? projectState.value.parentId
: options.parentId;
} else {
options.url = API_CONSTANTS.SAVE_OR_UPDATE_CATALOGUE_URL;
}
......
......@@ -18,7 +18,7 @@
*/
import FlinkOptionsSelect from '@/components/Flink/OptionsSelect';
import {SAVE_POINT_TYPE} from '@/pages/DataStudio/constants';
import { SAVE_POINT_TYPE } from '@/pages/DataStudio/constants';
import {
getCurrentData,
getCurrentTab,
......@@ -52,21 +52,21 @@ import {
ProFormText
} from '@ant-design/pro-components';
import { useModel } from '@umijs/max';
import {Alert, Input, Space} from 'antd';
import { Alert, Input, Space } from 'antd';
import { useForm } from 'antd/es/form/Form';
import { debounce } from 'lodash';
import React, {useEffect, useState} from 'react';
import React, { useEffect, useState } from 'react';
import { connect } from 'umi';
import FlinkUdfOptionsSelect from "@/components/Flink/UdfSelect";
import {TaskUdfRefer} from "@/types/Studio/data";
import {ErrorMessageAsync} from "@/utils/messages";
import FlinkUdfOptionsSelect from '@/components/Flink/UdfSelect';
import { TaskUdfRefer } from '@/types/Studio/data';
import { ErrorMessageAsync } from '@/utils/messages';
const JobConfig = (props: any) => {
const {
sessionCluster,
clusterConfiguration,
dispatch,
tabs: {panes, activeKey},
tabs: { panes, activeKey },
env,
group,
rightContainer,
......@@ -81,8 +81,12 @@ const JobConfig = (props: any) => {
const [selectRunMode, setSelectRunMode] = useState<string>(current?.type ?? RUN_MODE.LOCAL);
const [currentSelectUdfIndexMap, setCurrentSelectUdfIndexMap] = useState<Map<number, TaskUdfRefer>>(
new Map(current?.configJson?.udfRefer?.map((item: TaskUdfRefer, index: number) => [index, item]) ?? [])
const [currentSelectUdfIndexMap, setCurrentSelectUdfIndexMap] = useState<
Map<number, TaskUdfRefer>
>(
new Map(
current?.configJson?.udfRefer?.map((item: TaskUdfRefer, index: number) => [index, item]) ?? []
)
);
const { initialState, setInitialState } = useModel('@@initialState');
......@@ -105,7 +109,7 @@ const JobConfig = (props: any) => {
type: STUDIO_MODEL_ASYNC.queryFlinkUdfOptions
});
setSelectRunMode(current?.type ?? RUN_MODE.LOCAL);
form.setFieldsValue({...current, type: current?.type});
form.setFieldsValue({ ...current, type: current?.type });
}, [current]);
const onValuesChange = (change: { [key in string]: any }, all: any) => {
......@@ -130,11 +134,10 @@ const JobConfig = (props: any) => {
pane.isModified = true;
dispatch({
type: STUDIO_MODEL.saveTabs,
payload: {...props.tabs}
payload: { ...props.tabs }
});
};
/**
* 处理 selectUdfIndexMap 的状态 | process the state of selectUdfIndexMap
* @param index
......@@ -142,7 +145,7 @@ const JobConfig = (props: any) => {
* @param name
*/
function processSelectUdfMapState(index: number, className: string = '', name: string = '') {
setCurrentSelectUdfIndexMap(prevState => {
setCurrentSelectUdfIndexMap((prevState) => {
const newState = new Map(prevState);
newState.set(index, {
className: className,
......@@ -152,17 +155,19 @@ const JobConfig = (props: any) => {
});
}
const handleClassChange = async (value: string, index: number) => {
// 检测 这个值是否已经存在 currentSelectUdfIndexMap 的 map 中 || check if the value already exists in the map of currentSelectUdfIndexMap
const values = currentSelectUdfIndexMap.values();
for (const taskUdfRefer of values) {
if (taskUdfRefer?.className === value) {
await ErrorMessageAsync(l('pages.datastudio.label.udf.duplicate.tip', '', {className: value}), 3);
await ErrorMessageAsync(
l('pages.datastudio.label.udf.duplicate.tip', '', { className: value }),
3
);
// clear the value of the form
form.setFieldsValue({
'configJson': {
'udfRefer': {
configJson: {
udfRefer: {
[index]: {
className: '',
name: ''
......@@ -177,8 +182,8 @@ const JobConfig = (props: any) => {
const lowerName = simpleClassName.charAt(0).toLowerCase() + simpleClassName.slice(1);
processSelectUdfMapState(index, value, lowerName);
form.setFieldsValue({
'configJson': {
'udfRefer': {
configJson: {
udfRefer: {
[index]: {
className: value,
name: lowerName
......@@ -188,20 +193,18 @@ const JobConfig = (props: any) => {
});
};
function handleNameChange(name: string, index: number) {
// 拿到 currentSelectUdfIndexMap[index].get(index) 的值 || get the value of currentSelectUdfIndexMap[index].get(index)
const currentSelectUdfIndexMapValue = currentSelectUdfIndexMap.get(index);
// 如果 name 和 currentSelectUdfIndexMapValue?.name 相等 则不做任何操作 || if name and currentSelectUdfIndexMapValue?.name are equal, do nothing
// 如果 name 和 currentSelectUdfIndexMapValue?.name 相等 则不做任何操作 || if name and currentSelectUdfIndexMapValue?.name are equal, do nothing
if (currentSelectUdfIndexMapValue?.name && name !== currentSelectUdfIndexMapValue?.name) {
// 更新 currentSelectUdfIndexMap 的值
processSelectUdfMapState(index, currentSelectUdfIndexMapValue?.className, name);
}
form.setFieldsValue({
'configJson': {
'udfRefer': {
configJson: {
udfRefer: {
[index]: {
className: currentSelectUdfIndexMapValue?.className ?? '',
name: name
......@@ -236,7 +239,7 @@ const JobConfig = (props: any) => {
alertGroupId: -1
}}
className={'data-studio-form'}
style={{paddingInline: '15px', overflow: 'scroll', marginTop: 5}}
style={{ paddingInline: '15px', overflow: 'scroll', marginTop: 5 }}
form={form}
submitter={false}
layout='vertical'
......@@ -248,7 +251,7 @@ const JobConfig = (props: any) => {
name='type'
label={l('global.table.execmode')}
tooltip={l('pages.datastudio.label.jobConfig.execmode.tip')}
rules={[{required: true, message: l('pages.datastudio.label.jobConfig.execmode.tip')}]}
rules={[{ required: true, message: l('pages.datastudio.label.jobConfig.execmode.tip') }]}
options={buildRunModelOptions()}
fieldProps={{
onChange: (value: string) => {
......@@ -264,7 +267,7 @@ const JobConfig = (props: any) => {
{isCanRenderClusterInstance(selectRunMode) && (
<>
<ProFormSelect
style={{width: '100%'}}
style={{ width: '100%' }}
placeholder={l('pages.datastudio.label.jobConfig.clusterConfig.tip1', '', {
type: current?.type
})}
......@@ -319,7 +322,7 @@ const JobConfig = (props: any) => {
tooltip={l('pages.datastudio.label.jobConfig.flinksql.env.tip1')}
options={buildEnvOptions(env)}
rules={[
{required: true, message: l('pages.datastudio.label.jobConfig.flinksql.env.tip1')}
{ required: true, message: l('pages.datastudio.label.jobConfig.flinksql.env.tip1') }
]}
showSearch
allowClear={false}
......@@ -341,7 +344,7 @@ const JobConfig = (props: any) => {
valuePropName='checked'
tooltip={{
title: l('pages.datastudio.label.jobConfig.fragment.tip'),
icon: <InfoCircleOutlined/>
icon: <InfoCircleOutlined />
}}
{...SWITCH_OPTIONS()}
/>
......@@ -351,7 +354,7 @@ const JobConfig = (props: any) => {
valuePropName='checked'
tooltip={{
title: l('pages.datastudio.label.jobConfig.batchmode.tip'),
icon: <InfoCircleOutlined/>
icon: <InfoCircleOutlined />
}}
{...SWITCH_OPTIONS()}
/>
......@@ -388,7 +391,7 @@ const JobConfig = (props: any) => {
name={['configJson', 'customConfig']}
copyIconProps={false}
creatorButtonProps={{
style: {width: '100%'},
style: { width: '100%' },
creatorButtonText: l('pages.datastudio.label.jobConfig.addConfig')
}}
>
......@@ -418,20 +421,18 @@ const JobConfig = (props: any) => {
copyIconProps={false}
onAfterRemove={(_, index) => {
// 删除一项之后拿到 index 从 currentSelectUdfIndexMap 中删除对应的值 || get the value from currentSelectUdfIndexMap and delete it
setCurrentSelectUdfIndexMap(prevState => {
setCurrentSelectUdfIndexMap((prevState) => {
const newState = new Map(prevState);
newState.delete(index);
return newState;
});
}}
creatorButtonProps={{
style: {width: '100%'},
style: { width: '100%' },
creatorButtonText: l('pages.datastudio.label.udf.injectUdf')
}}
>
{(
_, index
) => {
{(_, index) => {
return (
<ProFormGroup>
<Space key={'udf' + index} align='baseline'>
......@@ -446,20 +447,17 @@ const JobConfig = (props: any) => {
options={flinkUdfOptions}
onChange={(value: string) => handleClassChange(value, index)}
/>
<ProForm.Item
name={'name'}
>
<ProForm.Item name={'name'}>
<Input
onChange={(e) => handleNameChange(e.target.value, index)}
placeholder={l('pages.datastudio.label.udf.name')}
style={{width: calculatorWidth(rightContainer.width) - 80}}
style={{ width: calculatorWidth(rightContainer.width) - 80 }}
/>
</ProForm.Item>
</Space>
</ProFormGroup>
);
}
}
}}
</ProFormList>
</ProForm>
</div>
......@@ -483,7 +481,7 @@ export default connect(
env: Studio.env,
group: Alert.group,
flinkConfigOptions: Studio.flinkConfigOptions,
flinkUdfOptions: Studio.flinkUdfOptions,
flinkUdfOptions: Studio.flinkUdfOptions,
taskOwnerLockingStrategy: SysConfig.taskOwnerLockingStrategy
})
)(JobConfig);
......@@ -36,7 +36,6 @@ export function getFlinkConfigs() {
export function getFlinkUdfOptions() {
return queryDataByParams(API_CONSTANTS.ALL_UDF_LIST);
}
export function querySuggestionData(params: any) {
......
......@@ -99,8 +99,8 @@ const DataStudio: React.FC<connect> = (props: any) => {
const newBottomHeight = !isProject
? 0
: bottomContainer.selectKey === ''
? 0
: bottomContainer.height;
? 0
: bottomContainer.height;
const centerContentHeight = getClientSize().contentHeight - newBottomHeight;
updateCenterContentHeight(centerContentHeight);
updateToolContentHeight(centerContentHeight - VIEW.leftMargin);
......@@ -127,8 +127,8 @@ const DataStudio: React.FC<connect> = (props: any) => {
const newBottomHeight = !isProject
? 0
: bottomContainer.selectKey === ''
? 0
: bottomContainer.height;
? 0
: bottomContainer.height;
const centerContentHeight = size.contentHeight - newBottomHeight;
updateCenterContentHeight(centerContentHeight);
updateToolContentHeight(centerContentHeight - VIEW.leftMargin);
......
......@@ -28,7 +28,8 @@ import {
import {
getClusterConfigurationData,
getEnvData,
getFlinkConfigs, getFlinkUdfOptions,
getFlinkConfigs,
getFlinkUdfOptions,
getSessionData,
querySuggestionData
} from '@/pages/DataStudio/RightContainer/JobConfig/service';
......
......@@ -60,7 +60,7 @@ const ConfigurationModal: React.FC<ConfigurationModalProps & connect> = (props)
useEffect(() => {
if (visible) {
dispatch({
type:STUDIO_MODEL_ASYNC.queryFlinkConfigOptions
type: STUDIO_MODEL_ASYNC.queryFlinkConfigOptions
});
}
form.setFieldsValue(value);
......
......@@ -134,14 +134,14 @@ export const renderBranchesTagColor = (item: string) => {
return item.includes('dev')
? 'processing'
: item.includes('test')
? 'warning'
: item.includes('release')
? 'success'
: item.includes('master')
? 'success'
: item.includes('main')
? 'success'
: 'default';
? 'warning'
: item.includes('release')
? 'success'
: item.includes('master')
? 'success'
: item.includes('main')
? 'success'
: 'default';
};
/**
......
......@@ -48,7 +48,7 @@ import { WarningOutlined } from '@ant-design/icons';
import { ProCard } from '@ant-design/pro-components';
import { history } from '@umijs/max';
import { useAsyncEffect } from 'ahooks';
import {Button, Modal, Result} from 'antd';
import { Button, Modal, Result } from 'antd';
import { MenuInfo } from 'rc-menu/es/interface';
import React, { useCallback, useEffect, useRef, useState } from 'react';
import { connect } from 'umi';
......@@ -246,7 +246,6 @@ const ResourceOverView: React.FC<connect> = (props) => {
await refreshTree();
}
});
};
/**
......@@ -398,8 +397,8 @@ const ResourceOverView: React.FC<connect> = (props) => {
editModal === 'createFolder'
? l('right.menu.createFolder')
: editModal === 'rename'
? l('right.menu.rename')
: ''
? l('right.menu.rename')
: ''
}
formValues={resourceState.value}
onOk={handleModalSubmit}
......
......@@ -47,7 +47,7 @@ export type TaskUdfConfig = {
export type TaskUdfRefer = {
name: string;
className: string;
}
};
export type ConfigItem = {
key: string;
......
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