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/24 03:25:00 UTC

[GitHub] [incubator-seatunnel] CalvinKirs opened a new pull request, #1945: [API-DRAFT]Add spark-core-starter module Code splitting for old and new engines

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

   Add `spark-core-starter` module Code splitting for old and new engines


-- 
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] CalvinKirs commented on a diff in pull request #1945: [API-DRAFT]Add spark-core-starter module Code splitting for old and new engines

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


##########
seatunnel-core/seatunnel-spark-starter/src/test/resources/spark_application.conf:
##########
@@ -0,0 +1,66 @@
+#

Review Comment:
   used in test



-- 
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] CalvinKirs commented on a diff in pull request #1945: [API-DRAFT]Add spark-core-starter module Code splitting for old and new engines

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


##########
seatunnel-core/seatunnel-spark-starter/src/test/resources/spark_application.conf:
##########
@@ -0,0 +1,66 @@
+#

Review Comment:
   used in test~



-- 
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 #1945: [API-DRAFT]Add spark-core-starter module Code splitting for old and new engines

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


##########
seatunnel-core/seatunnel-spark-starter/src/main/java/org/apache/seatunnel/core/starter/spark/config/SparkExecutionContext.java:
##########
@@ -0,0 +1,103 @@
+/*
+ * 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.starter.spark.config;
+
+import org.apache.seatunnel.apis.base.api.BaseSink;
+import org.apache.seatunnel.apis.base.api.BaseSource;
+import org.apache.seatunnel.apis.base.api.BaseTransform;
+import org.apache.seatunnel.core.starter.config.AbstractExecutionContext;
+import org.apache.seatunnel.core.starter.config.EngineType;
+import org.apache.seatunnel.core.starter.config.PluginType;
+import org.apache.seatunnel.plugin.discovery.PluginIdentifier;
+import org.apache.seatunnel.plugin.discovery.spark.SparkSinkPluginDiscovery;
+import org.apache.seatunnel.plugin.discovery.spark.SparkSourcePluginDiscovery;
+import org.apache.seatunnel.plugin.discovery.spark.SparkTransformPluginDiscovery;
+import org.apache.seatunnel.spark.SparkEnvironment;
+
+import org.apache.seatunnel.shade.com.typesafe.config.Config;
+
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+
+public class SparkExecutionContext extends AbstractExecutionContext<SparkEnvironment> {
+    private final SparkSourcePluginDiscovery sparkSourcePluginDiscovery;
+    private final SparkTransformPluginDiscovery sparkTransformPluginDiscovery;
+    private final SparkSinkPluginDiscovery sparkSinkPluginDiscovery;
+    private final List<URL> pluginJars;
+
+    public SparkExecutionContext(Config config, EngineType engine) {
+        super(config, engine);
+        this.sparkSourcePluginDiscovery = new SparkSourcePluginDiscovery();
+        this.sparkTransformPluginDiscovery = new SparkTransformPluginDiscovery();
+        this.sparkSinkPluginDiscovery = new SparkSinkPluginDiscovery();
+        List<URL> pluginJars = new ArrayList<>();
+        pluginJars.addAll(sparkSourcePluginDiscovery.getPluginJarPaths(getPluginIdentifiers(PluginType.SOURCE)));
+        pluginJars.addAll(sparkSinkPluginDiscovery.getPluginJarPaths(getPluginIdentifiers(PluginType.SINK)));
+        this.pluginJars = pluginJars;
+        this.getEnvironment().registerPlugin(pluginJars);
+    }
+
+    @Override
+    public List<BaseSource<SparkEnvironment>> getSources() {

Review Comment:
   In our new spark starter module we will not use this class, BaseSource is used for old API.



##########
seatunnel-core/seatunnel-spark-starter/src/main/bin/start-seatunnel-spark.sh:
##########
@@ -0,0 +1,45 @@
+#!/bin/bash
+#
+# 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.
+#
+set -eu
+APP_DIR=$(cd $(dirname ${0})/../;pwd)
+CONF_DIR=${APP_DIR}/config
+APP_JAR=${APP_DIR}/lib/seatunnel-core-spark.jar
+
+if [ -f "${CONF_DIR}/seatunnel-env.sh" ]; then
+    . "${CONF_DIR}/seatunnel-env.sh"
+fi
+
+if [ $# == 0 ]
+then
+    args="-h"
+else
+    args=$@
+fi
+
+CMD=$(java -cp ${APP_JAR} org.apache.seatunnel.core.spark.SparkStarter ${args} | tail -n 1) && EXIT_CODE=$? || EXIT_CODE=$?

Review Comment:
   ```suggestion
   CMD=$(java -cp ${APP_JAR} org.apache.seatunnel.core.starter.spark.SparkStarter ${args} | tail -n 1) && EXIT_CODE=$? || EXIT_CODE=$?
   ```



##########
seatunnel-core/seatunnel-spark-starter/src/test/resources/spark_application.conf:
##########
@@ -0,0 +1,66 @@
+#

Review Comment:
   It seems this filed have not been used?



-- 
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 #1945: [API-DRAFT]Add spark-core-starter module Code splitting for old and new engines

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


-- 
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