lgcareer commented on a change in pull request #4411:
URL:
https://github.com/apache/incubator-dolphinscheduler/pull/4411#discussion_r557071219
##########
File path:
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
##########
@@ -1836,5 +1840,40 @@ private void checkBatchOperateResult(String
srcProjectName, String targetProject
}
}
+ public Map<String, Object> queryTaskDependenciesByTaskName(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("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("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)) {
+ depList = taskNode.getDepList();
+ }
+ }
+ result.put(Constants.DATA_LIST, depList);
Review comment:
Hi,you should judge the task node type,if it's type is `DEPENDENT`,you
should parse the field `dependence` to get the upstream dependences,and they
are some process definitions or some tasks.
##########
File path:
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
##########
@@ -1836,5 +1840,40 @@ private void checkBatchOperateResult(String
srcProjectName, String targetProject
}
}
+ public Map<String, Object> queryTaskDependenciesByTaskName(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("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("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)) {
+ depList = taskNode.getDepList();
+ }
+ }
+ result.put(Constants.DATA_LIST, depList);
Review comment:
Hi,you should parse the field dependence.
----------------------------------------------------------------
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:
[email protected]