|
@@ -28,11 +28,13 @@ import org.apache.dolphinscheduler.common.constants.Constants;
|
|
|
import org.apache.dolphinscheduler.common.enums.AuthorizationType;
|
|
|
import org.apache.dolphinscheduler.common.enums.NodeType;
|
|
|
import org.apache.dolphinscheduler.common.enums.UserType;
|
|
|
+import org.apache.dolphinscheduler.dao.entity.EnvironmentWorkerGroupRelation;
|
|
|
import org.apache.dolphinscheduler.dao.entity.ProcessInstance;
|
|
|
import org.apache.dolphinscheduler.dao.entity.Schedule;
|
|
|
import org.apache.dolphinscheduler.dao.entity.TaskInstance;
|
|
|
import org.apache.dolphinscheduler.dao.entity.User;
|
|
|
import org.apache.dolphinscheduler.dao.entity.WorkerGroup;
|
|
|
+import org.apache.dolphinscheduler.dao.mapper.EnvironmentWorkerGroupRelationMapper;
|
|
|
import org.apache.dolphinscheduler.dao.mapper.ProcessInstanceMapper;
|
|
|
import org.apache.dolphinscheduler.dao.mapper.ScheduleMapper;
|
|
|
import org.apache.dolphinscheduler.dao.mapper.WorkerGroupMapper;
|
|
@@ -78,6 +80,9 @@ public class WorkerGroupServiceImpl extends BaseServiceImpl implements WorkerGro
|
|
|
@Autowired
|
|
|
private RegistryClient registryClient;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private EnvironmentWorkerGroupRelationMapper environmentWorkerGroupRelationMapper;
|
|
|
+
|
|
|
@Autowired
|
|
|
private ProcessService processService;
|
|
|
|
|
@@ -343,6 +348,13 @@ public class WorkerGroupServiceImpl extends BaseServiceImpl implements WorkerGro
|
|
|
putMsg(result, Status.DELETE_WORKER_GROUP_BY_ID_FAIL, processInstances.size());
|
|
|
return result;
|
|
|
}
|
|
|
+ List<EnvironmentWorkerGroupRelation> environmentWorkerGroupRelationList =
|
|
|
+ environmentWorkerGroupRelationMapper.queryByWorkerGroupName(workerGroup.getName());
|
|
|
+ if (CollectionUtils.isNotEmpty(environmentWorkerGroupRelationList)) {
|
|
|
+ putMsg(result, Status.DELETE_WORKER_GROUP_BY_ID_FAIL_ENV, environmentWorkerGroupRelationList.size(),
|
|
|
+ workerGroup.getName());
|
|
|
+ return result;
|
|
|
+ }
|
|
|
workerGroupMapper.deleteById(id);
|
|
|
processInstanceMapper.updateProcessInstanceByWorkerGroupName(workerGroup.getName(), "");
|
|
|
logger.info("Delete worker group complete, workerGroupName:{}.", workerGroup.getName());
|