You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by GitBox <gi...@apache.org> on 2022/10/16 04:53:33 UTC

[GitHub] [dolphinscheduler] ruanwenjun commented on a diff in pull request #12358: [Fix-12356][k8s] fix the null exception when submitting k8s task plugin

ruanwenjun commented on code in PR #12358:
URL: https://github.com/apache/dolphinscheduler/pull/12358#discussion_r996388494


##########
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java:
##########
@@ -3169,10 +3169,11 @@ public String findConfigYamlByName(String clusterName) {
         if (Strings.isNullOrEmpty(clusterName)) {
             return null;
         }
-        QueryWrapper<K8s> nodeWrapper = new QueryWrapper<>();
-        nodeWrapper.eq("k8s_name", clusterName);
-        K8s k8s = k8sMapper.selectOne(nodeWrapper);
-        return k8s.getK8sConfig();
+
+        QueryWrapper<Cluster> nodeWrapper = new QueryWrapper<>();
+        nodeWrapper.eq("name", clusterName);
+        Cluster cluster = clusterMapper.selectOne(nodeWrapper);
+        return cluster.getConfig();

Review Comment:
   It's better to write a sql rather than use `QueryWrapper`, and when the cluster is null here we might better return null rather than NPE?



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

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