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/03/26 15:33:52 UTC
[GitHub] [incubator-dolphinscheduler] lenboo opened a new pull request #5160: [JsonSplit-4417][master/worker/api]json split- remove json in task instance.
lenboo opened a new pull request #5160:
URL: https://github.com/apache/incubator-dolphinscheduler/pull/5160
refer : #4417 remove json in task instance /process instance.
--
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] lenboo merged pull request #5160: [JsonSplit-4417][master/worker/api]json split- remove json in task instance.
Posted by GitBox <gi...@apache.org>.
lenboo merged pull request #5160:
URL: https://github.com/apache/incubator-dolphinscheduler/pull/5160
--
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] JinyLeeChina commented on pull request #5160: [JsonSplit-4417][master/worker/api]json split- remove json in task instance.
Posted by GitBox <gi...@apache.org>.
JinyLeeChina commented on pull request #5160:
URL: https://github.com/apache/incubator-dolphinscheduler/pull/5160#issuecomment-812842611
+1
--
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] JinyLeeChina commented on a change in pull request #5160: [JsonSplit-4417][master/worker/api]json split- remove json in task instance.
Posted by GitBox <gi...@apache.org>.
JinyLeeChina commented on a change in pull request #5160:
URL: https://github.com/apache/incubator-dolphinscheduler/pull/5160#discussion_r603104123
##########
File path: dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java
##########
@@ -2524,10 +2526,84 @@ public ProcessData genProcessData(ProcessDefinition processDefinition) {
return new ArrayList<>(taskNodeMap.values());
}
+ /**
+ * getTaskNodeFromTaskInstance
+ * return null if task definition do not exists
+ *
+ * @param taskInstance
+ * @return
+ */
+ public TaskNode getTaskNodeFromTaskInstance(TaskInstance taskInstance) {
+ TaskNode taskNode = new TaskNode();
+ ProcessInstance processInstance = processInstanceMapper.selectById(taskInstance.getProcessInstanceId());
+ TaskDefinition taskDefinition = taskDefinitionLogMapper.queryByDefinitionCodeAndVersion(
+ taskInstance.getTaskCode(),
+ taskInstance.getTaskDefinitionVersion());
+ if (taskDefinition == null) {
+ return null;
+ }
+ List<ProcessTaskRelationLog> taskRelationList = processTaskRelationLogMapper.queryByProcessCodeAndVersion(
+ taskInstance.getProcessDefinitionCode(), processInstance.getProcessDefinitionVersion()
+ );
+ Map<Long, Integer> taskCodeMap = new HashedMap();
+
+ taskRelationList.forEach(relation -> taskCodeMap.putIfAbsent(relation.getPostTaskCode(), relation.getPostTaskVersion()));
+
+ taskNode.setCode(taskDefinition.getCode());
+ taskNode.setVersion(taskDefinition.getVersion());
+ taskNode.setName(taskDefinition.getName());
+ taskNode.setId("task-" + taskDefinition.getId());
+ taskNode.setCode(taskDefinition.getCode());
+ taskNode.setName(taskDefinition.getName());
+ taskNode.setDesc(taskDefinition.getDescription());
+ taskNode.setType(taskDefinition.getTaskType().getDescp());
+ taskNode.setRunFlag(taskDefinition.getFlag() == Flag.YES ? Constants.FLOWNODE_RUN_FLAG_FORBIDDEN : "NORMAL");
Review comment:
This can use enum of Constants
##########
File path: dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java
##########
@@ -2524,10 +2526,84 @@ public ProcessData genProcessData(ProcessDefinition processDefinition) {
return new ArrayList<>(taskNodeMap.values());
}
+ /**
+ * getTaskNodeFromTaskInstance
+ * return null if task definition do not exists
+ *
+ * @param taskInstance
+ * @return
+ */
+ public TaskNode getTaskNodeFromTaskInstance(TaskInstance taskInstance) {
+ TaskNode taskNode = new TaskNode();
+ ProcessInstance processInstance = processInstanceMapper.selectById(taskInstance.getProcessInstanceId());
+ TaskDefinition taskDefinition = taskDefinitionLogMapper.queryByDefinitionCodeAndVersion(
+ taskInstance.getTaskCode(),
+ taskInstance.getTaskDefinitionVersion());
+ if (taskDefinition == null) {
+ return null;
+ }
+ List<ProcessTaskRelationLog> taskRelationList = processTaskRelationLogMapper.queryByProcessCodeAndVersion(
+ taskInstance.getProcessDefinitionCode(), processInstance.getProcessDefinitionVersion()
+ );
+ Map<Long, Integer> taskCodeMap = new HashedMap();
+
+ taskRelationList.forEach(relation -> taskCodeMap.putIfAbsent(relation.getPostTaskCode(), relation.getPostTaskVersion()));
+
+ taskNode.setCode(taskDefinition.getCode());
+ taskNode.setVersion(taskDefinition.getVersion());
+ taskNode.setName(taskDefinition.getName());
+ taskNode.setId("task-" + taskDefinition.getId());
Review comment:
Front taskId can't use taskDefinitionId
--
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