You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by GitBox <gi...@apache.org> on 2022/06/13 04:30:45 UTC

[GitHub] [incubator-inlong] woofyzhao opened a new pull request, #4651: [INLONG-4648][Manager] Read sort connectors from configuration

woofyzhao opened a new pull request, #4651:
URL: https://github.com/apache/incubator-inlong/pull/4651

   - Fixes #4648
   
   


-- 
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@inlong.apache.org

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


[GitHub] [incubator-inlong] healchow commented on a diff in pull request #4651: [INLONG-4648][Manager] Read sort connectors from configuration

Posted by GitBox <gi...@apache.org>.
healchow commented on code in PR #4651:
URL: https://github.com/apache/incubator-inlong/pull/4651#discussion_r895320005


##########
inlong-manager/manager-plugins/src/main/java/org/apache/inlong/manager/plugin/flink/FlinkOperation.java:
##########
@@ -139,8 +160,14 @@ public void genPath(FlinkInfo flinkInfo, String dataflow) throws Exception {
         flinkInfo.setLocalJarPath(jarPath);
         log.info("get sort jar path success, path: {}", jarPath);
 
-        String pluginPath = startPath + SORT_PLUGIN;
-        List<String> connectorPaths = FlinkUtils.listFiles(pluginPath, getConnectorJarPattern(flinkInfo), -1);
+        String connectorDir = getConnectorDir(startPath);
+        List<String> connectorPaths = FlinkUtils.listFiles(connectorDir, getConnectorJarPattern(flinkInfo), -1);
+        if (CollectionUtils.isEmpty(connectorPaths)) {
+            String message = String.format("no sort connectors found in %s", connectorDir);
+            log.error(message);
+            throw new Exception(message);

Review Comment:
   Maybe throw a RuntimeException is better?



-- 
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@inlong.apache.org

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


[GitHub] [incubator-inlong] healchow merged pull request #4651: [INLONG-4648][Manager] Read the path of Sort connectors from configuration file

Posted by GitBox <gi...@apache.org>.
healchow merged PR #4651:
URL: https://github.com/apache/incubator-inlong/pull/4651


-- 
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@inlong.apache.org

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


[GitHub] [incubator-inlong] healchow commented on a diff in pull request #4651: [INLONG-4648][Manager] Read sort connectors from configuration

Posted by GitBox <gi...@apache.org>.
healchow commented on code in PR #4651:
URL: https://github.com/apache/incubator-inlong/pull/4651#discussion_r895319888


##########
inlong-manager/manager-plugins/src/main/java/org/apache/inlong/manager/plugin/flink/FlinkOperation.java:
##########
@@ -39,19 +46,33 @@
 @Slf4j
 public class FlinkOperation {
 
+    private static final String CONFIG_FILE = "application.properties";
+    private static final String CONNECTOR_DIR_KEY = "sort.connector.dir";
     private static final String JOB_TERMINATED_MSG = "the job not found by id %s, "
             + "or task already terminated or savepoint path is null";
     private static final String INLONG_MANAGER = "inlong-manager";
     private static final String INLONG_SORT = "inlong-sort";
     private static final String SORT_JAR_PATTERN = "^sort-dist.*jar$";
-    private static final String SORT_PLUGIN = "sort-plugin";
-
+    private static Properties properties;
     private final FlinkService flinkService;
 
     public FlinkOperation(FlinkService flinkService) {
         this.flinkService = flinkService;
     }
 
+    /**
+     * Get sort connector directory
+     */
+    private static String getConnectorDir(String parent) throws IOException {
+        if (properties == null) {
+            properties = new Properties();
+            String path = Thread.currentThread().getContextClassLoader().getResource("").getPath() + CONFIG_FILE;

Review Comment:
   Suggested use the try-with-resource to handle the file, to avoid the leak of the file resource.



-- 
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@inlong.apache.org

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