Browse Source

cherry-pick [Fix-13828][api] Fix the problem of work groups have two defult records #13829

3.1.6-release
ralphgj 2 years ago committed by zhuangchong
parent
commit
7e134b24ef
  1. 7
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/WorkerGroupServiceImpl.java

7
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/WorkerGroupServiceImpl.java

@ -279,10 +279,9 @@ public class WorkerGroupServiceImpl extends BaseServiceImpl implements WorkerGro
} else {
workerGroups = workerGroupMapper.queryAllWorkerGroup();
}
Optional<Boolean> containDefaultWorkerGroups = workerGroups.stream()
.map(workerGroup -> Constants.DEFAULT_WORKER_GROUP.equals(workerGroup.getName())).findAny();
if (!containDefaultWorkerGroups.isPresent() || !containDefaultWorkerGroups.get()) {
boolean containDefaultWorkerGroups = workerGroups.stream()
.anyMatch(workerGroup -> Constants.DEFAULT_WORKER_GROUP.equals(workerGroup.getName()));
if (!containDefaultWorkerGroups) {
// there doesn't exist a default WorkerGroup, we will add all worker to the default worker group.
Set<String> activeWorkerNodes = registryClient.getServerNodeSet(NodeType.WORKER);
WorkerGroup defaultWorkerGroup = new WorkerGroup();

Loading…
Cancel
Save