Unverified Commit c610afb4 authored by Licho's avatar Licho Committed by GitHub

fix: configJson problem (#2260)

* fix: configJson problem * Spotless Apply --------- Co-authored-by: 's avatarleechor <leechor@users.noreply.github.com>
parent 009fb6a5
...@@ -62,7 +62,7 @@ public class StudioExecuteDTO extends AbstractStatementDTO { ...@@ -62,7 +62,7 @@ public class StudioExecuteDTO extends AbstractStatementDTO {
private Integer parallelism; private Integer parallelism;
private Integer savePointStrategy; private Integer savePointStrategy;
private String savePointPath; private String savePointPath;
private Map<String, String> config = new HashMap<>(); private Map<String, String> configJson = new HashMap<>();
private static final ObjectMapper mapper = new ObjectMapper(); private static final ObjectMapper mapper = new ObjectMapper();
public JobConfig getJobConfig() { public JobConfig getJobConfig() {
...@@ -87,7 +87,7 @@ public class StudioExecuteDTO extends AbstractStatementDTO { ...@@ -87,7 +87,7 @@ public class StudioExecuteDTO extends AbstractStatementDTO {
savePointStrategy, savePointStrategy,
savePointPath, savePointPath,
getVariables(), getVariables(),
config); configJson);
} }
public Integer getTaskId() { public Integer getTaskId() {
......
...@@ -942,7 +942,7 @@ public class TaskServiceImpl extends SuperServiceImpl<TaskMapper, Task> implemen ...@@ -942,7 +942,7 @@ public class TaskServiceImpl extends SuperServiceImpl<TaskMapper, Task> implemen
Savepoints savepoints = buildSavepoint(config); Savepoints savepoints = buildSavepoint(config);
if (Asserts.isNotNull(savepoints)) { if (Asserts.isNotNull(savepoints)) {
config.setSavePointPath(savepoints.getPath()); config.setSavePointPath(savepoints.getPath());
config.getConfig().put("execution.savepoint.path", savepoints.getPath()); config.getConfigJson().put("execution.savepoint.path", savepoints.getPath());
} }
if (!GatewayType.get(task.getType()).isDeployCluster()) { if (!GatewayType.get(task.getType()).isDeployCluster()) {
...@@ -977,7 +977,7 @@ public class TaskServiceImpl extends SuperServiceImpl<TaskMapper, Task> implemen ...@@ -977,7 +977,7 @@ public class TaskServiceImpl extends SuperServiceImpl<TaskMapper, Task> implemen
private FlinkClusterConfig buildGatewayCfgObj(JobConfig config) { private FlinkClusterConfig buildGatewayCfgObj(JobConfig config) {
FlinkClusterConfig flinkClusterCfg = clusterCfgService.getFlinkClusterCfg(config.getClusterConfigurationId()); FlinkClusterConfig flinkClusterCfg = clusterCfgService.getFlinkClusterCfg(config.getClusterConfigurationId());
flinkClusterCfg.getAppConfig().setUserJarParas(buildParas(config.getTaskId())); flinkClusterCfg.getAppConfig().setUserJarParas(buildParas(config.getTaskId()));
flinkClusterCfg.getFlinkConfig().getConfiguration().putAll(config.getConfig()); flinkClusterCfg.getFlinkConfig().getConfiguration().putAll(config.getConfigJson());
// if (config.isJarTask()) { // if (config.isJarTask()) {
// JSONObject clusterObj = new JSONObject(flinkClusterCfg); // JSONObject clusterObj = new JSONObject(flinkClusterCfg);
......
...@@ -74,21 +74,21 @@ public class JobConfig { ...@@ -74,21 +74,21 @@ public class JobConfig {
private String savePointPath; private String savePointPath;
private GatewayConfig gatewayConfig; private GatewayConfig gatewayConfig;
private Map<String, String> variables; private Map<String, String> variables;
private Map<String, String> config; private Map<String, String> configJson;
public JobConfig() { public JobConfig() {
this.config = new HashMap<String, String>(); this.configJson = new HashMap<String, String>();
} }
public void setAddress(String address) { public void setAddress(String address) {
if (GatewayType.LOCAL.equalsValue(type) if (GatewayType.LOCAL.equalsValue(type)
&& Asserts.isNotNull(config) && Asserts.isNotNull(configJson)
&& config.containsKey(RestOptions.PORT.key())) { && configJson.containsKey(RestOptions.PORT.key())) {
int colonIndex = address.indexOf(':'); int colonIndex = address.indexOf(':');
if (colonIndex == -1) { if (colonIndex == -1) {
this.address = address + NetConstant.COLON + config.get(RestOptions.PORT.key()); this.address = address + NetConstant.COLON + configJson.get(RestOptions.PORT.key());
} else { } else {
this.address = address.replaceAll("(?<=:)\\d{0,6}$", config.get(RestOptions.PORT.key())); this.address = address.replaceAll("(?<=:)\\d{0,6}$", configJson.get(RestOptions.PORT.key()));
} }
} else { } else {
this.address = address; this.address = address;
...@@ -102,14 +102,14 @@ public class JobConfig { ...@@ -102,14 +102,14 @@ public class JobConfig {
boolean useSqlFragment, boolean useSqlFragment,
boolean useStatementSet, boolean useStatementSet,
Integer parallelism, Integer parallelism,
Map<String, String> config) { Map<String, String> configJson) {
this.type = type; this.type = type;
this.useSession = useSession; this.useSession = useSession;
this.useRemote = useRemote; this.useRemote = useRemote;
this.useSqlFragment = useSqlFragment; this.useSqlFragment = useSqlFragment;
this.useStatementSet = useStatementSet; this.useStatementSet = useStatementSet;
this.parallelism = parallelism; this.parallelism = parallelism;
this.config = config; this.configJson = configJson;
} }
public JobConfig( public JobConfig(
...@@ -133,7 +133,7 @@ public class JobConfig { ...@@ -133,7 +133,7 @@ public class JobConfig {
Integer savePointStrategyValue, Integer savePointStrategyValue,
String savePointPath, String savePointPath,
Map<String, String> variables, Map<String, String> variables,
Map<String, String> config) { Map<String, String> configJson) {
this.type = type; this.type = type;
this.useResult = useResult; this.useResult = useResult;
this.useChangeLog = useChangeLog; this.useChangeLog = useChangeLog;
...@@ -155,7 +155,7 @@ public class JobConfig { ...@@ -155,7 +155,7 @@ public class JobConfig {
this.savePointStrategy = SavePointStrategy.get(savePointStrategyValue); this.savePointStrategy = SavePointStrategy.get(savePointStrategyValue);
this.savePointPath = savePointPath; this.savePointPath = savePointPath;
this.variables = variables; this.variables = variables;
this.config = config; this.configJson = configJson;
} }
public JobConfig( public JobConfig(
...@@ -175,7 +175,7 @@ public class JobConfig { ...@@ -175,7 +175,7 @@ public class JobConfig {
Integer parallelism, Integer parallelism,
Integer savePointStrategyValue, Integer savePointStrategyValue,
String savePointPath, String savePointPath,
Map<String, String> config, Map<String, String> configJson,
GatewayConfig gatewayConfig) { GatewayConfig gatewayConfig) {
this.type = type; this.type = type;
this.useResult = useResult; this.useResult = useResult;
...@@ -192,7 +192,7 @@ public class JobConfig { ...@@ -192,7 +192,7 @@ public class JobConfig {
this.parallelism = parallelism; this.parallelism = parallelism;
this.savePointStrategy = SavePointStrategy.get(savePointStrategyValue); this.savePointStrategy = SavePointStrategy.get(savePointStrategyValue);
this.savePointPath = savePointPath; this.savePointPath = savePointPath;
this.config = config; this.configJson = configJson;
this.gatewayConfig = gatewayConfig; this.gatewayConfig = gatewayConfig;
setAddress(address); setAddress(address);
} }
...@@ -232,7 +232,7 @@ public class JobConfig { ...@@ -232,7 +232,7 @@ public class JobConfig {
Integer parallelism, Integer parallelism,
Integer savePointStrategyValue, Integer savePointStrategyValue,
String savePointPath, String savePointPath,
Map<String, String> config, Map<String, String> configJson,
boolean isJarTask) { boolean isJarTask) {
this.type = type; this.type = type;
this.step = step; this.step = step;
...@@ -251,7 +251,7 @@ public class JobConfig { ...@@ -251,7 +251,7 @@ public class JobConfig {
this.parallelism = parallelism; this.parallelism = parallelism;
this.savePointStrategy = SavePointStrategy.get(savePointStrategyValue); this.savePointStrategy = SavePointStrategy.get(savePointStrategyValue);
this.savePointPath = savePointPath; this.savePointPath = savePointPath;
this.config = config; this.configJson = configJson;
this.isJarTask = isJarTask; this.isJarTask = isJarTask;
} }
...@@ -264,7 +264,7 @@ public class JobConfig { ...@@ -264,7 +264,7 @@ public class JobConfig {
useBatchModel, useBatchModel,
savePointPath, savePointPath,
jobName, jobName,
config); configJson);
} }
public void buildGatewayConfig(FlinkClusterConfig config) { public void buildGatewayConfig(FlinkClusterConfig config) {
......
...@@ -352,9 +352,9 @@ public class JobManager { ...@@ -352,9 +352,9 @@ public class JobManager {
} }
public void initClassLoader(JobConfig config) { public void initClassLoader(JobConfig config) {
if (CollUtil.isNotEmpty(config.getConfig())) { if (CollUtil.isNotEmpty(config.getConfigJson())) {
String pipelineJars = config.getConfig().get(PipelineOptions.JARS.key()); String pipelineJars = config.getConfigJson().get(PipelineOptions.JARS.key());
String classpaths = config.getConfig().get(PipelineOptions.CLASSPATHS.key()); String classpaths = config.getConfigJson().get(PipelineOptions.CLASSPATHS.key());
// add custom jar path // add custom jar path
if (StrUtil.isNotBlank(pipelineJars)) { if (StrUtil.isNotBlank(pipelineJars)) {
String[] paths = pipelineJars.split(","); String[] paths = pipelineJars.split(",");
...@@ -721,7 +721,7 @@ public class JobManager { ...@@ -721,7 +721,7 @@ public class JobManager {
.setFlinkConfig(FlinkConfig.build(jobId, ActionType.SAVEPOINT.getValue(), savePointType, null)); .setFlinkConfig(FlinkConfig.build(jobId, ActionType.SAVEPOINT.getValue(), savePointType, null));
return Gateway.build(config.getGatewayConfig()).savepointJob(savePoint); return Gateway.build(config.getGatewayConfig()).savepointJob(savePoint);
} else { } else {
return FlinkAPI.build(config.getAddress()).savepoints(jobId, savePointType, config.getConfig()); return FlinkAPI.build(config.getAddress()).savepoints(jobId, savePointType, config.getConfigJson());
} }
} }
......
...@@ -40,7 +40,7 @@ class JobConfigTest { ...@@ -40,7 +40,7 @@ class JobConfigTest {
Map<String, String> config = new HashMap<>(); Map<String, String> config = new HashMap<>();
config.put(RestOptions.PORT.key(), "9999"); config.put(RestOptions.PORT.key(), "9999");
jobConfig.setConfig(config); jobConfig.setConfigJson(config);
jobConfig.setAddress("127.0.0.1:7777"); jobConfig.setAddress("127.0.0.1:7777");
assertEquals("127.0.0.1:9999", jobConfig.getAddress()); assertEquals("127.0.0.1:9999", jobConfig.getAddress());
......
...@@ -10,6 +10,8 @@ export async function getJobPlan(title: string, params: any) { ...@@ -10,6 +10,8 @@ export async function getJobPlan(title: string, params: any) {
return handleOption('/api/studio/getJobPlan', title, params); return handleOption('/api/studio/getJobPlan', title, params);
} }
export async function executeSql(title: string, params: TaskDataType) { export async function executeSql(title: string, params: TaskDataType) {
// TODO: temp process
params.configJson = params.configJson[0];
return handleOption('/api/studio/executeSql', title, params); return handleOption('/api/studio/executeSql', title, params);
} }
export function offLineTask(title: string, id: number, type: string) { export function offLineTask(title: string, id: number, type: string) {
......
...@@ -46,6 +46,7 @@ import { ...@@ -46,6 +46,7 @@ import {
} from '@ant-design/pro-components'; } from '@ant-design/pro-components';
import { Badge, Space, Typography } from 'antd'; import { Badge, Space, Typography } from 'antd';
import { useForm } from 'antd/es/form/Form'; import { useForm } from 'antd/es/form/Form';
import { debounce } from 'lodash';
import { connect } from 'umi'; import { connect } from 'umi';
const { Text } = Typography; const { Text } = Typography;
...@@ -81,7 +82,7 @@ const JobConfig = (props: any) => { ...@@ -81,7 +82,7 @@ const JobConfig = (props: any) => {
} }
Object.keys(change).forEach((key) => { Object.keys(change).forEach((key) => {
pane.params.taskData[key] = change[key]; pane.params.taskData[key] = all[key];
}); });
dispatch({ dispatch({
...@@ -111,7 +112,7 @@ const JobConfig = (props: any) => { ...@@ -111,7 +112,7 @@ const JobConfig = (props: any) => {
form={form} form={form}
submitter={false} submitter={false}
layout='vertical' layout='vertical'
onValuesChange={onValuesChange} onValuesChange={debounce(onValuesChange, 500)}
> >
<ProFormSelect <ProFormSelect
name='type' name='type'
......
...@@ -46,7 +46,7 @@ const JobInfo = (props: any) => { ...@@ -46,7 +46,7 @@ const JobInfo = (props: any) => {
} }
Object.keys(change).forEach((key) => { Object.keys(change).forEach((key) => {
pane.params.taskData[key] = change[key]; pane.params.taskData[key] = all[key];
}); });
dispatch({ dispatch({
......
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