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