Unverified Commit 40a9edcc authored by Licho's avatar Licho Committed by GitHub

fix: savepoint problem, redundant configure, custom configure (#2301)

* fix: customConfig null * feat: custom options and fix savepoint problem * fix: redundant configure items. * Spotless Apply * trigger * trigger * fix Signed-off-by: 's avatarLicho <lecho.sun@gmail.com> --------- Signed-off-by: 's avatarLicho <lecho.sun@gmail.com> Co-authored-by: 's avatarleechor <leechor@users.noreply.github.com>
parent 055bd177
...@@ -68,7 +68,8 @@ public class FlinkConfController { ...@@ -68,7 +68,8 @@ public class FlinkConfController {
"org.apache.flink.configuration.HistoryServerOptions", "org.apache.flink.configuration.HistoryServerOptions",
"org.apache.flink.configuration.MetricOptions", "org.apache.flink.configuration.MetricOptions",
"org.apache.flink.configuration.NettyShuffleEnvironmentOptions", "org.apache.flink.configuration.NettyShuffleEnvironmentOptions",
"org.apache.flink.configuration.RestartStrategyOptions" "org.apache.flink.configuration.RestartStrategyOptions",
"org.dinky.constant.CustomerConfigureOptions"
}; };
List<CascaderVO> dataList = new ArrayList<>(); List<CascaderVO> dataList = new ArrayList<>();
Arrays.stream(nameList).map(CascaderOptionsUtils::buildCascadeOptions).forEach(dataList::addAll); Arrays.stream(nameList).map(CascaderOptionsUtils::buildCascadeOptions).forEach(dataList::addAll);
......
...@@ -28,6 +28,8 @@ import java.util.List; ...@@ -28,6 +28,8 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
...@@ -51,11 +53,13 @@ public class TaskExtConfig implements Serializable { ...@@ -51,11 +53,13 @@ public class TaskExtConfig implements Serializable {
} }
// 获取自定义配置的所有key // 获取自定义配置的所有key
@JsonIgnore
public List<String> getCustomConfigKeys() { public List<String> getCustomConfigKeys() {
return customConfig.stream().map(ConfigItem::getKey).collect(Collectors.toList()); return customConfig.stream().map(ConfigItem::getKey).collect(Collectors.toList());
} }
// 获取自定义配置的所有key-value // 获取自定义配置的所有key-value
@JsonIgnore
public Map<String, String> getCustomConfigMaps() { public Map<String, String> getCustomConfigMaps() {
return Asserts.isNotNullCollection(customConfig) return Asserts.isNotNullCollection(customConfig)
? customConfig.stream().collect(Collectors.toMap(ConfigItem::getKey, ConfigItem::getValue)) ? customConfig.stream().collect(Collectors.toMap(ConfigItem::getKey, ConfigItem::getValue))
......
...@@ -76,6 +76,7 @@ public class CascaderOptionsUtils { ...@@ -76,6 +76,7 @@ public class CascaderOptionsUtils {
cascaderVO.setLabel(parsedBinlogGroup); cascaderVO.setLabel(parsedBinlogGroup);
cascaderVO.setValue(parsedBinlogGroup); cascaderVO.setValue(parsedBinlogGroup);
dataList.add(cascaderVO); dataList.add(cascaderVO);
cache.put(name, dataList);
} catch (ClassNotFoundException ignored) { } catch (ClassNotFoundException ignored) {
logger.warning("get config option error, class not found: " + name); logger.warning("get config option error, class not found: " + name);
} }
......
/*
*
* 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.
*
*/
package org.dinky.constant;
import static org.apache.flink.configuration.ConfigOptions.key;
import org.apache.flink.configuration.ConfigOption;
public class CustomerConfigureOptions {
public static final ConfigOption<String> REST_TARGET_DIRECTORY = key("rest.target-directory")
.stringType()
.noDefaultValue()
.withDescription("for set savepoint target directory");
public static final ConfigOption<Boolean> REST_CANCEL_JOB = key("rest.cancel-job")
.booleanType()
.defaultValue(false)
.withDescription("for cancel job when trigger savepoint");
public static final ConfigOption<String> REST_TRIGGER_ID =
key("rest.triggerId").stringType().noDefaultValue().withDescription("for trigger savepoint");
public static final ConfigOption<String> REST_FORMAT_TYPE =
key("rest.formatType").stringType().defaultValue("DEFAULT").withDescription("for savepoint format type");
}
...@@ -53,7 +53,7 @@ import cn.hutool.http.Method; ...@@ -53,7 +53,7 @@ import cn.hutool.http.Method;
public class FlinkAPI { public class FlinkAPI {
private static final Logger logger = LoggerFactory.getLogger(FlinkAPI.class); private static final Logger logger = LoggerFactory.getLogger(FlinkAPI.class);
public static final String REST_TARGET_DIRECTORY = "state.savepoints.dir"; public static final String REST_TARGET_DIRECTORY = "rest.target-directory";
public static final String ERRORS = "errors"; public static final String ERRORS = "errors";
public static final String CANCEL_JOB = "cancel-job"; public static final String CANCEL_JOB = "cancel-job";
public static final String DRAIN = "drain"; public static final String DRAIN = "drain";
......
...@@ -67,7 +67,7 @@ const Explain: React.FC<ExplainProps> = (props: any) => { ...@@ -67,7 +67,7 @@ const Explain: React.FC<ExplainProps> = (props: any) => {
...current, ...current,
// useSession: useSession, // useSession: useSession,
// session: currentSession.session, // session: currentSession.session,
configJson: JSON.stringify(current.config), configJson: JSON.stringify(current?.config),
taskId: current?.id taskId: current?.id
}; };
setResult(<Text>{l('pages.datastudio.explain.validate')}</Text>); setResult(<Text>{l('pages.datastudio.explain.validate')}</Text>);
......
...@@ -125,16 +125,16 @@ export const buildEnvOptions = (env: any[]) => { ...@@ -125,16 +125,16 @@ export const buildEnvOptions = (env: any[]) => {
key: 0 key: 0
} }
]; ];
for (const item of env) { for (const item of env) {
const tag = ( const tag = (
<> <TagAlignLeft>
<TagAlignLeft> {item.enabled ? <Badge status='success' /> : <Badge status='error' />}
{item.enabled ? <Badge status='success' /> : <Badge status='error' />} {item.fragment ? <PaperClipOutlined /> : undefined}
{item.fragment ? <PaperClipOutlined /> : undefined} {item.name}
{item.name} </TagAlignLeft>
</TagAlignLeft>
</>
); );
envList.push({ envList.push({
label: tag, label: tag,
value: item.id, value: item.id,
......
...@@ -91,6 +91,10 @@ const JobConfig = (props: any) => { ...@@ -91,6 +91,10 @@ const JobConfig = (props: any) => {
Object.keys(change).forEach((key) => { Object.keys(change).forEach((key) => {
if (key === 'configJson') { if (key === 'configJson') {
if (!pane.params.taskData.configJson) {
pane.params.taskData.configJson = {};
}
Object.keys(change[key]).forEach((k) => { Object.keys(change[key]).forEach((k) => {
pane.params.taskData[key][k] = all[key][k]; pane.params.taskData[key][k] = all[key][k];
}); });
......
...@@ -170,6 +170,7 @@ const DataStudio = (props: any) => { ...@@ -170,6 +170,7 @@ const DataStudio = (props: any) => {
} }
if (JSON.stringify(info[key]) !== JSON.stringify(params.taskData[key])) { if (JSON.stringify(info[key]) !== JSON.stringify(params.taskData[key])) {
console.log('changed', key, info[key], params.taskData[key]);
return true; return true;
} }
}); });
......
import { JOB_LIFE_CYCLE } from '@/pages/DevOps/constants'; import { JOB_LIFE_CYCLE } from '@/pages/DevOps/constants';
import { isStatusDone } from '@/pages/DevOps/function'; import { isStatusDone } from '@/pages/DevOps/function';
import { JobProps } from '@/pages/DevOps/JobDetail/data'; import { JobProps } from '@/pages/DevOps/JobDetail/data';
import { getData, postAll } from '@/services/api';
import { API_CONSTANTS } from '@/services/endpoints'; import { API_CONSTANTS } from '@/services/endpoints';
import { l } from '@/utils/intl'; import { l } from '@/utils/intl';
import { useRequest } from '@@/exports';
import { EllipsisOutlined } from '@ant-design/icons'; import { EllipsisOutlined } from '@ant-design/icons';
import { Button, Dropdown, message, Modal, Space } from 'antd'; import { Button, Dropdown, message, Modal, Space } from 'antd';
...@@ -26,26 +26,17 @@ const JobOperator = (props: JobProps) => { ...@@ -26,26 +26,17 @@ const JobOperator = (props: JobProps) => {
cancelText: l('button.cancel'), cancelText: l('button.cancel'),
onOk: async () => { onOk: async () => {
if (key == operatorType.CANCEL_JOB) { if (key == operatorType.CANCEL_JOB) {
useRequest({ postAll(API_CONSTANTS.CANCEL_JOB, {
url: API_CONSTANTS.CANCEL_JOB, clusterId: jobDetail?.cluster?.id,
params: { jobId: jobDetail?.instance?.jid
clusterId: jobDetail?.cluster?.id,
jobId: jobDetail?.instance?.jid
}
}); });
} else if (key == operatorType.RESTART_JOB) { } else if (key == operatorType.RESTART_JOB) {
useRequest({ getData(API_CONSTANTS.RESTART_TASK, {
url: API_CONSTANTS.RESTART_TASK, id: jobDetail?.instance?.taskId,
params: { isOnLine: jobDetail?.instance?.step == JOB_LIFE_CYCLE.ONLINE
id: jobDetail?.instance?.taskId,
isOnLine: jobDetail?.instance?.step == JOB_LIFE_CYCLE.ONLINE
}
}); });
} else { } else {
useRequest({ getData(API_CONSTANTS.OFFLINE_TASK, { id: jobDetail?.instance?.taskId, type: key });
url: API_CONSTANTS.OFFLINE_TASK,
params: { id: jobDetail?.instance?.taskId, type: key }
});
} }
message.success(l('devops.jobinfo.job.key.success', '', { key: key })); message.success(l('devops.jobinfo.job.key.success', '', { key: key }));
} }
......
...@@ -20,6 +20,7 @@ import { EditBtn } from '@/components/CallBackButton/EditBtn'; ...@@ -20,6 +20,7 @@ import { EditBtn } from '@/components/CallBackButton/EditBtn';
import { EnableSwitchBtn } from '@/components/CallBackButton/EnableSwitchBtn'; import { EnableSwitchBtn } from '@/components/CallBackButton/EnableSwitchBtn';
import { PopconfirmDeleteBtn } from '@/components/CallBackButton/PopconfirmDeleteBtn'; import { PopconfirmDeleteBtn } from '@/components/CallBackButton/PopconfirmDeleteBtn';
import RuleEditForm from '@/pages/SettingCenter/AlertRule/AlertRuleList/RuleEditForm'; import RuleEditForm from '@/pages/SettingCenter/AlertRule/AlertRuleList/RuleEditForm';
import { RuleType } from '@/pages/SettingCenter/AlertRule/constants';
import { queryList } from '@/services/api'; import { queryList } from '@/services/api';
import { handleAddOrUpdate, handleRemoveById } from '@/services/BusinessCrud'; import { handleAddOrUpdate, handleRemoveById } from '@/services/BusinessCrud';
import { PROTABLE_OPTIONS_PUBLIC, STATUS_ENUM, STATUS_MAPPING } from '@/services/constants'; import { PROTABLE_OPTIONS_PUBLIC, STATUS_ENUM, STATUS_MAPPING } from '@/services/constants';
...@@ -31,7 +32,6 @@ import { l } from '@/utils/intl'; ...@@ -31,7 +32,6 @@ import { l } from '@/utils/intl';
import { ActionType, ProTable } from '@ant-design/pro-components'; import { ActionType, ProTable } from '@ant-design/pro-components';
import { ProColumns } from '@ant-design/pro-table'; import { ProColumns } from '@ant-design/pro-table';
import React, { useRef, useState } from 'react'; import React, { useRef, useState } from 'react';
import {RuleType} from "@/pages/SettingCenter/AlertRule/constants";
const AlertRuleList: React.FC = () => { const AlertRuleList: React.FC = () => {
const [ruleState, setRuleState] = useState<AlertRuleListState>(InitAlertRuleState); const [ruleState, setRuleState] = useState<AlertRuleListState>(InitAlertRuleState);
......
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