You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@linkis.apache.org by "peacewong (via GitHub)" <gi...@apache.org> on 2023/06/20 06:28:43 UTC

[GitHub] [linkis] peacewong commented on a diff in pull request #4673: Upgrade seatunnel to 2.3.1

peacewong commented on code in PR #4673:
URL: https://github.com/apache/linkis/pull/4673#discussion_r1234790170


##########
linkis-engineconn-plugins/seatunnel/src/main/java/org/apache/seatunnel/common/config/Common.java:
##########
@@ -106,18 +129,47 @@ public static Path pluginTarball() {
     return appRootDir().resolve("plugins.tar.gz");
   }
 
-  /** Get specific plugin dir */
-  public static Path pluginDir(String pluginName) {
-    return Paths.get(pluginRootDir().toString(), pluginName);
+  public static List<Path> getPluginsJarDependencies() {
+    Path pluginRootDir = Common.pluginRootDir();
+    if (!Files.exists(pluginRootDir) || !Files.isDirectory(pluginRootDir)) {
+      return Collections.emptyList();
+    }
+    try (Stream<Path> stream = Files.walk(pluginRootDir, PLUGIN_LIB_DIR_DEPTH, FOLLOW_LINKS)) {
+      return stream
+          .filter(it -> pluginRootDir.relativize(it).getNameCount() == PLUGIN_LIB_DIR_DEPTH)
+          .filter(it -> it.getParent().endsWith("lib"))
+          .filter(it -> it.getFileName().toString().endsWith(".jar"))
+          .collect(Collectors.toList());
+    } catch (IOException e) {
+      throw new RuntimeException(e);
+    }
   }
 
-  /** Get files dir of specific plugin */
-  public static Path pluginFilesDir(String pluginName) {
-    return Paths.get(pluginDir(pluginName).toString(), "files");
+  public static Path libDir() {
+    return appRootDir().resolve("lib");
+  }
+
+  public static List<Path> getLibJars() {
+    Path libRootDir = Common.libDir();
+    if (!Files.exists(libRootDir) || !Files.isDirectory(libRootDir)) {
+      return Collections.emptyList();
+    }
+    try (Stream<Path> stream = Files.walk(libRootDir, APP_LIB_DIR_DEPTH, FOLLOW_LINKS)) {
+      return stream
+          .filter(it -> !it.toFile().isDirectory())
+          .filter(it -> it.getFileName().toString().endsWith(".jar"))
+          .collect(Collectors.toList());
+    } catch (IOException e) {
+      throw new RuntimeException(e);

Review Comment:
   Use LinkisRuntimeException



##########
linkis-engineconn-plugins/seatunnel/src/main/java/org/apache/seatunnel/core/flink/FlinkV2Starter.java:
##########
@@ -0,0 +1,104 @@
+/*
+ * 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.linkis.engineconnplugin.seatunnel.util.SeatunnelUtils;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.seatunnel.common.config.Common;
+import org.apache.seatunnel.core.starter.Starter;
+import org.apache.seatunnel.core.starter.enums.EngineType;
+import org.apache.seatunnel.core.starter.flink.SeaTunnelFlink;
+import org.apache.seatunnel.core.starter.flink.args.FlinkCommandArgs;
+import org.apache.seatunnel.core.starter.utils.CommandLineUtils;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Objects;
+
+/**
+ * @Author shixiutao

Review Comment:
   need to remove author



##########
linkis-engineconn-plugins/seatunnel/src/main/java/org/apache/seatunnel/common/config/Common.java:
##########
@@ -106,18 +129,47 @@ public static Path pluginTarball() {
     return appRootDir().resolve("plugins.tar.gz");
   }
 
-  /** Get specific plugin dir */
-  public static Path pluginDir(String pluginName) {
-    return Paths.get(pluginRootDir().toString(), pluginName);
+  public static List<Path> getPluginsJarDependencies() {
+    Path pluginRootDir = Common.pluginRootDir();
+    if (!Files.exists(pluginRootDir) || !Files.isDirectory(pluginRootDir)) {
+      return Collections.emptyList();
+    }
+    try (Stream<Path> stream = Files.walk(pluginRootDir, PLUGIN_LIB_DIR_DEPTH, FOLLOW_LINKS)) {
+      return stream
+          .filter(it -> pluginRootDir.relativize(it).getNameCount() == PLUGIN_LIB_DIR_DEPTH)
+          .filter(it -> it.getParent().endsWith("lib"))
+          .filter(it -> it.getFileName().toString().endsWith(".jar"))
+          .collect(Collectors.toList());
+    } catch (IOException e) {
+      throw new RuntimeException(e);

Review Comment:
   Use LinkisRuntimeException



##########
linkis-engineconn-plugins/seatunnel/pom.xml:
##########
@@ -79,7 +83,17 @@
 
     <dependency>
       <groupId>org.apache.seatunnel</groupId>
-      <artifactId>seatunnel-core-spark</artifactId>
+      <artifactId>seatunnel-engine-core</artifactId>
+      <version>${seatunnel.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>com.hazelcast</groupId>

Review Comment:
   need add license to dir linkis-dist/release-docs/licenses



-- 
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: notifications-unsubscribe@linkis.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@linkis.apache.org
For additional commands, e-mail: notifications-help@linkis.apache.org