Browse Source

[Bug][server-api] copy the node ,the preTasks is error #5261 (#5264)

pull/3/MERGE
Wenjun 4 years ago committed by GitHub
parent
commit
5f1fc462c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/model/TaskNode.java
  2. 34
      dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/utils/DagHelperTest.java

1
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/model/TaskNode.java

@ -204,7 +204,6 @@ public class TaskNode {
public void setDepList(List<String> depList) throws JsonProcessingException { public void setDepList(List<String> depList) throws JsonProcessingException {
this.depList = depList; this.depList = depList;
this.preTasks = JSONUtils.toJsonString(depList);
} }
public String getLoc() { public String getLoc() {

34
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/utils/DagHelperTest.java

@ -17,8 +17,6 @@
package org.apache.dolphinscheduler.dao.utils; package org.apache.dolphinscheduler.dao.utils;
import com.fasterxml.jackson.core.JsonProcessingException;
import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.enums.ExecutionStatus; import org.apache.dolphinscheduler.common.enums.ExecutionStatus;
import org.apache.dolphinscheduler.common.enums.TaskDependType; import org.apache.dolphinscheduler.common.enums.TaskDependType;
@ -26,19 +24,21 @@ import org.apache.dolphinscheduler.common.graph.DAG;
import org.apache.dolphinscheduler.common.model.TaskNode; import org.apache.dolphinscheduler.common.model.TaskNode;
import org.apache.dolphinscheduler.common.model.TaskNodeRelation; import org.apache.dolphinscheduler.common.model.TaskNodeRelation;
import org.apache.dolphinscheduler.common.process.ProcessDag; import org.apache.dolphinscheduler.common.process.ProcessDag;
import org.apache.dolphinscheduler.common.utils.*; import org.apache.dolphinscheduler.common.utils.JSONUtils;
import org.apache.dolphinscheduler.dao.entity.ProcessData; import org.apache.dolphinscheduler.dao.entity.ProcessData;
import org.apache.dolphinscheduler.dao.entity.TaskInstance; import org.apache.dolphinscheduler.dao.entity.TaskInstance;
import org.junit.Assert; import java.io.IOException;
import org.junit.Test;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import org.junit.Assert;
import org.junit.Test;
import com.fasterxml.jackson.core.JsonProcessingException;
/** /**
* dag helper test * dag helper test
@ -50,7 +50,7 @@ public class DagHelperTest {
* @throws JsonProcessingException if error throws JsonProcessingException * @throws JsonProcessingException if error throws JsonProcessingException
*/ */
@Test @Test
public void testTaskNodeCanSubmit() throws JsonProcessingException { public void testTaskNodeCanSubmit() throws IOException {
//1->2->3->5->7 //1->2->3->5->7
//4->3->6 //4->3->6
DAG<String, TaskNode, TaskNodeRelation> dag = generateDag(); DAG<String, TaskNode, TaskNodeRelation> dag = generateDag();
@ -89,7 +89,7 @@ public class DagHelperTest {
* test parse post node list * test parse post node list
*/ */
@Test @Test
public void testParsePostNodeList() throws JsonProcessingException { public void testParsePostNodeList() throws IOException {
DAG<String, TaskNode, TaskNodeRelation> dag = generateDag(); DAG<String, TaskNode, TaskNodeRelation> dag = generateDag();
Map<String, TaskInstance> completeTaskList = new HashMap<>(); Map<String, TaskInstance> completeTaskList = new HashMap<>();
Map<String, TaskNode> skipNodeList = new HashMap<>(); Map<String, TaskNode> skipNodeList = new HashMap<>();
@ -156,7 +156,7 @@ public class DagHelperTest {
* @throws JsonProcessingException * @throws JsonProcessingException
*/ */
@Test @Test
public void testForbiddenPostNode() throws JsonProcessingException { public void testForbiddenPostNode() throws IOException {
DAG<String, TaskNode, TaskNodeRelation> dag = generateDag(); DAG<String, TaskNode, TaskNodeRelation> dag = generateDag();
Map<String, TaskInstance> completeTaskList = new HashMap<>(); Map<String, TaskInstance> completeTaskList = new HashMap<>();
Map<String, TaskNode> skipNodeList = new HashMap<>(); Map<String, TaskNode> skipNodeList = new HashMap<>();
@ -194,7 +194,7 @@ public class DagHelperTest {
* @throws JsonProcessingException * @throws JsonProcessingException
*/ */
@Test @Test
public void testConditionPostNode() throws JsonProcessingException { public void testConditionPostNode() throws IOException {
DAG<String, TaskNode, TaskNodeRelation> dag = generateDag(); DAG<String, TaskNode, TaskNodeRelation> dag = generateDag();
Map<String, TaskInstance> completeTaskList = new HashMap<>(); Map<String, TaskInstance> completeTaskList = new HashMap<>();
Map<String, TaskNode> skipNodeList = new HashMap<>(); Map<String, TaskNode> skipNodeList = new HashMap<>();
@ -268,7 +268,7 @@ public class DagHelperTest {
* @return dag * @return dag
* @throws JsonProcessingException if error throws JsonProcessingException * @throws JsonProcessingException if error throws JsonProcessingException
*/ */
private DAG<String, TaskNode, TaskNodeRelation> generateDag() throws JsonProcessingException { private DAG<String, TaskNode, TaskNodeRelation> generateDag() throws IOException {
List<TaskNode> taskNodeList = new ArrayList<>(); List<TaskNode> taskNodeList = new ArrayList<>();
TaskNode node1 = new TaskNode(); TaskNode node1 = new TaskNode();
node1.setId("1"); node1.setId("1");
@ -282,7 +282,7 @@ public class DagHelperTest {
node2.setType("SHELL"); node2.setType("SHELL");
List<String> dep2 = new ArrayList<>(); List<String> dep2 = new ArrayList<>();
dep2.add("1"); dep2.add("1");
node2.setDepList(dep2); node2.setPreTasks(JSONUtils.toJsonString(dep2));
taskNodeList.add(node2); taskNodeList.add(node2);
@ -299,7 +299,7 @@ public class DagHelperTest {
List<String> dep3 = new ArrayList<>(); List<String> dep3 = new ArrayList<>();
dep3.add("2"); dep3.add("2");
dep3.add("4"); dep3.add("4");
node3.setDepList(dep3); node3.setPreTasks(JSONUtils.toJsonString(dep3));
taskNodeList.add(node3); taskNodeList.add(node3);
TaskNode node5 = new TaskNode(); TaskNode node5 = new TaskNode();
@ -309,7 +309,7 @@ public class DagHelperTest {
List<String> dep5 = new ArrayList<>(); List<String> dep5 = new ArrayList<>();
dep5.add("3"); dep5.add("3");
dep5.add("8"); dep5.add("8");
node5.setDepList(dep5); node5.setPreTasks(JSONUtils.toJsonString(dep5));
taskNodeList.add(node5); taskNodeList.add(node5);
TaskNode node6 = new TaskNode(); TaskNode node6 = new TaskNode();
@ -318,7 +318,7 @@ public class DagHelperTest {
node6.setType("SHELL"); node6.setType("SHELL");
List<String> dep6 = new ArrayList<>(); List<String> dep6 = new ArrayList<>();
dep6.add("3"); dep6.add("3");
node6.setDepList(dep6); node6.setPreTasks(JSONUtils.toJsonString(dep6));
taskNodeList.add(node6); taskNodeList.add(node6);
TaskNode node7 = new TaskNode(); TaskNode node7 = new TaskNode();
@ -327,7 +327,7 @@ public class DagHelperTest {
node7.setType("SHELL"); node7.setType("SHELL");
List<String> dep7 = new ArrayList<>(); List<String> dep7 = new ArrayList<>();
dep7.add("5"); dep7.add("5");
node7.setDepList(dep7); node7.setPreTasks(JSONUtils.toJsonString(dep7));
taskNodeList.add(node7); taskNodeList.add(node7);
TaskNode node8 = new TaskNode(); TaskNode node8 = new TaskNode();
@ -336,7 +336,7 @@ public class DagHelperTest {
node8.setType("SHELL"); node8.setType("SHELL");
List<String> dep8 = new ArrayList<>(); List<String> dep8 = new ArrayList<>();
dep8.add("2"); dep8.add("2");
node8.setDepList(dep8); node8.setPreTasks(JSONUtils.toJsonString(dep8));
taskNodeList.add(node8); taskNodeList.add(node8);
List<String> startNodes = new ArrayList<>(); List<String> startNodes = new ArrayList<>();

Loading…
Cancel
Save