You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by ki...@apache.org on 2020/12/23 13:19:21 UTC
[incubator-dolphinscheduler] branch dev updated: [Fix-4289][*]
Flink name with disappeared and unescaped problem (#4290)
This is an automated email from the ASF dual-hosted git repository.
kirs pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-dolphinscheduler.git
The following commit(s) were added to refs/heads/dev by this push:
new f0ada2a [Fix-4289][*] Flink name with disappeared and unescaped problem (#4290)
f0ada2a is described below
commit f0ada2aa2dba2ecdbfdd28c7f88a68fe06730d86
Author: Shiwen Cheng <ch...@gmail.com>
AuthorDate: Wed Dec 23 21:19:08 2020 +0800
[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
---
.../dolphinscheduler/server/utils/ArgsUtils.java | 30 ++++++++++++++++++++++
.../server/utils/FlinkArgsUtils.java | 5 ++--
.../dolphinscheduler/server/utils/LogUtils.java | 6 ++---
.../pages/dag/_source/formModel/tasks/flink.vue | 13 +++-------
.../src/js/module/i18n/locale/en_US.js | 2 +-
.../src/js/module/i18n/locale/zh_CN.js | 2 +-
6 files changed, 40 insertions(+), 18 deletions(-)
diff --git a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/ArgsUtils.java b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/ArgsUtils.java
new file mode 100644
index 0000000..d71eb54
--- /dev/null
+++ b/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("'", "\\'");
+ }
+
+}
diff --git a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/FlinkArgsUtils.java b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/FlinkArgsUtils.java
index 5d3b57b..2431eed 100644
--- a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/FlinkArgsUtils.java
+++ b/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
diff --git a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/LogUtils.java b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/LogUtils.java
index bb8ddc8..1dc4287 100644
--- a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/LogUtils.java
+++ b/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");
}
/**
diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/flink.vue b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/flink.vue
index 24b3bbd..0f422e5 100644
--- a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/flink.vue
+++ b/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'
diff --git a/dolphinscheduler-ui/src/js/module/i18n/locale/en_US.js b/dolphinscheduler-ui/src/js/module/i18n/locale/en_US.js
index 2ab56cb..13dbc7e 100755
--- a/dolphinscheduler-ui/src/js/module/i18n/locale/en_US.js
+++ b/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',
diff --git a/dolphinscheduler-ui/src/js/module/i18n/locale/zh_CN.js b/dolphinscheduler-ui/src/js/module/i18n/locale/zh_CN.js
index 9198c98..c45afda 100755
--- a/dolphinscheduler-ui/src/js/module/i18n/locale/zh_CN.js
+++ b/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内存数',