You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by GitBox <gi...@apache.org> on 2021/02/15 19:23:47 UTC

[GitHub] [incubator-dolphinscheduler] IamMujuziMoses opened a new pull request #4778: [Feature][API][backend] Query all upstream and downstream dependencies of the task

IamMujuziMoses opened a new pull request #4778:
URL: https://github.com/apache/incubator-dolphinscheduler/pull/4778


   ## What is the purpose of the pull request
   
   - [x] Upstream Dependency
   - [x] Downstream Dependency
   - [ ] Upstream and Downstream dependency
   
   ## Brief change log
   
   *ProcessDefinitionController.java*
   *ProcessDefinitionService.java*
   *ProcessDefinitionServiceImpl.java*
     - *Added method `queryUpstreamTaskDependencies`*
     - *Added method `queryDownstreamTaskDependencies`*
   
   *ProcessDefinitionControllerTest.java*
   *ProcessDefinitionServiceTest.java*
    - *Added method `testQueryUpstreamTaskDependencies`*
    - *Added method `testQueryDownstreamTaskDependencies`*
   
   *DependentParameters.java*
   *DependentItem.java*
   *DependentTaskModel.java*
    - *Added `toString()` method*
   
   *Status.java*
    - *Added `QUERY_TASK_DEPENDENCIES_BY_TASK_NAME_ERROR`*


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

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



[GitHub] [incubator-dolphinscheduler] IamMujuziMoses commented on pull request #4778: [Feature][API][backend] Query all upstream and downstream dependencies of the task

Posted by GitBox <gi...@apache.org>.
IamMujuziMoses commented on pull request #4778:
URL: https://github.com/apache/incubator-dolphinscheduler/pull/4778#issuecomment-786593919


   @lgcareer I have been parsing the `dependence` field to get the downstream dependencies but I have failed to locate `shell_02` or the equivalent information from the dependence field, where is that information stored?!
   <sub>[View in Slack](https://the-asf.slack.com/archives/G01L7J4ST2Q/p1614339260004900)</sub>


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

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



[GitHub] [incubator-dolphinscheduler] lgcareer commented on a change in pull request #4778: [Feature][API][backend] Query all upstream and downstream dependencies of the task

Posted by GitBox <gi...@apache.org>.
lgcareer commented on a change in pull request #4778:
URL: https://github.com/apache/incubator-dolphinscheduler/pull/4778#discussion_r578171072



##########
File path: dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
##########
@@ -1797,5 +1800,94 @@ private void checkBatchOperateResult(String srcProjectName, String targetProject
         }
     }
 
+    public Map<String, Object> queryUpstreamTaskDependencies(Integer processId, String taskName) {
+        Map<String, Object> result = new HashMap<>();
+        List<String> depList = new ArrayList<>();
+
+        ProcessDefinition processDefinition = processDefineMapper.selectById(processId);
+        if (processDefinition == null) {
+            logger.info("Upstream dependencies process define not exists");
+            putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, processId);
+            return result;
+        }
+
+        String processDefinitionJson = processDefinition.getProcessDefinitionJson();
+
+        ProcessData processData = JSONUtils.parseObject(processDefinitionJson, ProcessData.class);
+
+        //process data check
+        if (null == processData) {
+            logger.error("Upstream dependencies process data is null");
+            putMsg(result, Status.DATA_IS_NOT_VALID, processDefinitionJson);
+            return result;
+        }
+
+        List<TaskNode> taskNodeList = (processData.getTasks() == null) ? new ArrayList<>() : processData.getTasks();
+
+        for (TaskNode taskNode : taskNodeList) {
+            if (taskNode.getName().equals(taskName)) {
+                //getPreTasks() holds inner dependency information
+                depList.add(taskNode.getPreTasks());
+            }
+
+        }
+

Review comment:
       Hi,if the pretasks contains dependence task,you should parse the dependene json.




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

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



[GitHub] [incubator-dolphinscheduler] sonarcloud[bot] commented on pull request #4778: [Feature][API][backend] Query all upstream and downstream dependencies of the task

Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] commented on pull request #4778:
URL: https://github.com/apache/incubator-dolphinscheduler/pull/4778#issuecomment-787102627


   SonarCloud Quality Gate failed.
   
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug.png' alt='Bug' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=4778&resolved=false&types=BUG) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=4778&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=4778&resolved=false&types=BUG)  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability.png' alt='Vulnerability' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=4778&resolved=false&types=VULNERABILITY) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/B.png' alt='B' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=4778&resolved=false&types=VULNERABILITY) [2 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=4778&resolved=false&types=VULNERABILITY)  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot.png' alt='Security Hotspot' width='16' height='16' />](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=4778&resolved=false&types=SECURITY_HOTSPOT) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=4778&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=4778&resolved=false&types=SECURITY_HOTSPOT)  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell.png' alt='Code Smell' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=4778&resolved=false&types=CODE_SMELL) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=4778&resolved=false&types=CODE_SMELL) [5 Code Smells](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=4778&resolved=false&types=CODE_SMELL)
   
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/60.png' alt='78.7%' width='16' height='16' />](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=4778&metric=new_coverage&view=list) [78.7% Coverage](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=4778&metric=new_coverage&view=list)  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/20.png' alt='11.9%' width='16' height='16' />](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=4778&metric=new_duplicated_lines_density&view=list) [11.9% Duplication](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=4778&metric=new_duplicated_lines_density&view=list)
   
   


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

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



[GitHub] [incubator-dolphinscheduler] sonarcloud[bot] removed a comment on pull request #4778: [Feature][API][backend] Query all upstream and downstream dependencies of the task

Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] removed a comment on pull request #4778:
URL: https://github.com/apache/incubator-dolphinscheduler/pull/4778#issuecomment-787118406


   SonarCloud Quality Gate failed.
   
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug.png' alt='Bug' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=4778&resolved=false&types=BUG) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=4778&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=4778&resolved=false&types=BUG)  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability.png' alt='Vulnerability' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=4778&resolved=false&types=VULNERABILITY) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/B.png' alt='B' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=4778&resolved=false&types=VULNERABILITY) [2 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=4778&resolved=false&types=VULNERABILITY)  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot.png' alt='Security Hotspot' width='16' height='16' />](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=4778&resolved=false&types=SECURITY_HOTSPOT) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=4778&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=4778&resolved=false&types=SECURITY_HOTSPOT)  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell.png' alt='Code Smell' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=4778&resolved=false&types=CODE_SMELL) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=4778&resolved=false&types=CODE_SMELL) [5 Code Smells](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=4778&resolved=false&types=CODE_SMELL)
   
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/60.png' alt='82.9%' width='16' height='16' />](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=4778&metric=new_coverage&view=list) [82.9% Coverage](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=4778&metric=new_coverage&view=list)  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/10.png' alt='9.3%' width='16' height='16' />](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=4778&metric=new_duplicated_lines_density&view=list) [9.3% Duplication](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=4778&metric=new_duplicated_lines_density&view=list)
   
   


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

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



[GitHub] [incubator-dolphinscheduler] sonarcloud[bot] commented on pull request #4778: [Feature][API][backend] Query all upstream and downstream dependencies of the task

Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] commented on pull request #4778:
URL: https://github.com/apache/incubator-dolphinscheduler/pull/4778#issuecomment-787118406


   SonarCloud Quality Gate failed.
   
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug.png' alt='Bug' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=4778&resolved=false&types=BUG) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=4778&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=4778&resolved=false&types=BUG)  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability.png' alt='Vulnerability' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=4778&resolved=false&types=VULNERABILITY) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/B.png' alt='B' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=4778&resolved=false&types=VULNERABILITY) [2 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=4778&resolved=false&types=VULNERABILITY)  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot.png' alt='Security Hotspot' width='16' height='16' />](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=4778&resolved=false&types=SECURITY_HOTSPOT) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=4778&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=4778&resolved=false&types=SECURITY_HOTSPOT)  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell.png' alt='Code Smell' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=4778&resolved=false&types=CODE_SMELL) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=4778&resolved=false&types=CODE_SMELL) [5 Code Smells](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=4778&resolved=false&types=CODE_SMELL)
   
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/60.png' alt='82.9%' width='16' height='16' />](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=4778&metric=new_coverage&view=list) [82.9% Coverage](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=4778&metric=new_coverage&view=list)  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/10.png' alt='9.3%' width='16' height='16' />](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=4778&metric=new_duplicated_lines_density&view=list) [9.3% Duplication](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=4778&metric=new_duplicated_lines_density&view=list)
   
   


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

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



[GitHub] [incubator-dolphinscheduler] sonarcloud[bot] commented on pull request #4778: [Feature][API][backend] Query all upstream and downstream dependencies of the task

Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] commented on pull request #4778:
URL: https://github.com/apache/incubator-dolphinscheduler/pull/4778#issuecomment-791352560


   SonarCloud Quality Gate failed.
   
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug.png' alt='Bug' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=4778&resolved=false&types=BUG) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=4778&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=4778&resolved=false&types=BUG)  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability.png' alt='Vulnerability' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=4778&resolved=false&types=VULNERABILITY) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/B.png' alt='B' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=4778&resolved=false&types=VULNERABILITY) [2 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=4778&resolved=false&types=VULNERABILITY)  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot.png' alt='Security Hotspot' width='16' height='16' />](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=4778&resolved=false&types=SECURITY_HOTSPOT) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=4778&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=4778&resolved=false&types=SECURITY_HOTSPOT)  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell.png' alt='Code Smell' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=4778&resolved=false&types=CODE_SMELL) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=4778&resolved=false&types=CODE_SMELL) [2 Code Smells](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=4778&resolved=false&types=CODE_SMELL)
   
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/60.png' alt='83.7%' width='16' height='16' />](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=4778&metric=new_coverage&view=list) [83.7% Coverage](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=4778&metric=new_coverage&view=list)  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3.png' alt='0.0%' width='16' height='16' />](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=4778&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=4778&metric=new_duplicated_lines_density&view=list)
   
   


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

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



[GitHub] [incubator-dolphinscheduler] IamMujuziMoses commented on pull request #4778: [Feature][API][backend] Query all upstream and downstream dependencies of the task

Posted by GitBox <gi...@apache.org>.
IamMujuziMoses commented on pull request #4778:
URL: https://github.com/apache/incubator-dolphinscheduler/pull/4778#issuecomment-791355382


   Hi @lgcareer @dailidong sonar is reporting some code smell and vulnerability but for the code smell, that is the needed return type and for the vulnerability, we need to log the user-controlled data as protocol, so that is a mistake in the sonar results


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

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



[GitHub] [incubator-dolphinscheduler] sonarcloud[bot] removed a comment on pull request #4778: [Feature][API][backend] Query all upstream and downstream dependencies of the task

Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] removed a comment on pull request #4778:
URL: https://github.com/apache/incubator-dolphinscheduler/pull/4778#issuecomment-787102627


   SonarCloud Quality Gate failed.
   
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug.png' alt='Bug' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=4778&resolved=false&types=BUG) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=4778&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=4778&resolved=false&types=BUG)  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability.png' alt='Vulnerability' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=4778&resolved=false&types=VULNERABILITY) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/B.png' alt='B' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=4778&resolved=false&types=VULNERABILITY) [2 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=4778&resolved=false&types=VULNERABILITY)  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot.png' alt='Security Hotspot' width='16' height='16' />](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=4778&resolved=false&types=SECURITY_HOTSPOT) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=4778&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=4778&resolved=false&types=SECURITY_HOTSPOT)  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell.png' alt='Code Smell' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=4778&resolved=false&types=CODE_SMELL) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=4778&resolved=false&types=CODE_SMELL) [5 Code Smells](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=4778&resolved=false&types=CODE_SMELL)
   
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/60.png' alt='78.7%' width='16' height='16' />](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=4778&metric=new_coverage&view=list) [78.7% Coverage](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=4778&metric=new_coverage&view=list)  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/20.png' alt='11.9%' width='16' height='16' />](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=4778&metric=new_duplicated_lines_density&view=list) [11.9% Duplication](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=4778&metric=new_duplicated_lines_density&view=list)
   
   


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

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



[GitHub] [incubator-dolphinscheduler] codecov-io commented on pull request #4778: [Feature][API][backend] Query all upstream and downstream dependencies of the task

Posted by GitBox <gi...@apache.org>.
codecov-io commented on pull request #4778:
URL: https://github.com/apache/incubator-dolphinscheduler/pull/4778#issuecomment-791350185


   # [Codecov](https://codecov.io/gh/apache/incubator-dolphinscheduler/pull/4778?src=pr&el=h1) Report
   > Merging [#4778](https://codecov.io/gh/apache/incubator-dolphinscheduler/pull/4778?src=pr&el=desc) (8d9ca4f) into [dev](https://codecov.io/gh/apache/incubator-dolphinscheduler/commit/e851ec13671af7d68792cc134175c4a5d6c01f20?el=desc) (e851ec1) will **decrease** coverage by `0.03%`.
   > The diff coverage is `81.63%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/incubator-dolphinscheduler/pull/4778/graphs/tree.svg?width=650&height=150&src=pr&token=bv9iXXRLi9)](https://codecov.io/gh/apache/incubator-dolphinscheduler/pull/4778?src=pr&el=tree)
   
   ```diff
   @@             Coverage Diff              @@
   ##                dev    #4778      +/-   ##
   ============================================
   - Coverage     47.28%   47.25%   -0.04%     
   - Complexity     3689     3690       +1     
   ============================================
     Files           568      568              
     Lines         23891    23989      +98     
     Branches       2754     2771      +17     
   ============================================
   + Hits          11298    11336      +38     
   - Misses        11567    11626      +59     
   - Partials       1026     1027       +1     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/incubator-dolphinscheduler/pull/4778?src=pr&el=tree) | Coverage Δ | Complexity Δ | |
   |---|---|---|---|
   | [...e/dolphinscheduler/common/model/DependentItem.java](https://codecov.io/gh/apache/incubator-dolphinscheduler/pull/4778/diff?src=pr&el=tree#diff-ZG9scGhpbnNjaGVkdWxlci1jb21tb24vc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2RvbHBoaW5zY2hlZHVsZXIvY29tbW9uL21vZGVsL0RlcGVuZGVudEl0ZW0uamF2YQ==) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (ø)` | |
   | [...phinscheduler/common/model/DependentTaskModel.java](https://codecov.io/gh/apache/incubator-dolphinscheduler/pull/4778/diff?src=pr&el=tree#diff-ZG9scGhpbnNjaGVkdWxlci1jb21tb24vc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2RvbHBoaW5zY2hlZHVsZXIvY29tbW9uL21vZGVsL0RlcGVuZGVudFRhc2tNb2RlbC5qYXZh) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (ø)` | |
   | [...ler/common/task/dependent/DependentParameters.java](https://codecov.io/gh/apache/incubator-dolphinscheduler/pull/4778/diff?src=pr&el=tree#diff-ZG9scGhpbnNjaGVkdWxlci1jb21tb24vc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2RvbHBoaW5zY2hlZHVsZXIvY29tbW9uL3Rhc2svZGVwZW5kZW50L0RlcGVuZGVudFBhcmFtZXRlcnMuamF2YQ==) | `10.00% <0.00%> (-1.12%)` | `1.00 <0.00> (ø)` | |
   | [...api/service/impl/ProcessDefinitionServiceImpl.java](https://codecov.io/gh/apache/incubator-dolphinscheduler/pull/4778/diff?src=pr&el=tree#diff-ZG9scGhpbnNjaGVkdWxlci1hcGkvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2RvbHBoaW5zY2hlZHVsZXIvYXBpL3NlcnZpY2UvaW1wbC9Qcm9jZXNzRGVmaW5pdGlvblNlcnZpY2VJbXBsLmphdmE=) | `69.93% <82.55%> (+1.37%)` | `126.00 <18.00> (+18.00)` | |
   | [...er/api/controller/ProcessDefinitionController.java](https://codecov.io/gh/apache/incubator-dolphinscheduler/pull/4778/diff?src=pr&el=tree#diff-ZG9scGhpbnNjaGVkdWxlci1hcGkvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2RvbHBoaW5zY2hlZHVsZXIvYXBpL2NvbnRyb2xsZXIvUHJvY2Vzc0RlZmluaXRpb25Db250cm9sbGVyLmphdmE=) | `73.87% <100.00%> (+2.02%)` | `22.00 <2.00> (+2.00)` | |
   | [.../org/apache/dolphinscheduler/api/enums/Status.java](https://codecov.io/gh/apache/incubator-dolphinscheduler/pull/4778/diff?src=pr&el=tree#diff-ZG9scGhpbnNjaGVkdWxlci1hcGkvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2RvbHBoaW5zY2hlZHVsZXIvYXBpL2VudW1zL1N0YXR1cy5qYXZh) | `100.00% <100.00%> (ø)` | `5.00 <0.00> (ø)` | |
   | [...he/dolphinscheduler/remote/utils/ChannelUtils.java](https://codecov.io/gh/apache/incubator-dolphinscheduler/pull/4778/diff?src=pr&el=tree#diff-ZG9scGhpbnNjaGVkdWxlci1yZW1vdGUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2RvbHBoaW5zY2hlZHVsZXIvcmVtb3RlL3V0aWxzL0NoYW5uZWxVdGlscy5qYXZh) | `16.66% <0.00%> (-16.67%)` | `1.00% <0.00%> (ø%)` | |
   | [...lphinscheduler/remote/future/ReleaseSemaphore.java](https://codecov.io/gh/apache/incubator-dolphinscheduler/pull/4778/diff?src=pr&el=tree#diff-ZG9scGhpbnNjaGVkdWxlci1yZW1vdGUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2RvbHBoaW5zY2hlZHVsZXIvcmVtb3RlL2Z1dHVyZS9SZWxlYXNlU2VtYXBob3JlLmphdmE=) | `85.71% <0.00%> (-14.29%)` | `2.00% <0.00%> (-1.00%)` | |
   | [...duler/server/registry/ZookeeperRegistryCenter.java](https://codecov.io/gh/apache/incubator-dolphinscheduler/pull/4778/diff?src=pr&el=tree#diff-ZG9scGhpbnNjaGVkdWxlci1zZXJ2ZXIvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2RvbHBoaW5zY2hlZHVsZXIvc2VydmVyL3JlZ2lzdHJ5L1pvb2tlZXBlclJlZ2lzdHJ5Q2VudGVyLmphdmE=) | `48.83% <0.00%> (-13.96%)` | `14.00% <0.00%> (-3.00%)` | |
   | [...olphinscheduler/server/registry/HeartBeatTask.java](https://codecov.io/gh/apache/incubator-dolphinscheduler/pull/4778/diff?src=pr&el=tree#diff-ZG9scGhpbnNjaGVkdWxlci1zZXJ2ZXIvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2RvbHBoaW5zY2hlZHVsZXIvc2VydmVyL3JlZ2lzdHJ5L0hlYXJ0QmVhdFRhc2suamF2YQ==) | `24.39% <0.00%> (-7.32%)` | `1.00% <0.00%> (-1.00%)` | |
   | ... and [9 more](https://codecov.io/gh/apache/incubator-dolphinscheduler/pull/4778/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/incubator-dolphinscheduler/pull/4778?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/incubator-dolphinscheduler/pull/4778?src=pr&el=footer). Last update [e851ec1...8d9ca4f](https://codecov.io/gh/apache/incubator-dolphinscheduler/pull/4778?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


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

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



[GitHub] [incubator-dolphinscheduler] lgcareer commented on a change in pull request #4778: [Feature][API][backend] Query all upstream and downstream dependencies of the task

Posted by GitBox <gi...@apache.org>.
lgcareer commented on a change in pull request #4778:
URL: https://github.com/apache/incubator-dolphinscheduler/pull/4778#discussion_r579585659



##########
File path: dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
##########
@@ -1797,5 +1800,94 @@ private void checkBatchOperateResult(String srcProjectName, String targetProject
         }
     }
 
+    public Map<String, Object> queryUpstreamTaskDependencies(Integer processId, String taskName) {
+        Map<String, Object> result = new HashMap<>();
+        List<String> depList = new ArrayList<>();
+
+        ProcessDefinition processDefinition = processDefineMapper.selectById(processId);
+        if (processDefinition == null) {
+            logger.info("Upstream dependencies process define not exists");
+            putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, processId);
+            return result;
+        }
+
+        String processDefinitionJson = processDefinition.getProcessDefinitionJson();
+
+        ProcessData processData = JSONUtils.parseObject(processDefinitionJson, ProcessData.class);
+
+        //process data check
+        if (null == processData) {
+            logger.error("Upstream dependencies process data is null");
+            putMsg(result, Status.DATA_IS_NOT_VALID, processDefinitionJson);
+            return result;
+        }
+
+        List<TaskNode> taskNodeList = (processData.getTasks() == null) ? new ArrayList<>() : processData.getTasks();
+
+        for (TaskNode taskNode : taskNodeList) {
+            if (taskNode.getName().equals(taskName)) {
+                //getPreTasks() holds inner dependency information
+                depList.add(taskNode.getPreTasks());
+            }
+
+        }
+

Review comment:
       You can also abstract a class to describe the dependent item,it need includes common attributes:project id,process definition id,task name




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

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