Browse Source

[Fix-4289][*] Flink name with disappeared and unescaped problem (#4290)

* fix flink name not display in process definition editor

* fix flink name not escape problem

* simplify escape method
pull/3/MERGE
Shiwen Cheng 4 years ago committed by GitHub
parent
commit
f0ada2aa2d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 30
      dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/ArgsUtils.java
  2. 5
      dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/FlinkArgsUtils.java
  3. 6
      dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/LogUtils.java
  4. 13
      dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/flink.vue
  5. 2
      dolphinscheduler-ui/src/js/module/i18n/locale/en_US.js
  6. 2
      dolphinscheduler-ui/src/js/module/i18n/locale/zh_CN.js

30
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/ArgsUtils.java

@ -0,0 +1,30 @@
/*
* 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.apache.dolphinscheduler.server.utils;
public class ArgsUtils {
private ArgsUtils() throws IllegalStateException {
throw new IllegalStateException("Utility class");
}
public static String escape(String arg) {
return arg.replace(" ", "\\ ").replace("\"", "\\\"").replace("'", "\\'");
}
}

5
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/FlinkArgsUtils.java

@ -14,8 +14,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.server.utils;
package org.apache.dolphinscheduler.server.utils;
import org.apache.commons.lang.StringUtils;
import org.apache.dolphinscheduler.common.Constants;
@ -26,7 +26,6 @@ import org.apache.dolphinscheduler.common.task.flink.FlinkParameters;
import java.util.ArrayList;
import java.util.List;
/**
* flink args utils
*/
@ -62,7 +61,7 @@ public class FlinkArgsUtils {
String appName = param.getAppName();
if (StringUtils.isNotEmpty(appName)) { //-ynm
args.add(Constants.FLINK_APP_NAME);
args.add(appName);
args.add(ArgsUtils.escape(appName));
}
// judge flink version,from flink1.10,the parameter -yn removed

6
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/LogUtils.java

@ -25,8 +25,6 @@ import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Optional;
import javax.transaction.NotSupportedException;
import org.slf4j.LoggerFactory;
import ch.qos.logback.classic.sift.SiftingAppender;
@ -35,8 +33,8 @@ import ch.qos.logback.core.spi.AppenderAttachable;
public class LogUtils {
private LogUtils() throws NotSupportedException {
throw new NotSupportedException();
private LogUtils() throws IllegalStateException {
throw new IllegalStateException("Utility class");
}
/**

13
dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/flink.vue

@ -89,7 +89,7 @@
type="input"
size="small"
v-model="appName"
:placeholder="$t('Please enter the job name of Flink')"
:placeholder="$t('Please enter the job name of Flink(optional)')"
style="width: 200px;">
</el-input>
</span>
@ -303,11 +303,6 @@
return false
}
if (!this.appName) {
this.$message.warning(`${i18n.$t('Please enter the job name of Flink')}`)
return false
}
if (!this.jobManagerMemory) {
this.$message.warning(`${i18n.$t('Please enter jobManager memory')}`)
return false
@ -353,9 +348,9 @@
flinkVersion: this.flinkVersion,
slot: this.slot,
taskManager: this.taskManager,
appName: this.appName,
jobManagerMemory: this.jobManagerMemory,
taskManagerMemory: this.taskManagerMemory,
appName: this.appName,
mainArgs: this.mainArgs,
others: this.others,
programType: this.programType
@ -489,9 +484,9 @@
localParams: this.localParams,
slot: this.slot,
taskManager: this.taskManager,
appName: this.appName,
jobManagerMemory: this.jobManagerMemory,
taskManagerMemory: this.taskManagerMemory,
appName: this.appName,
mainArgs: this.mainArgs,
others: this.others,
programType: this.programType
@ -522,7 +517,7 @@
this.taskManager = o.params.taskManager || '2'
this.jobManagerMemory = o.params.jobManagerMemory || '1G'
this.taskManagerMemory = o.params.taskManagerMemory || '2G'
this.appName = o.params.appName || ''
this.mainArgs = o.params.mainArgs || ''
this.others = o.params.others
this.programType = o.params.programType || 'SCALA'

2
dolphinscheduler-ui/src/js/module/i18n/locale/en_US.js

@ -108,7 +108,7 @@ export default {
'Driver memory use': 'Driver memory use',
'Please enter driver memory use': 'Please enter driver memory use',
'Number of Executors': 'Number of Executors',
'Please enter the job name of Flink': 'Please enter the job name of Flink',
'Please enter the job name of Flink(optional)': 'Please enter the job name of Flink(optional)',
'Please enter the number of Executor': 'Please enter the number of Executor',
'Executor memory': 'Executor memory',
'Please enter the Executor memory': 'Please enter the Executor memory',

2
dolphinscheduler-ui/src/js/module/i18n/locale/zh_CN.js

@ -106,7 +106,7 @@ export default {
'Driver memory use': 'Driver内存数',
'Please enter driver memory use': '请输入Driver内存数',
'Number of Executors': 'Executor数量',
'Please enter the job name of Flink': '请输入Flink任务名称',
'Please enter the job name of Flink(optional)': '请输入Flink任务名称(选填)',
'Please enter the number of Executor': '请输入Executor数量',
'Executor memory': 'Executor内存数',
'Please enter the Executor memory': '请输入Executor内存数',

Loading…
Cancel
Save