Radeity commented on code in PR #13721:
URL:
https://github.com/apache/dolphinscheduler/pull/13721#discussion_r1132006368
##########
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java:
##########
@@ -491,87 +470,6 @@ public Result<Object> updateResource(User loginUser,
return result;
}
- List<ResourcesTask> existResourcesList;
- if (resource.isDirectory()) {
- existResourcesList =
resourceTaskMapper.selectSubfoldersFullNames(originFullName + FOLDER_SEPARATOR);
- } else {
- existResourcesList = resourceTaskMapper.selectByMap(
- Collections.singletonMap("full_name", originFullName));
- }
-
- if (existResourcesList.size() > 0 && !fullName.equals(originFullName))
{
- // check if any related task is online. If it is, it can not be
updated.
- for (ResourcesTask existResource : existResourcesList) {
- int taskId = existResource.getTaskId();
- if
(processService.isTaskOnline(taskDefinitionMapper.selectById(taskId).getCode()))
{
- log.error("can't be updated,because it is used of process
definition that's online");
- log.error("resource task relation id:{} is used of task
code {}", existResource.getId(),
- taskDefinitionMapper.selectById(taskId).getCode());
- putMsg(result, Status.RESOURCE_IS_USED);
- return result;
- }
- }
-
- for (ResourcesTask existResource : existResourcesList) {
- int taskId = existResource.getTaskId();
- long taskCode =
taskDefinitionMapper.selectById(taskId).getCode();
-
- List<ProcessTaskRelation> processTaskRelation =
processTaskRelationMapper.selectByMap(
- Collections.singletonMap("post_task_code", taskCode));
- if (processTaskRelation.size() > 0) {
- long processDefinitionCode =
processTaskRelation.get(0).getProcessDefinitionCode();
- int processDefinitionVersion =
processTaskRelation.get(0).getProcessDefinitionVersion();
- List<ProcessTaskRelation> taskRelationList =
processTaskRelationMapper.queryByProcessCode(
- processTaskRelation.get(0).getProjectCode(),
- processDefinitionCode);
-
- List<TaskDefinition> taskDefinitionLogList = new
ArrayList<>();
-
- if (taskRelationList.size() > 0) {
- ProcessDefinitionLog processDefinition =
-
processDefinitionLogMapper.queryByDefinitionCodeAndVersion(
- processDefinitionCode,
processDefinitionVersion);
- for (ProcessTaskRelation taskRelation :
taskRelationList) {
- long taskCodeInProcess =
taskRelation.getPostTaskCode();
- TaskDefinition taskDefinition =
taskDefinitionMapper.queryByCode(taskCodeInProcess);
- if (taskCodeInProcess == taskCode) {
- // originFullName is a prefix if isDirectory
is true
-
taskDefinition.setTaskParams(RemoveResourceFromResourceList(originFullName,
- taskDefinition.getTaskParams(),
- resource.isDirectory()));
- // if isDirectory is true, fullName is the new
prefix. we replace old prefix
- // of resource fullname with the new prefix.
- // if isDirectory is false, fullName is the
new path.
-
taskDefinition.setTaskParams(AddResourceToResourceList(originFullName,
- fullName,
- existResource.getFullName(),
- taskDefinition.getTaskParams(),
- resource.isDirectory()));
- }
- taskDefinitionLogList.add(taskDefinition);
- }
-
- // update workflow & task definition associated to the
resource
Review Comment:
**MORE EXPLANATION:** We should better not update relative task params info
in resource management (when deleting resource), so these part codes are
useless in my view.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]