From d98c2c5cfe97d3c567e7a0cfc436f0924fd56a56 Mon Sep 17 00:00:00 2001 From: JinyLeeChina <42576980+JinyLeeChina@users.noreply.github.com> Date: Tue, 16 Mar 2021 15:44:03 +0800 Subject: [PATCH] [Feature][JsonSplit] Fix bug in interface of queryProcessDefinitionList (#5043) * modify checkDAGRing and ProcessService method * merge * modify dagRing * modify process instance for project home page * fix save process bug * codeStyle * Fix logical bug in saving process definition * codeSytle * Fix bug in interface of queryProcessDefinitionList * codeSytle Co-authored-by: JinyLeeChina <297062848@qq.com> --- .../impl/ProcessDefinitionServiceImpl.java | 7 +--- .../dolphinscheduler/common/Constants.java | 5 +++ .../common/model/TaskNode.java | 8 +++- .../dao/entity/ProcessTaskRelation.java | 19 +++++++++ .../dao/entity/ProcessTaskRelationLog.java | 4 ++ .../dao/entity/TaskDefinition.java | 39 ++++++++++++++++++- .../dao/entity/TaskDefinitionLog.java | 7 ++++ .../dao/mapper/ProcessDefinitionMapper.xml | 2 +- .../service/process/ProcessService.java | 4 +- sql/dolphinscheduler_mysql.sql | 4 +- 10 files changed, 85 insertions(+), 14 deletions(-) diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java index 56f71aef8c..52cea41dad 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java @@ -270,12 +270,7 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro IPage processDefinitionIPage = processDefinitionMapper.queryDefineListPaging( page, searchVal, userId, project.getCode(), isAdmin(loginUser)); - List records = processDefinitionIPage.getRecords(); - records.forEach(processDefinition -> { - ProcessData processData = processService.genProcessData(processDefinition); - processDefinition.setProcessDefinitionJson(JSONUtils.toJsonString(processData)); - }); - processDefinitionIPage.setRecords(records); + processDefinitionIPage.setRecords(processDefinitionIPage.getRecords()); PageInfo pageInfo = new PageInfo<>(pageNo, pageSize); pageInfo.setTotalCount((int) processDefinitionIPage.getTotal()); diff --git a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java index f0f76d57a7..192ccd2441 100644 --- a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java +++ b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java @@ -418,6 +418,11 @@ public final class Constants { */ public static final String FLOWNODE_RUN_FLAG_FORBIDDEN = "FORBIDDEN"; + /** + * normal running task + */ + public static final String FLOWNODE_RUN_FLAG_NORMAL = "NORMAL"; + /** * datasource configuration path */ diff --git a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/model/TaskNode.java b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/model/TaskNode.java index 036d175925..1e338d908d 100644 --- a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/model/TaskNode.java +++ b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/model/TaskNode.java @@ -387,6 +387,8 @@ public class TaskNode { public String toString() { return "TaskNode{" + "id='" + id + '\'' + + ", code=" + code + + ", version=" + version + ", name='" + name + '\'' + ", desc='" + desc + '\'' + ", type='" + type + '\'' @@ -396,14 +398,16 @@ public class TaskNode { + ", retryInterval=" + retryInterval + ", params='" + params + '\'' + ", preTasks='" + preTasks + '\'' + + ", preTaskNodeList=" + preTaskNodeList + ", extras='" + extras + '\'' + ", depList=" + depList + ", dependence='" + dependence + '\'' + + ", conditionResult='" + conditionResult + '\'' + ", taskInstancePriority=" + taskInstancePriority - + ", timeout='" + timeout + '\'' + ", workerGroup='" + workerGroup + '\'' + + ", workerGroupId=" + workerGroupId + + ", timeout='" + timeout + '\'' + ", delayTime=" + delayTime + '}'; } - } diff --git a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/ProcessTaskRelation.java b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/ProcessTaskRelation.java index 2afeb68339..1dae5d8a42 100644 --- a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/ProcessTaskRelation.java +++ b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/ProcessTaskRelation.java @@ -232,4 +232,23 @@ public class ProcessTaskRelation { public void setPostTaskVersion(int postTaskVersion) { this.postTaskVersion = postTaskVersion; } + + @Override + public String toString() { + return "ProcessTaskRelation{" + + "id=" + id + + ", name='" + name + '\'' + + ", processDefinitionVersion=" + processDefinitionVersion + + ", projectCode=" + projectCode + + ", processDefinitionCode=" + processDefinitionCode + + ", preTaskCode=" + preTaskCode + + ", preTaskVersion=" + preTaskVersion + + ", postTaskCode=" + postTaskCode + + ", postTaskVersion=" + postTaskVersion + + ", conditionType=" + conditionType + + ", conditionParams='" + conditionParams + '\'' + + ", createTime=" + createTime + + ", updateTime=" + updateTime + + '}'; + } } diff --git a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/ProcessTaskRelationLog.java b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/ProcessTaskRelationLog.java index 5d460e2455..ae6ab5a87c 100644 --- a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/ProcessTaskRelationLog.java +++ b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/ProcessTaskRelationLog.java @@ -77,4 +77,8 @@ public class ProcessTaskRelationLog extends ProcessTaskRelation { this.operateTime = operateTime; } + @Override + public String toString() { + return super.toString(); + } } diff --git a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/TaskDefinition.java b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/TaskDefinition.java index fe7145aa18..03cab2d676 100644 --- a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/TaskDefinition.java +++ b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/TaskDefinition.java @@ -24,7 +24,6 @@ import org.apache.dolphinscheduler.common.enums.TimeoutFlag; import org.apache.dolphinscheduler.common.process.Property; import org.apache.dolphinscheduler.common.utils.JSONUtils; -import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Map; @@ -257,6 +256,14 @@ public class TaskDefinition { } + public void setTaskParamList(List taskParamList) { + this.taskParamList = taskParamList; + } + + public void setTaskParamMap(Map taskParamMap) { + this.taskParamMap = taskParamMap; + } + public Map getTaskParamMap() { if (taskParamMap == null && StringUtils.isNotEmpty(taskParams)) { List propList = JSONUtils.toList(JSONUtils.parseObject(taskParams).findValue("localParams").toString(), @@ -369,4 +376,34 @@ public class TaskDefinition { public void setResourceIds(String resourceIds) { this.resourceIds = resourceIds; } + + @Override + public String toString() { + return "TaskDefinition{" + + "id=" + id + + ", code=" + code + + ", name='" + name + '\'' + + ", version=" + version + + ", description='" + description + '\'' + + ", projectCode=" + projectCode + + ", userId=" + userId + + ", taskType=" + taskType + + ", taskParams='" + taskParams + '\'' + + ", taskParamList=" + taskParamList + + ", taskParamMap=" + taskParamMap + + ", flag=" + flag + + ", taskPriority=" + taskPriority + + ", userName='" + userName + '\'' + + ", projectName='" + projectName + '\'' + + ", workerGroup='" + workerGroup + '\'' + + ", failRetryTimes=" + failRetryTimes + + ", failRetryInterval=" + failRetryInterval + + ", timeoutFlag=" + timeoutFlag + + ", timeoutNotifyStrategy=" + timeoutNotifyStrategy + + ", timeout=" + timeout + + ", resourceIds='" + resourceIds + '\'' + + ", createTime=" + createTime + + ", updateTime=" + updateTime + + '}'; + } } diff --git a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/TaskDefinitionLog.java b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/TaskDefinitionLog.java index a1770b4dd8..c1da572761 100644 --- a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/TaskDefinitionLog.java +++ b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/TaskDefinitionLog.java @@ -57,6 +57,8 @@ public class TaskDefinitionLog extends TaskDefinition { this.setProjectName(taskDefinition.getProjectName()); this.setResourceIds(taskDefinition.getResourceIds()); this.setTaskParams(taskDefinition.getTaskParams()); + this.setTaskParamList(taskDefinition.getTaskParamList()); + this.setTaskParamMap(taskDefinition.getTaskParamMap()); this.setTaskPriority(taskDefinition.getTaskPriority()); this.setTimeoutNotifyStrategy(taskDefinition.getTimeoutNotifyStrategy()); this.setTaskType(taskDefinition.getTaskType()); @@ -84,4 +86,9 @@ public class TaskDefinitionLog extends TaskDefinition { public void setOperateTime(Date operateTime) { this.operateTime = operateTime; } + + @Override + public String toString() { + return super.toString(); + } } diff --git a/dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ProcessDefinitionMapper.xml b/dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ProcessDefinitionMapper.xml index afafa8221e..c68477ce1d 100644 --- a/dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ProcessDefinitionMapper.xml +++ b/dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ProcessDefinitionMapper.xml @@ -71,7 +71,7 @@ and pd.name = #{processDefinitionName}