From afd201e6fa50700cf16aad2a292e61c4e5b6e5f9 Mon Sep 17 00:00:00 2001
From: zt-1997 <41983395+zt-1997@users.noreply.github.com>
Date: Fri, 29 Jan 2021 16:54:39 +0800
Subject: [PATCH] [FIX-#4592]Fix that the worker group management IP is not
displayed correctly. (#4620)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Co-authored-by: zt-1997 <“18841012545@163.com”>
---
.../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 1ae7a1a765..e5a3adf9f6 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.
-->
-
- worker.exec.threads
- 100
-
- int
-
- worker execute thread num
-
-
-
- worker.heartbeat.interval
- 10
-
- int
-
- worker heartbeat interval
-
-
-
- worker.max.cpuload.avg
- 100
-
- int
-
- only less than cpu avg load, worker server can work. default value : the number of cpu cores * 2
-
-
-
- worker.reserved.memory
- 0.3
- only larger than reserved memory, worker server can work. default value : physical memory * 1/10, unit is G.
-
-
-
-
- worker.listen.port
- 1234
-
- int
-
- worker listen port
-
-
-
- worker.groups
- default
- default worker group
-
-
+
+ worker.exec.threads
+ 100
+
+ int
+
+ worker execute thread num
+
+
+
+ worker.heartbeat.interval
+ 10
+
+ int
+
+ worker heartbeat interval
+
+
+
+ worker.max.cpuload.avg
+ 100
+
+ int
+
+ only less than cpu avg load, worker server can work. default value : the number of cpu cores * 2
+
+
+
+
+ worker.reserved.memory
+ 0.3
+ only larger than reserved memory, worker server can work. default value : physical memory * 1/10,
+ unit is G.
+
+
+
+
+ worker.listen.port
+ 1234
+
+ int
+
+ worker listen port
+
+
+
+ worker.groups
+ default
+ default worker group
+
+
+
+ worker.weigth
+ 100
+
+ int
+
+ worker weight
+
+
\ 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 83cbd197cd..1c634a9cd2 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 availableWorkerGroupList = new ArrayList<>();
-
for (String workerGroup : workerGroupList) {
String workerGroupPath = workerPath + "/" + workerGroup;
List 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]));
}