Browse Source

[FIX-#4592]Fix that the worker group management IP is not displayed correctly. (#4620)

Co-authored-by: zt-1997 <“18841012545@163.com”>
pull/3/MERGE
zt-1997 4 years ago committed by GitHub
parent
commit
afd201e6fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 109
      ambari_plugin/common-services/DOLPHIN/1.3.3/configuration/dolphin-worker.xml
  2. 12
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/WorkerGroupService.java

109
ambari_plugin/common-services/DOLPHIN/1.3.3/configuration/dolphin-worker.xml

@ -15,53 +15,64 @@
~ limitations under the License. ~ limitations under the License.
--> -->
<configuration> <configuration>
<property> <property>
<name>worker.exec.threads</name> <name>worker.exec.threads</name>
<value>100</value> <value>100</value>
<value-attributes> <value-attributes>
<type>int</type> <type>int</type>
</value-attributes> </value-attributes>
<description>worker execute thread num</description> <description>worker execute thread num</description>
<on-ambari-upgrade add="true"/> <on-ambari-upgrade add="true"/>
</property> </property>
<property> <property>
<name>worker.heartbeat.interval</name> <name>worker.heartbeat.interval</name>
<value>10</value> <value>10</value>
<value-attributes> <value-attributes>
<type>int</type> <type>int</type>
</value-attributes> </value-attributes>
<description>worker heartbeat interval</description> <description>worker heartbeat interval</description>
<on-ambari-upgrade add="true"/> <on-ambari-upgrade add="true"/>
</property> </property>
<property> <property>
<name>worker.max.cpuload.avg</name> <name>worker.max.cpuload.avg</name>
<value>100</value> <value>100</value>
<value-attributes> <value-attributes>
<type>int</type> <type>int</type>
</value-attributes> </value-attributes>
<description>only less than cpu avg load, worker server can work. default value : the number of cpu cores * 2</description> <description>only less than cpu avg load, worker server can work. default value : the number of cpu cores * 2
<on-ambari-upgrade add="true"/> </description>
</property> <on-ambari-upgrade add="true"/>
<property> </property>
<name>worker.reserved.memory</name> <property>
<value>0.3</value> <name>worker.reserved.memory</name>
<description>only larger than reserved memory, worker server can work. default value : physical memory * 1/10, unit is G.</description> <value>0.3</value>
<on-ambari-upgrade add="true"/> <description>only larger than reserved memory, worker server can work. default value : physical memory * 1/10,
</property> unit is G.
</description>
<property> <on-ambari-upgrade add="true"/>
<name>worker.listen.port</name> </property>
<value>1234</value> <property>
<value-attributes> <name>worker.listen.port</name>
<type>int</type> <value>1234</value>
</value-attributes> <value-attributes>
<description>worker listen port</description> <type>int</type>
<on-ambari-upgrade add="true"/> </value-attributes>
</property> <description>worker listen port</description>
<property> <on-ambari-upgrade add="true"/>
<name>worker.groups</name> </property>
<value>default</value> <property>
<description>default worker group</description> <name>worker.groups</name>
<on-ambari-upgrade add="true"/> <value>default</value>
</property> <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> </configuration>

12
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) { for (String workerGroup : workerGroupList) {
String workerGroupPath = workerPath + "/" + workerGroup; String workerGroupPath = workerPath + "/" + workerGroup;
List<String> childrenNodes = zookeeperCachedOperator.getChildrenKeys(workerGroupPath); 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)) { if (CollectionUtils.isNotEmpty(childrenNodes)) {
availableWorkerGroupList.add(workerGroup);
WorkerGroup wg = new WorkerGroup(); WorkerGroup wg = new WorkerGroup();
wg.setName(workerGroup); wg.setName(workerGroup);
if (isPaging) { if (isPaging) {
wg.setIpList(childrenNodes); 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.setCreateTime(DateUtils.stringToDate(registeredIpValue.split(",")[6]));
wg.setUpdateTime(DateUtils.stringToDate(registeredIpValue.split(",")[7])); wg.setUpdateTime(DateUtils.stringToDate(registeredIpValue.split(",")[7]));
} }

Loading…
Cancel
Save