You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by GitBox <gi...@apache.org> on 2022/05/11 13:29:26 UTC

[GitHub] [incubator-seatunnel] ruanwenjun opened a new pull request, #1854: [Bug][Starter] Fix variables cannot be set in flink mode

ruanwenjun opened a new pull request, #1854:
URL: https://github.com/apache/incubator-seatunnel/pull/1854

   ## Purpose of this pull request
   
   We cannot use `-D` to set the JVM args in flink run script, this PR will use `export` to set the JVM args.
   
   ## Check list
   
   * [ ] Code changed are covered with tests, or it does not need tests for reason:
   * [ ] If any new Jar binary package adding in your PR, please add License Notice according
     [New License Guide](https://github.com/apache/incubator-seatunnel/blob/dev/docs/en/contribution/new-license.md)
   * [ ] If necessary, please update the documentation to describe the new feature. https://github.com/apache/incubator-seatunnel/tree/dev/docs
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-seatunnel] legendtkl commented on a diff in pull request #1854: [Bug][Starter] Fix variables cannot be set in flink mode

Posted by GitBox <gi...@apache.org>.
legendtkl commented on code in PR #1854:
URL: https://github.com/apache/incubator-seatunnel/pull/1854#discussion_r870345327


##########
seatunnel-core/seatunnel-core-flink/src/main/java/org/apache/seatunnel/core/flink/FlinkEnvParameterParser.java:
##########
@@ -0,0 +1,60 @@
+/*
+ * 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.seatunnel.core.flink;
+
+import org.apache.seatunnel.core.base.config.ConfigParser;
+import org.apache.seatunnel.core.flink.args.FlinkCommandArgs;
+import org.apache.seatunnel.core.flink.config.FlinkJobType;
+import org.apache.seatunnel.core.flink.utils.CommandLineUtils;
+
+import org.apache.commons.lang3.StringUtils;
+
+import java.io.FileNotFoundException;
+import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Used to parse the variables need to set into the environment.
+ */
+public class FlinkEnvParameterParser {
+
+    @SuppressWarnings("checkstyle:RegexpSingleline")
+    public static void main(String[] args) throws FileNotFoundException {
+        FlinkCommandArgs flinkCommandArgs = CommandLineUtils.parseCommandArgs(args, FlinkJobType.JAR);
+        List<String> envParameters = getEnvParameters(flinkCommandArgs);
+        System.out.println(String.join(" ", envParameters));
+    }
+
+    static List<String> getEnvParameters(FlinkCommandArgs flinkCommandArgs) throws FileNotFoundException {

Review Comment:
   I think a UT for `getEnvParameters` is necessary, just like `org.apache.seatunnel.core.sql.FlinkEnvParameterParserTest`



##########
seatunnel-core/seatunnel-core-flink/src/main/java/org/apache/seatunnel/core/flink/utils/CommandLineUtils.java:
##########
@@ -71,19 +67,6 @@ public static List<String> buildFlinkCommand(FlinkCommandArgs flinkCommandArgs,
         if (flinkCommandArgs.isCheckConfig()) {
             command.add("--check");
         }
-        // set System properties
-        flinkCommandArgs.getVariables().stream()
-          .filter(Objects::nonNull)
-          .map(String::trim)
-          .forEach(variable -> command.add("-D" + variable));
-
-        if (jobType.equals(FlinkJobType.JAR)) {

Review Comment:
   The function parameter `jobType` could be removed.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-seatunnel] ruanwenjun commented on pull request #1854: [Bug][Starter] Fix variables cannot be set in flink mode

Posted by GitBox <gi...@apache.org>.
ruanwenjun commented on PR #1854:
URL: https://github.com/apache/incubator-seatunnel/pull/1854#issuecomment-1123767322

   @legendtkl  @BenJFan Take a look if you are interested.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-seatunnel] legendtkl commented on pull request #1854: [Bug][Starter] Fix variables cannot be set in flink mode

Posted by GitBox <gi...@apache.org>.
legendtkl commented on PR #1854:
URL: https://github.com/apache/incubator-seatunnel/pull/1854#issuecomment-1123855583

   LGTM


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-seatunnel] ruanwenjun commented on a diff in pull request #1854: [Bug][Starter] Fix variables cannot be set in flink mode

Posted by GitBox <gi...@apache.org>.
ruanwenjun commented on code in PR #1854:
URL: https://github.com/apache/incubator-seatunnel/pull/1854#discussion_r870374495


##########
seatunnel-core/seatunnel-core-flink/src/main/java/org/apache/seatunnel/core/flink/FlinkEnvParameterParser.java:
##########
@@ -0,0 +1,60 @@
+/*
+ * 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.seatunnel.core.flink;
+
+import org.apache.seatunnel.core.base.config.ConfigParser;
+import org.apache.seatunnel.core.flink.args.FlinkCommandArgs;
+import org.apache.seatunnel.core.flink.config.FlinkJobType;
+import org.apache.seatunnel.core.flink.utils.CommandLineUtils;
+
+import org.apache.commons.lang3.StringUtils;
+
+import java.io.FileNotFoundException;
+import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Used to parse the variables need to set into the environment.
+ */
+public class FlinkEnvParameterParser {
+
+    @SuppressWarnings("checkstyle:RegexpSingleline")
+    public static void main(String[] args) throws FileNotFoundException {
+        FlinkCommandArgs flinkCommandArgs = CommandLineUtils.parseCommandArgs(args, FlinkJobType.JAR);
+        List<String> envParameters = getEnvParameters(flinkCommandArgs);
+        System.out.println(String.join(" ", envParameters));
+    }
+
+    static List<String> getEnvParameters(FlinkCommandArgs flinkCommandArgs) throws FileNotFoundException {

Review Comment:
   Done.



##########
seatunnel-core/seatunnel-core-flink/src/main/java/org/apache/seatunnel/core/flink/utils/CommandLineUtils.java:
##########
@@ -71,19 +67,6 @@ public static List<String> buildFlinkCommand(FlinkCommandArgs flinkCommandArgs,
         if (flinkCommandArgs.isCheckConfig()) {
             command.add("--check");
         }
-        // set System properties
-        flinkCommandArgs.getVariables().stream()
-          .filter(Objects::nonNull)
-          .map(String::trim)
-          .forEach(variable -> command.add("-D" + variable));
-
-        if (jobType.equals(FlinkJobType.JAR)) {

Review Comment:
   Done.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-seatunnel] ruanwenjun merged pull request #1854: [Bug][Starter] Fix variables cannot be set in flink mode

Posted by GitBox <gi...@apache.org>.
ruanwenjun merged PR #1854:
URL: https://github.com/apache/incubator-seatunnel/pull/1854


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org