caishunfeng commented on code in PR #15551:
URL: 
https://github.com/apache/dolphinscheduler/pull/15551#discussion_r1473923560


##########
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/utils/CommonUtils.java:
##########
@@ -123,14 +132,56 @@ public static boolean loadKerberosConf(String 
javaSecurityKrb5Conf, String login
         return false;
     }
 
-    public static String getDataQualityJarName() {
-        String dqsJarName = PropertyUtils.getString(DATA_QUALITY_JAR_NAME);
+    public static String getDataQualityJarPath() {
+        String dqsJarPath = PropertyUtils.getString(DATA_QUALITY_JAR_NAME);
 
-        if (StringUtils.isEmpty(dqsJarName)) {
-            return "dolphinscheduler-data-quality.jar";
+        if (StringUtils.isEmpty(dqsJarPath)) {
+            log.info("data quality jar path is empty, will try to get it from 
data quality jar name");
+            return getDefaultDataQualityJarPath();
         }
 
-        return dqsJarName;
+        return dqsJarPath;
+    }
+
+    private static String getDefaultDataQualityJarPath() {
+        if (StringUtils.isNotEmpty(DEFAULT_DATA_QUALITY_JAR_PATH)) {
+            return DEFAULT_DATA_QUALITY_JAR_PATH;
+        }
+        try {
+            // not standalone mode
+            String currentAbsolutePath = new 
ClassPathResource("./").getFile().getAbsolutePath();
+            String currentLibPath = currentAbsolutePath + "/../libs";
+            getDataQualityJarPathFromPath(currentLibPath).ifPresent(jarName -> 
DEFAULT_DATA_QUALITY_JAR_PATH = jarName);
+
+            // standalone mode
+            if (StringUtils.isEmpty(DEFAULT_DATA_QUALITY_JAR_PATH)) {
+                log.info(
+                        "Can not get data quality jar from path {}, maybe 
service running in standalone mode, will try to find another path",
+                        currentLibPath);
+                currentLibPath = currentAbsolutePath + 
"/../../worker-server/libs";

Review Comment:
   It seems can not auto find in docker image?
   
   Is it better to add env when use standalone mode? 



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to