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 2020/11/28 10:08:58 UTC

[GitHub] [incubator-dolphinscheduler] felix-thinkingdata commented on a change in pull request #4120: [Improvement][API] ignore noNodeException when get worker groups

felix-thinkingdata commented on a change in pull request #4120:
URL: https://github.com/apache/incubator-dolphinscheduler/pull/4120#discussion_r532016334



##########
File path: dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/WorkerGroupService.java
##########
@@ -120,30 +121,46 @@
         return result;
     }
 
-
     /**
-     *  get worker groups
+     * get worker groups
      *
      * @param isPaging whether paging
      * @return WorkerGroup list
      */
     private List<WorkerGroup> getWorkerGroups(boolean isPaging) {
-        String workerPath = zookeeperCachedOperator.getZookeeperConfig().getDsRoot()+"/nodes" +"/worker";
-        List<String> workerGroupList = zookeeperCachedOperator.getChildrenKeys(workerPath);
+
+        String workerPath = zookeeperCachedOperator.getZookeeperConfig().getDsRoot() + "/nodes" + "/worker";
+        List<WorkerGroup> workerGroups = new ArrayList<>();
+        List<String> workerGroupList;
+        try {
+            workerGroupList = zookeeperCachedOperator.getChildrenKeys(workerPath);
+        } catch (Exception e) {
+            if (e.getMessage().contains(noNodeExceptionRegex)) {

Review comment:
       I need to deal with two results, which is not easy to deal with。
   
   这块要处理两个结果,抽取方法,不太好处理。




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

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