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/11 09:22:26 UTC
[GitHub] [dolphinscheduler] calvinjiang opened a new 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 opened a new pull request, #14893:
URL: https://github.com/apache/dolphinscheduler/pull/14893
<!--Thanks very much for contributing to Apache DolphinScheduler, we are happy that you want to help us improve DolphinScheduler! -->
## Purpose of the pull request
This PR will close #14864 .
<!--(For example: This pull request adds checkstyle plugin).-->
## Brief change log
## Verify this pull request
This change added tests and can be verified as follows:
- *Manually verified the change by testing locally.*
The test results are as follows:


--
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
[GitHub] [dolphinscheduler] zhuangchong 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.
Posted by "zhuangchong (via GitHub)" <gi...@apache.org>.
zhuangchong commented on code in PR #14893:
URL: https://github.com/apache/dolphinscheduler/pull/14893#discussion_r1323804794
##########
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())
+ .collect(Collectors.toList());
+
+ putMsg(result, Status.WORKER_GROUP_DEPENDENT_TASK_EXISTS, taskDefinitions.size(),
+ JSONUtils.toJsonString(taskNames));
+ return true;
+ }
+
+ // check if the worker group has any dependent schedulers
+ List<Schedule> schedules = scheduleMapper
+ .selectList(new QueryWrapper<Schedule>().lambda().eq(Schedule::getWorkerGroup, workerGroup.getName()));
+
+ if (CollectionUtils.isNotEmpty(schedules)) {
+ List<String> processNames = schedules.stream().limit(3)
+ .map(schedule -> processDefinitionMapper.queryByCode(schedule.getProcessDefinitionCode()).getName())
+ .collect(Collectors.toList());
+
+ putMsg(result, Status.WORKER_GROUP_DEPENDENT_SCHEDULER_EXISTS, schedules.size(), processNames);
Review Comment:
processNames? The above taskNames use JSON serialization, please choose a method and keep it consistent.
--
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
[GitHub] [dolphinscheduler] sonarcloud[bot] commented on 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.
Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #14893:
URL: https://github.com/apache/dolphinscheduler/pull/14893#issuecomment-1715473047
SonarCloud Quality Gate failed. [](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=14893)
[](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=14893&resolved=false&types=BUG) [](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=14893&resolved=false&types=BUG) [5 Bugs](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=14893&resolved=false&types=BUG)
[](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=14893&resolved=false&types=VULNERABILITY) [](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=14893&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=14893&resolved=false&types=VULNERABILITY)
[](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=14893&resolved=false&types=SECURITY_HOTSPOT) [](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=14893&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=14893&resolved=false&types=SECURITY_HOTSPOT)
[](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=14893&resolved=false&types=CODE_SMELL) [](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=14893&resolved=false&types=CODE_SMELL) [73 Code Smells](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=14893&resolved=false&types=CODE_SMELL)
[](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=14893&metric=new_coverage&view=list) [24.4% Coverage](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=14893&metric=new_coverage&view=list)
[](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=14893&metric=new_duplicated_lines_density&view=list) [1.1% Duplication](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=14893&metric=new_duplicated_lines_density&view=list)
 Catch issues before they fail your Quality Gate with our IDE extension  [SonarLint](https://www.sonarsource.com/products/sonarlint/features/connected-mode/?referrer=sonarcloud-welcome)
--
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
[GitHub] [dolphinscheduler] zhuangchong 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.
Posted by "zhuangchong (via GitHub)" <gi...@apache.org>.
zhuangchong commented on code in PR #14893:
URL: https://github.com/apache/dolphinscheduler/pull/14893#discussion_r1323804140
##########
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()));
Review Comment:
Should we add task online status conditions?
--
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
[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.
Posted by "calvinjiang (via GitHub)" <gi...@apache.org>.
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
Re: [PR] [Improvement][API] Support to check if the worker group has been used by any tasks or schedulers when users delete or rename it. [dolphinscheduler]
Posted by "xjlgod (via GitHub)" <gi...@apache.org>.
xjlgod commented on PR #14893:
URL: https://github.com/apache/dolphinscheduler/pull/14893#issuecomment-1752024190
I see SonarCloud check and OWASP did not pass. Should I add more unit test? I think OWASP is not about my pr.
--
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
[GitHub] [dolphinscheduler] sonarcloud[bot] commented on 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.
Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #14893:
URL: https://github.com/apache/dolphinscheduler/pull/14893#issuecomment-1716850912
SonarCloud Quality Gate failed. [](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=14893)
[](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=14893&resolved=false&types=BUG) [](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=14893&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=14893&resolved=false&types=BUG)
[](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=14893&resolved=false&types=VULNERABILITY) [](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=14893&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=14893&resolved=false&types=VULNERABILITY)
[](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=14893&resolved=false&types=SECURITY_HOTSPOT) [](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=14893&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=14893&resolved=false&types=SECURITY_HOTSPOT)
[](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=14893&resolved=false&types=CODE_SMELL) [](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=14893&resolved=false&types=CODE_SMELL) [2 Code Smells](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=14893&resolved=false&types=CODE_SMELL)
[](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=14893&metric=new_coverage&view=list) [46.7% Coverage](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=14893&metric=new_coverage&view=list)
[](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=14893&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=14893&metric=new_duplicated_lines_density&view=list)
 Catch issues before they fail your Quality Gate with our IDE extension  [SonarLint](https://www.sonarsource.com/products/sonarlint/features/connected-mode/?referrer=sonarcloud-welcome)
--
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
[GitHub] [dolphinscheduler] sonarcloud[bot] commented on 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.
Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #14893:
URL: https://github.com/apache/dolphinscheduler/pull/14893#issuecomment-1716849960
SonarCloud Quality Gate failed. [](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=14893)
[](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=14893&resolved=false&types=BUG) [](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=14893&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=14893&resolved=false&types=BUG)
[](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=14893&resolved=false&types=VULNERABILITY) [](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=14893&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=14893&resolved=false&types=VULNERABILITY)
[](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=14893&resolved=false&types=SECURITY_HOTSPOT) [](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=14893&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=14893&resolved=false&types=SECURITY_HOTSPOT)
[](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=14893&resolved=false&types=CODE_SMELL) [](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=14893&resolved=false&types=CODE_SMELL) [2 Code Smells](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=14893&resolved=false&types=CODE_SMELL)
[](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=14893&metric=new_coverage&view=list) [46.7% Coverage](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=14893&metric=new_coverage&view=list)
[](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=14893&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=14893&metric=new_duplicated_lines_density&view=list)
 Catch issues before they fail your Quality Gate with our IDE extension  [SonarLint](https://www.sonarsource.com/products/sonarlint/features/connected-mode/?referrer=sonarcloud-welcome)
--
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
[GitHub] [dolphinscheduler] sonarcloud[bot] commented on 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.
Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #14893:
URL: https://github.com/apache/dolphinscheduler/pull/14893#issuecomment-1715465652
SonarCloud Quality Gate failed. [](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=14893)
[](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=14893&resolved=false&types=BUG) [](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=14893&resolved=false&types=BUG) [5 Bugs](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=14893&resolved=false&types=BUG)
[](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=14893&resolved=false&types=VULNERABILITY) [](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=14893&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=14893&resolved=false&types=VULNERABILITY)
[](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=14893&resolved=false&types=SECURITY_HOTSPOT) [](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=14893&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=14893&resolved=false&types=SECURITY_HOTSPOT)
[](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=14893&resolved=false&types=CODE_SMELL) [](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=14893&resolved=false&types=CODE_SMELL) [73 Code Smells](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=14893&resolved=false&types=CODE_SMELL)
[](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=14893&metric=new_coverage&view=list) [24.4% Coverage](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=14893&metric=new_coverage&view=list)
[](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=14893&metric=new_duplicated_lines_density&view=list) [1.1% Duplication](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=14893&metric=new_duplicated_lines_density&view=list)
 Catch issues before they fail your Quality Gate with our IDE extension  [SonarLint](https://www.sonarsource.com/products/sonarlint/features/connected-mode/?referrer=sonarcloud-welcome)
--
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
[GitHub] [dolphinscheduler] zhuangchong 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.
Posted by "zhuangchong (via GitHub)" <gi...@apache.org>.
zhuangchong commented on code in PR #14893:
URL: https://github.com/apache/dolphinscheduler/pull/14893#discussion_r1323803085
##########
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:
Only fetch 3 records?
--
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
[GitHub] [dolphinscheduler] codecov-commenter commented on 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.
Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #14893:
URL: https://github.com/apache/dolphinscheduler/pull/14893#issuecomment-1715452123
## [Codecov](https://app.codecov.io/gh/apache/dolphinscheduler/pull/14893?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
> Merging [#14893](https://app.codecov.io/gh/apache/dolphinscheduler/pull/14893?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) (910538b) into [dev](https://app.codecov.io/gh/apache/dolphinscheduler/commit/121c981a5d28e82d10f74427d3cbf5e4b100d29a?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) (121c981) will **decrease** coverage by `0.05%`.
> The diff coverage is `36.66%`.
> :exclamation: Current head 910538b differs from pull request most recent head 55ecf6a. Consider uploading reports for the commit 55ecf6a to get more accurate results
```diff
@@ Coverage Diff @@
## dev #14893 +/- ##
============================================
- Coverage 38.82% 38.78% -0.05%
+ Complexity 4588 4585 -3
============================================
Files 1232 1232
Lines 43318 43283 -35
Branches 4783 4771 -12
============================================
- Hits 16820 16789 -31
+ Misses 24639 24632 -7
- Partials 1859 1862 +3
```
| [Files Changed](https://app.codecov.io/gh/apache/dolphinscheduler/pull/14893?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [...duler/api/service/impl/WorkerGroupServiceImpl.java](https://app.codecov.io/gh/apache/dolphinscheduler/pull/14893?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-ZG9scGhpbnNjaGVkdWxlci1hcGkvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2RvbHBoaW5zY2hlZHVsZXIvYXBpL3NlcnZpY2UvaW1wbC9Xb3JrZXJHcm91cFNlcnZpY2VJbXBsLmphdmE=) | `75.13% <29.62%> (-6.74%)` | :arrow_down: |
| [.../org/apache/dolphinscheduler/api/enums/Status.java](https://app.codecov.io/gh/apache/dolphinscheduler/pull/14893?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-ZG9scGhpbnNjaGVkdWxlci1hcGkvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2RvbHBoaW5zY2hlZHVsZXIvYXBpL2VudW1zL1N0YXR1cy5qYXZh) | `100.00% <100.00%> (ø)` | |
... and [49 files with indirect coverage changes](https://app.codecov.io/gh/apache/dolphinscheduler/pull/14893/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
:mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
--
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
[GitHub] [dolphinscheduler] sonarcloud[bot] commented on 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.
Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #14893:
URL: https://github.com/apache/dolphinscheduler/pull/14893#issuecomment-1716818175
SonarCloud Quality Gate failed. [](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=14893)
[](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=14893&resolved=false&types=BUG) [](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=14893&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=14893&resolved=false&types=BUG)
[](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=14893&resolved=false&types=VULNERABILITY) [](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=14893&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=14893&resolved=false&types=VULNERABILITY)
[](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=14893&resolved=false&types=SECURITY_HOTSPOT) [](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=14893&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=14893&resolved=false&types=SECURITY_HOTSPOT)
[](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=14893&resolved=false&types=CODE_SMELL) [](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=14893&resolved=false&types=CODE_SMELL) [2 Code Smells](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=14893&resolved=false&types=CODE_SMELL)
[](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=14893&metric=new_coverage&view=list) [46.7% Coverage](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=14893&metric=new_coverage&view=list)
[](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=14893&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=14893&metric=new_duplicated_lines_density&view=list)
 Catch issues before they fail your Quality Gate with our IDE extension  [SonarLint](https://www.sonarsource.com/products/sonarlint/features/connected-mode/?referrer=sonarcloud-welcome)
--
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
[GitHub] [dolphinscheduler] zhuangchong merged 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.
Posted by "zhuangchong (via GitHub)" <gi...@apache.org>.
zhuangchong merged PR #14893:
URL: https://github.com/apache/dolphinscheduler/pull/14893
--
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
[GitHub] [dolphinscheduler] zhuangchong 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.
Posted by "zhuangchong (via GitHub)" <gi...@apache.org>.
zhuangchong commented on code in PR #14893:
URL: https://github.com/apache/dolphinscheduler/pull/14893#discussion_r1323804240
##########
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())
+ .collect(Collectors.toList());
+
+ putMsg(result, Status.WORKER_GROUP_DEPENDENT_TASK_EXISTS, taskDefinitions.size(),
+ JSONUtils.toJsonString(taskNames));
+ return true;
+ }
+
+ // check if the worker group has any dependent schedulers
+ List<Schedule> schedules = scheduleMapper
+ .selectList(new QueryWrapper<Schedule>().lambda().eq(Schedule::getWorkerGroup, workerGroup.getName()));
Review Comment:
Should we add schedule online status conditions?
--
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