You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by "calvinjiang (via GitHub)" <gi...@apache.org> on 2023/09/13 01:13:46 UTC

[GitHub] [dolphinscheduler] calvinjiang commented on a diff in pull request #14893: [Improvement][API] Support to check if the worker group has been used by any tasks or schedulers when users delete or rename it.

calvinjiang commented on code in PR #14893:
URL: https://github.com/apache/dolphinscheduler/pull/14893#discussion_r1323809918


##########
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/WorkerGroupServiceImpl.java:
##########
@@ -177,6 +195,52 @@ private boolean checkWorkerGroupNameExists(WorkerGroup workerGroup) {
         return false;
     }
 
+    /**
+     * check if the worker group has any dependent tasks,schedulers or environments.
+     *
+     * @param workerGroup worker group
+     * @return boolean
+     */
+    private boolean checkWorkerGroupDependencies(WorkerGroup workerGroup, Map<String, Object> result) {
+        // check if the worker group has any dependent tasks
+        List<TaskDefinition> taskDefinitions = taskDefinitionMapper.selectList(
+                new QueryWrapper<TaskDefinition>().lambda().eq(TaskDefinition::getWorkerGroup, workerGroup.getName()));
+
+        if (CollectionUtils.isNotEmpty(taskDefinitions)) {
+            List<String> taskNames = taskDefinitions.stream().limit(3).map(taskDefinition -> taskDefinition.getName())

Review Comment:
   Here are just a part of examples to help users understand why they can not remove or rename the work group. If there are a lot of tasks, timings or environments that are dependent on the work group, it's not so good for the tip to display all of those.



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

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

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