Search in sources :

Example 16 with JobVertex

use of com.flink.platform.common.model.JobVertex in project flink-platform-backend by itinycheng.

the class JobFlowDagHelperTest method before.

@Before
public void before() {
    dag = new DAG<>();
    JobVertex jobVertex1 = new JobVertex(1L, 1L);
    JobVertex jobVertex2 = new JobVertex(2L, 2L);
    JobVertex jobVertex3 = new JobVertex(3L, 3L);
    JobVertex jobVertex4 = new JobVertex(4L, 4L);
    JobVertex jobVertex5 = new JobVertex(5L, 5L);
    JobVertex jobVertex6 = new JobVertex(6L, 6L);
    jobVertex6.setPrecondition(OR);
    dag.addVertex(jobVertex1);
    dag.addVertex(jobVertex2);
    dag.addVertex(jobVertex3);
    dag.addVertex(jobVertex4);
    dag.addVertex(jobVertex5);
    dag.addVertex(jobVertex6);
    JobEdge jobEdge1 = new JobEdge(1L, 3L, SUCCESS);
    JobEdge jobEdge2 = new JobEdge(2L, 3L, SUCCESS);
    JobEdge jobEdge3 = new JobEdge(2L, 4L, SUCCESS);
    JobEdge jobEdge4 = new JobEdge(3L, 5L, SUCCESS);
    JobEdge jobEdge5 = new JobEdge(4L, 5L, SUCCESS);
    JobEdge jobEdge6 = new JobEdge(1L, 6L, FAILURE);
    JobEdge jobEdge7 = new JobEdge(2L, 6L, FAILURE);
    JobEdge jobEdge8 = new JobEdge(3L, 6L, FAILURE);
    JobEdge jobEdge9 = new JobEdge(4L, 6L, FAILURE);
    JobEdge jobEdge10 = new JobEdge(5L, 6L, FAILURE);
    dag.addEdge(jobEdge1);
    dag.addEdge(jobEdge2);
    dag.addEdge(jobEdge3);
    dag.addEdge(jobEdge4);
    dag.addEdge(jobEdge5);
    dag.addEdge(jobEdge6);
    dag.addEdge(jobEdge7);
    dag.addEdge(jobEdge8);
    dag.addEdge(jobEdge9);
    dag.addEdge(jobEdge10);
}
Also used : JobVertex(com.flink.platform.common.model.JobVertex) JobEdge(com.flink.platform.common.model.JobEdge) Before(org.junit.Before)

Example 17 with JobVertex

use of com.flink.platform.common.model.JobVertex in project flink-platform-backend by itinycheng.

the class JobFlowDagHelperTest method test7.

@Test
public void test7() {
    JobVertex vertex = dag.getVertex(2L);
    vertex.setJobRunStatus(SUCCESS);
    vertex = dag.getVertex(1L);
    vertex.setJobRunStatus(SUCCESS);
    vertex = dag.getVertex(3L);
    vertex.setJobRunStatus(SUCCESS);
    Set<JobVertex> executableVertices = JobFlowDagHelper.getExecutableVertices(dag);
    System.out.println(executableVertices);
}
Also used : JobVertex(com.flink.platform.common.model.JobVertex) Test(org.junit.Test)

Example 18 with JobVertex

use of com.flink.platform.common.model.JobVertex in project flink-platform-backend by itinycheng.

the class JobFlowDagHelperTest method test12.

@Test
public void test12() {
    JobVertex vertex = dag.getVertex(2L);
    vertex.setJobRunStatus(FAILURE);
    vertex = dag.getVertex(1L);
    vertex.setJobRunStatus(SUCCESS);
    Set<JobVertex> executableVertices = JobFlowDagHelper.getExecutableVertices(dag);
    System.out.println(executableVertices);
}
Also used : JobVertex(com.flink.platform.common.model.JobVertex) Test(org.junit.Test)

Example 19 with JobVertex

use of com.flink.platform.common.model.JobVertex in project flink-platform-backend by itinycheng.

the class JobFlowTest method test1.

@Test
public void test1() {
    JobFlowDag dag = new JobFlowDag();
    JobVertex jobVertex1 = new JobVertex(19L, 19L);
    JobVertex jobVertex2 = new JobVertex(20L, 20L);
    dag.addVertex(jobVertex1);
    dag.addVertex(jobVertex2);
    JobEdge jobEdge = new JobEdge(19L, 20L, SUCCESS);
    dag.addEdge(jobEdge);
    JobFlowRequest jobFlowRequest = new JobFlowRequest();
    jobFlowRequest.setCode(UuidGenerator.generateShortUuid());
    jobFlowRequest.setName("test_1");
    jobFlowRequest.setUserId(0L);
    jobFlowRequest.setDescription("description");
    jobFlowRequest.setCronExpr("0 0/10 * * * ?");
    jobFlowRequest.setFlow(dag);
    jobFlowRequest.setPriority(8);
    jobFlowRequest.setAlerts(new LongArrayList());
    jobFlowRequest.setStatus(OFFLINE);
    String json = JsonUtil.toJsonString(jobFlowRequest.getJobFlow());
    System.out.println(json);
}
Also used : JobFlowDag(com.flink.platform.dao.entity.JobFlowDag) JobVertex(com.flink.platform.common.model.JobVertex) JobFlowRequest(com.flink.platform.web.entity.request.JobFlowRequest) JobEdge(com.flink.platform.common.model.JobEdge) LongArrayList(com.flink.platform.dao.entity.LongArrayList) Test(org.junit.Test)

Aggregations

JobVertex (com.flink.platform.common.model.JobVertex)19 Test (org.junit.Test)11 JobEdge (com.flink.platform.common.model.JobEdge)6 ExecutionStatus (com.flink.platform.common.enums.ExecutionStatus)5 JobFlowDag (com.flink.platform.dao.entity.JobFlowDag)4 RUNNING (com.flink.platform.common.enums.ExecutionStatus.RUNNING)3 JobFlowRun (com.flink.platform.dao.entity.JobFlowRun)3 Nonnull (javax.annotation.Nonnull)3 CollectionUtils (org.apache.commons.collections4.CollectionUtils)3 QueryWrapper (com.baomidou.mybatisplus.core.conditions.query.QueryWrapper)2 ExecutionCondition (com.flink.platform.common.enums.ExecutionCondition)2 AND (com.flink.platform.common.enums.ExecutionCondition.AND)2 OR (com.flink.platform.common.enums.ExecutionCondition.OR)2 ABNORMAL (com.flink.platform.common.enums.ExecutionStatus.ABNORMAL)2 ERROR (com.flink.platform.common.enums.ExecutionStatus.ERROR)2 FAILURE (com.flink.platform.common.enums.ExecutionStatus.FAILURE)2 KILLED (com.flink.platform.common.enums.ExecutionStatus.KILLED)2 NOT_EXIST (com.flink.platform.common.enums.ExecutionStatus.NOT_EXIST)2 SUBMITTED (com.flink.platform.common.enums.ExecutionStatus.SUBMITTED)2 SUCCESS (com.flink.platform.common.enums.ExecutionStatus.SUCCESS)2