This is an automated email from the ASF dual-hosted git repository.

kirs pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-dolphinscheduler.git


The following commit(s) were added to refs/heads/dev by this push:
     new afd201e  [FIX-#4592]Fix that the worker group management IP is not 
displayed correctly. (#4620)
afd201e is described below

commit afd201e6fa50700cf16aad2a292e61c4e5b6e5f9
Author: zt-1997 <[email protected]>
AuthorDate: Fri Jan 29 16:54:39 2021 +0800

    [FIX-#4592]Fix that the worker group management IP is not displayed 
correctly. (#4620)
    
    
    
    Co-authored-by: zt-1997 <“[email protected]”>
---
 .../DOLPHIN/1.3.3/configuration/dolphin-worker.xml | 109 ++++++++++++---------
 .../api/service/WorkerGroupService.java            |  12 ++-
 2 files changed, 67 insertions(+), 54 deletions(-)

diff --git 
a/ambari_plugin/common-services/DOLPHIN/1.3.3/configuration/dolphin-worker.xml 
b/ambari_plugin/common-services/DOLPHIN/1.3.3/configuration/dolphin-worker.xml
index 1ae7a1a..e5a3adf 100644
--- 
a/ambari_plugin/common-services/DOLPHIN/1.3.3/configuration/dolphin-worker.xml
+++ 
b/ambari_plugin/common-services/DOLPHIN/1.3.3/configuration/dolphin-worker.xml
@@ -15,53 +15,64 @@
   ~ limitations under the License.
   -->
 <configuration>
-       <property>
-               <name>worker.exec.threads</name>
-               <value>100</value>
-               <value-attributes>
-                       <type>int</type>
-               </value-attributes>
-               <description>worker execute thread num</description>
-               <on-ambari-upgrade add="true"/>
-       </property>
-       <property>
-               <name>worker.heartbeat.interval</name>
-               <value>10</value>
-               <value-attributes>
-                       <type>int</type>
-               </value-attributes>
-               <description>worker heartbeat interval</description>
-               <on-ambari-upgrade add="true"/>
-       </property>
-       <property>
-               <name>worker.max.cpuload.avg</name>
-               <value>100</value>
-               <value-attributes>
-                       <type>int</type>
-               </value-attributes>
-               <description>only less than cpu avg load, worker server can 
work. default value : the number of cpu cores * 2</description>
-               <on-ambari-upgrade add="true"/>
-       </property>
-       <property>
-               <name>worker.reserved.memory</name>
-               <value>0.3</value>
-               <description>only larger than reserved memory, worker server 
can work. default value : physical memory * 1/10, unit is G.</description>
-               <on-ambari-upgrade add="true"/>
-       </property>
-
-       <property>
-               <name>worker.listen.port</name>
-               <value>1234</value>
-               <value-attributes>
-                       <type>int</type>
-               </value-attributes>
-               <description>worker listen port</description>
-               <on-ambari-upgrade add="true"/>
-       </property>
-       <property>
-               <name>worker.groups</name>
-               <value>default</value>
-               <description>default worker group</description>
-               <on-ambari-upgrade add="true"/>
-       </property>
+    <property>
+        <name>worker.exec.threads</name>
+        <value>100</value>
+        <value-attributes>
+            <type>int</type>
+        </value-attributes>
+        <description>worker execute thread num</description>
+        <on-ambari-upgrade add="true"/>
+    </property>
+    <property>
+        <name>worker.heartbeat.interval</name>
+        <value>10</value>
+        <value-attributes>
+            <type>int</type>
+        </value-attributes>
+        <description>worker heartbeat interval</description>
+        <on-ambari-upgrade add="true"/>
+    </property>
+    <property>
+        <name>worker.max.cpuload.avg</name>
+        <value>100</value>
+        <value-attributes>
+            <type>int</type>
+        </value-attributes>
+        <description>only less than cpu avg load, worker server can work. 
default value : the number of cpu cores * 2
+        </description>
+        <on-ambari-upgrade add="true"/>
+    </property>
+    <property>
+        <name>worker.reserved.memory</name>
+        <value>0.3</value>
+        <description>only larger than reserved memory, worker server can work. 
default value : physical memory * 1/10,
+            unit is G.
+        </description>
+        <on-ambari-upgrade add="true"/>
+    </property>
+    <property>
+        <name>worker.listen.port</name>
+        <value>1234</value>
+        <value-attributes>
+            <type>int</type>
+        </value-attributes>
+        <description>worker listen port</description>
+        <on-ambari-upgrade add="true"/>
+    </property>
+    <property>
+        <name>worker.groups</name>
+        <value>default</value>
+        <description>default worker group</description>
+        <on-ambari-upgrade add="true"/>
+    </property>
+    <property>
+        <name>worker.weigth</name>
+        <value>100</value>
+        <value-attributes>
+            <type>int</type>
+        </value-attributes>
+        <description>worker weight</description>
+        <on-ambari-upgrade add="true"/>
+    </property>
 </configuration>
\ No newline at end of file
diff --git 
a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/WorkerGroupService.java
 
b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/WorkerGroupService.java
index 83cbd19..1c634a9 100644
--- 
a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/WorkerGroupService.java
+++ 
b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/WorkerGroupService.java
@@ -153,19 +153,21 @@ public class WorkerGroupService extends BaseService {
             }
         }
 
-        // available workerGroup list
-        List<String> availableWorkerGroupList = new ArrayList<>();
-
         for (String workerGroup : workerGroupList) {
             String workerGroupPath = workerPath + "/" + workerGroup;
             List<String> childrenNodes = 
zookeeperCachedOperator.getChildrenKeys(workerGroupPath);
+            String timeStamp = "";
+            for (int i = 0; i < childrenNodes.size(); i++) {
+                String ip = childrenNodes.get(i);
+                childrenNodes.set(i, ip.substring(0, ip.lastIndexOf(":")));
+                timeStamp = ip.substring(ip.lastIndexOf(":"));
+            }
             if (CollectionUtils.isNotEmpty(childrenNodes)) {
-                availableWorkerGroupList.add(workerGroup);
                 WorkerGroup wg = new WorkerGroup();
                 wg.setName(workerGroup);
                 if (isPaging) {
                     wg.setIpList(childrenNodes);
-                    String registeredIpValue = 
zookeeperCachedOperator.get(workerGroupPath + "/" + childrenNodes.get(0));
+                    String registeredIpValue = 
zookeeperCachedOperator.get(workerGroupPath + "/" + childrenNodes.get(0) + 
timeStamp);
                     
wg.setCreateTime(DateUtils.stringToDate(registeredIpValue.split(",")[6]));
                     
wg.setUpdateTime(DateUtils.stringToDate(registeredIpValue.split(",")[7]));
                 }

Reply via email to