[Streaming] Streaming scheduler - part1-2: execution graph (#6666)

This commit is contained in:
Tianyi Chen
2020-02-04 11:51:21 +08:00
committed by GitHub
parent 984490d2be
commit 13882d052d
19 changed files with 841 additions and 6 deletions
@@ -32,6 +32,7 @@ public class DataStreamSource<T> extends DataStream<T> implements StreamSource<T
return new DataStreamSource(context, new CollectionSourceFunction(values));
}
@Override
public DataStreamSource<T> setParallelism(int parallelism) {
this.parallelism = parallelism;
return this;
@@ -4,7 +4,6 @@ import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -57,7 +57,7 @@ public class JobGraphBuilder {
} else if (stream instanceof StreamSource) {
jobVertex = new JobVertex(vertexId, parallelism, VertexType.SOURCE, streamOperator);
} else if (stream instanceof DataStream || stream instanceof PythonDataStream) {
jobVertex = new JobVertex(vertexId, parallelism, VertexType.PROCESS, streamOperator);
jobVertex = new JobVertex(vertexId, parallelism, VertexType.TRANSFORMATION, streamOperator);
Stream parentStream = stream.getInputStream();
int inputVertexId = parentStream.getId();
JobEdge jobEdge = new JobEdge(inputVertexId, vertexId, parentStream.getPartition());
@@ -47,4 +47,5 @@ public class JobVertex implements Serializable {
.add("streamOperator", streamOperator)
.toString();
}
}
@@ -6,6 +6,6 @@ package org.ray.streaming.jobgraph;
public enum VertexType {
MASTER,
SOURCE,
PROCESS,
TRANSFORMATION,
SINK,
}
@@ -14,7 +14,6 @@ public abstract class StreamOperator<F extends Function> implements Operator {
protected List<Collector> collectorList;
protected RuntimeContext runtimeContext;
public StreamOperator(F function) {
this.name = getClass().getSimpleName();
this.function = function;
@@ -8,7 +8,6 @@ import org.ray.streaming.api.partition.impl.RoundRobinPartition;
import org.ray.streaming.api.stream.DataStream;
import org.ray.streaming.api.stream.DataStreamSource;
import org.ray.streaming.api.stream.StreamSink;
import org.ray.streaming.api.stream.StreamSource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.testng.Assert;
@@ -62,7 +61,7 @@ public class JobGraphBuilderTest {
JobVertex sink = jobVertexList.get(2);
Assert.assertEquals(source.getVertexType(), VertexType.SOURCE);
Assert.assertEquals(map.getVertexType(), VertexType.PROCESS);
Assert.assertEquals(map.getVertexType(), VertexType.TRANSFORMATION);
Assert.assertEquals(sink.getVertexType(), VertexType.SINK);
JobEdge keyBy2Sink = jobEdgeList.get(0);