Class StreamGraph
- java.lang.Object
-
- org.apache.flink.streaming.api.graph.StreamGraph
-
- All Implemented Interfaces:
org.apache.flink.api.dag.Pipeline
@Internal public class StreamGraph extends Object implements org.apache.flink.api.dag.Pipeline
Class representing the streaming topology. It contains all the information necessary to build the jobgraph for the execution.
-
-
Field Summary
Fields Modifier and Type Field Description static StringITERATION_SINK_NAME_PREFIXstatic StringITERATION_SOURCE_NAME_PREFIXprotected Map<Integer,String>vertexIDtoBrokerIDprotected Map<Integer,Long>vertexIDtoLoopTimeout
-
Constructor Summary
Constructors Constructor Description StreamGraph(org.apache.flink.configuration.Configuration jobConfiguration, org.apache.flink.api.common.ExecutionConfig executionConfig, CheckpointConfig checkpointConfig, SavepointRestoreSettings savepointRestoreSettings)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description <IN1,IN2,OUT>
voidaddCoOperator(Integer vertexID, String slotSharingGroup, String coLocationGroup, StreamOperatorFactory<OUT> taskOperatorFactory, org.apache.flink.api.common.typeinfo.TypeInformation<IN1> in1TypeInfo, org.apache.flink.api.common.typeinfo.TypeInformation<IN2> in2TypeInfo, org.apache.flink.api.common.typeinfo.TypeInformation<OUT> outTypeInfo, String operatorName)voidaddEdge(Integer upStreamVertexID, Integer downStreamVertexID, int typeNumber)voidaddEdge(Integer upStreamVertexID, Integer downStreamVertexID, int typeNumber, IntermediateDataSetID intermediateDataSetId)<IN,OUT>
voidaddLegacySource(Integer vertexID, String slotSharingGroup, String coLocationGroup, StreamOperatorFactory<OUT> operatorFactory, org.apache.flink.api.common.typeinfo.TypeInformation<IN> inTypeInfo, org.apache.flink.api.common.typeinfo.TypeInformation<OUT> outTypeInfo, String operatorName)<OUT> voidaddMultipleInputOperator(Integer vertexID, String slotSharingGroup, String coLocationGroup, StreamOperatorFactory<OUT> operatorFactory, List<org.apache.flink.api.common.typeinfo.TypeInformation<?>> inTypeInfos, org.apache.flink.api.common.typeinfo.TypeInformation<OUT> outTypeInfo, String operatorName)protected StreamNodeaddNode(Integer vertexID, String slotSharingGroup, String coLocationGroup, Class<? extends TaskInvokable> vertexClass, StreamOperatorFactory<?> operatorFactory, String operatorName)<IN,OUT>
voidaddOperator(Integer vertexID, String slotSharingGroup, String coLocationGroup, StreamOperatorFactory<OUT> operatorFactory, org.apache.flink.api.common.typeinfo.TypeInformation<IN> inTypeInfo, org.apache.flink.api.common.typeinfo.TypeInformation<OUT> outTypeInfo, String operatorName)<IN,OUT>
voidaddSink(Integer vertexID, String slotSharingGroup, String coLocationGroup, StreamOperatorFactory<OUT> operatorFactory, org.apache.flink.api.common.typeinfo.TypeInformation<IN> inTypeInfo, org.apache.flink.api.common.typeinfo.TypeInformation<OUT> outTypeInfo, String operatorName)<IN,OUT>
voidaddSource(Integer vertexID, String slotSharingGroup, String coLocationGroup, SourceOperatorFactory<OUT> operatorFactory, org.apache.flink.api.common.typeinfo.TypeInformation<IN> inTypeInfo, org.apache.flink.api.common.typeinfo.TypeInformation<OUT> outTypeInfo, String operatorName)voidaddVirtualPartitionNode(Integer originalId, Integer virtualId, StreamPartitioner<?> partitioner, StreamExchangeMode exchangeMode)Adds a new virtual node that is used to connect a downstream vertex to an input with a certain partitioning.voidaddVirtualSideOutputNode(Integer originalId, Integer virtualId, org.apache.flink.util.OutputTag outputTag)Adds a new virtual node that is used to connect a downstream vertex to only the outputs with the selected side-outputOutputTag.voidclear()Remove all registered nodes etc.org.apache.flink.api.java.tuple.Tuple2<StreamNode,StreamNode>createIterationSourceAndSink(int loopId, int sourceId, int sinkId, long timeout, int parallelism, int maxParallelism, org.apache.flink.api.common.operators.ResourceSpec minResources, org.apache.flink.api.common.operators.ResourceSpec preferredResources)StringgetBrokerID(Integer vertexID)CheckpointConfiggetCheckpointConfig()CheckpointStoragegetCheckpointStorage()org.apache.flink.api.common.ExecutionConfiggetExecutionConfig()GlobalStreamExchangeModegetGlobalStreamExchangeMode()Set<org.apache.flink.api.java.tuple.Tuple2<StreamNode,StreamNode>>getIterationSourceSinkPairs()org.apache.flink.configuration.ConfigurationgetJobConfiguration()JobGraphgetJobGraph()Gets the assembledJobGraphwith a randomJobID.JobGraphgetJobGraph(ClassLoader userClassLoader, org.apache.flink.api.common.JobID jobID)Gets the assembledJobGraphwith a specifiedJobID.StringgetJobName()List<org.apache.flink.core.execution.JobStatusHook>getJobStatusHooks()JobTypegetJobType()LineageGraphgetLineageGraph()longgetLoopTimeout(Integer vertexID)SavepointRestoreSettingsgetSavepointRestoreSettings()Collection<Integer>getSinkIDs()StringgetSlotSharingGroup(Integer id)Determines the slot sharing group of an operation across virtual nodes.Optional<ResourceProfile>getSlotSharingGroupResource(String groupId)Collection<Integer>getSourceIDs()StreamNodegetSourceVertex(StreamEdge edge)StateBackendgetStateBackend()List<StreamEdge>getStreamEdges(int sourceId)List<StreamEdge>getStreamEdges(int sourceId, int targetId)List<StreamEdge>getStreamEdgesOrThrow(int sourceId, int targetId)Deprecated.StringgetStreamingPlanAsJSON()StreamNodegetStreamNode(Integer vertexID)Collection<StreamNode>getStreamNodes()StreamNodegetTargetVertex(StreamEdge edge)InternalTimeServiceManager.ProvidergetTimerServiceProvider()Collection<org.apache.flink.api.java.tuple.Tuple2<String,org.apache.flink.api.common.cache.DistributedCache.DistributedCacheEntry>>getUserArtifacts()org.apache.flink.configuration.PipelineOptions.VertexDescriptionModegetVertexDescriptionMode()protected Collection<? extends Integer>getVertexIDs()booleanhasFineGrainedResource()booleanisAllVerticesInSameSlotSharingGroupByDefault()Gets whether to put all vertices into the same slot sharing group by default.booleanisAutoParallelismEnabled()booleanisChainingEnabled()booleanisChainingOfOperatorsWithDifferentMaxParallelismEnabled()booleanisDynamic()booleanisEnableCheckpointsAfterTasksFinish()booleanisIterative()booleanisVertexNameIncludeIndexPrefix()voidregisterJobStatusHook(org.apache.flink.core.execution.JobStatusHook hook)Registers the JobStatusHook.voidsetAllVerticesInSameSlotSharingGroupByDefault(boolean allVerticesInSameSlotSharingGroupByDefault)Set whether to put all vertices into the same slot sharing group by default.voidsetAttribute(Integer vertexId, org.apache.flink.api.common.attribute.Attribute attribute)voidsetAutoParallelismEnabled(boolean autoParallelismEnabled)voidsetBufferTimeout(Integer vertexID, long bufferTimeout)voidsetCheckpointStorage(CheckpointStorage checkpointStorage)voidsetDynamic(boolean dynamic)voidsetEnableCheckpointsAfterTasksFinish(boolean enableCheckpointsAfterTasksFinish)voidsetGlobalStreamExchangeMode(GlobalStreamExchangeMode globalExchangeMode)voidsetInputFormat(Integer vertexID, org.apache.flink.api.common.io.InputFormat<?,?> inputFormat)voidsetJobName(String jobName)voidsetJobType(JobType jobType)voidsetLineageGraph(LineageGraph lineageGraph)voidsetManagedMemoryUseCaseWeights(int vertexID, Map<org.apache.flink.core.memory.ManagedMemoryUseCase,Integer> operatorScopeUseCaseWeights, Set<org.apache.flink.core.memory.ManagedMemoryUseCase> slotScopeUseCases)voidsetMaxParallelism(int vertexID, int maxParallelism)voidsetMultipleInputStateKey(Integer vertexID, List<org.apache.flink.api.java.functions.KeySelector<?,?>> keySelectors, org.apache.flink.api.common.typeutils.TypeSerializer<?> keySerializer)voidsetOneInputStateKey(Integer vertexID, org.apache.flink.api.java.functions.KeySelector<?,?> keySelector, org.apache.flink.api.common.typeutils.TypeSerializer<?> keySerializer)voidsetOutputFormat(Integer vertexID, org.apache.flink.api.common.io.OutputFormat<?> outputFormat)voidsetParallelism(Integer vertexID, int parallelism)voidsetParallelism(Integer vertexId, int parallelism, boolean parallelismConfigured)voidsetResources(int vertexID, org.apache.flink.api.common.operators.ResourceSpec minResources, org.apache.flink.api.common.operators.ResourceSpec preferredResources)voidsetSavepointRestoreSettings(SavepointRestoreSettings savepointRestoreSettings)voidsetSerializers(Integer vertexID, org.apache.flink.api.common.typeutils.TypeSerializer<?> in1, org.apache.flink.api.common.typeutils.TypeSerializer<?> in2, org.apache.flink.api.common.typeutils.TypeSerializer<?> out)voidsetSlotSharingGroupResource(Map<String,ResourceProfile> slotSharingGroupResources)voidsetStateBackend(StateBackend backend)voidsetSupportsConcurrentExecutionAttempts(Integer vertexId, boolean supportsConcurrentExecutionAttempts)voidsetTimerServiceProvider(InternalTimeServiceManager.Provider timerServiceProvider)voidsetTransformationUID(Integer nodeId, String transformationId)voidsetTwoInputStateKey(Integer vertexID, org.apache.flink.api.java.functions.KeySelector<?,?> keySelector1, org.apache.flink.api.java.functions.KeySelector<?,?> keySelector2, org.apache.flink.api.common.typeutils.TypeSerializer<?> keySerializer)voidsetVertexDescriptionMode(org.apache.flink.configuration.PipelineOptions.VertexDescriptionMode mode)voidsetVertexNameIncludeIndexPrefix(boolean includePrefix)
-
-
-
Field Detail
-
ITERATION_SOURCE_NAME_PREFIX
public static final String ITERATION_SOURCE_NAME_PREFIX
- See Also:
- Constant Field Values
-
ITERATION_SINK_NAME_PREFIX
public static final String ITERATION_SINK_NAME_PREFIX
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
StreamGraph
public StreamGraph(org.apache.flink.configuration.Configuration jobConfiguration, org.apache.flink.api.common.ExecutionConfig executionConfig, CheckpointConfig checkpointConfig, SavepointRestoreSettings savepointRestoreSettings)
-
-
Method Detail
-
clear
public void clear()
Remove all registered nodes etc.
-
getExecutionConfig
public org.apache.flink.api.common.ExecutionConfig getExecutionConfig()
-
getJobConfiguration
public org.apache.flink.configuration.Configuration getJobConfiguration()
-
getCheckpointConfig
public CheckpointConfig getCheckpointConfig()
-
setSavepointRestoreSettings
public void setSavepointRestoreSettings(SavepointRestoreSettings savepointRestoreSettings)
-
getSavepointRestoreSettings
public SavepointRestoreSettings getSavepointRestoreSettings()
-
getJobName
public String getJobName()
-
setJobName
public void setJobName(String jobName)
-
getLineageGraph
public LineageGraph getLineageGraph()
-
setLineageGraph
public void setLineageGraph(LineageGraph lineageGraph)
-
setStateBackend
public void setStateBackend(StateBackend backend)
-
getStateBackend
public StateBackend getStateBackend()
-
setCheckpointStorage
public void setCheckpointStorage(CheckpointStorage checkpointStorage)
-
getCheckpointStorage
public CheckpointStorage getCheckpointStorage()
-
getTimerServiceProvider
public InternalTimeServiceManager.Provider getTimerServiceProvider()
-
setTimerServiceProvider
public void setTimerServiceProvider(InternalTimeServiceManager.Provider timerServiceProvider)
-
getUserArtifacts
public Collection<org.apache.flink.api.java.tuple.Tuple2<String,org.apache.flink.api.common.cache.DistributedCache.DistributedCacheEntry>> getUserArtifacts()
-
getGlobalStreamExchangeMode
public GlobalStreamExchangeMode getGlobalStreamExchangeMode()
-
setGlobalStreamExchangeMode
public void setGlobalStreamExchangeMode(GlobalStreamExchangeMode globalExchangeMode)
-
setSlotSharingGroupResource
public void setSlotSharingGroupResource(Map<String,ResourceProfile> slotSharingGroupResources)
-
getSlotSharingGroupResource
public Optional<ResourceProfile> getSlotSharingGroupResource(String groupId)
-
hasFineGrainedResource
public boolean hasFineGrainedResource()
-
setAllVerticesInSameSlotSharingGroupByDefault
public void setAllVerticesInSameSlotSharingGroupByDefault(boolean allVerticesInSameSlotSharingGroupByDefault)
Set whether to put all vertices into the same slot sharing group by default.- Parameters:
allVerticesInSameSlotSharingGroupByDefault- indicates whether to put all vertices into the same slot sharing group by default.
-
isAllVerticesInSameSlotSharingGroupByDefault
public boolean isAllVerticesInSameSlotSharingGroupByDefault()
Gets whether to put all vertices into the same slot sharing group by default.- Returns:
- whether to put all vertices into the same slot sharing group by default.
-
isEnableCheckpointsAfterTasksFinish
public boolean isEnableCheckpointsAfterTasksFinish()
-
setEnableCheckpointsAfterTasksFinish
public void setEnableCheckpointsAfterTasksFinish(boolean enableCheckpointsAfterTasksFinish)
-
isChainingEnabled
public boolean isChainingEnabled()
-
isChainingOfOperatorsWithDifferentMaxParallelismEnabled
public boolean isChainingOfOperatorsWithDifferentMaxParallelismEnabled()
-
isIterative
public boolean isIterative()
-
addSource
public <IN,OUT> void addSource(Integer vertexID, @Nullable String slotSharingGroup, @Nullable String coLocationGroup, SourceOperatorFactory<OUT> operatorFactory, org.apache.flink.api.common.typeinfo.TypeInformation<IN> inTypeInfo, org.apache.flink.api.common.typeinfo.TypeInformation<OUT> outTypeInfo, String operatorName)
-
addLegacySource
public <IN,OUT> void addLegacySource(Integer vertexID, @Nullable String slotSharingGroup, @Nullable String coLocationGroup, StreamOperatorFactory<OUT> operatorFactory, org.apache.flink.api.common.typeinfo.TypeInformation<IN> inTypeInfo, org.apache.flink.api.common.typeinfo.TypeInformation<OUT> outTypeInfo, String operatorName)
-
addSink
public <IN,OUT> void addSink(Integer vertexID, @Nullable String slotSharingGroup, @Nullable String coLocationGroup, StreamOperatorFactory<OUT> operatorFactory, org.apache.flink.api.common.typeinfo.TypeInformation<IN> inTypeInfo, org.apache.flink.api.common.typeinfo.TypeInformation<OUT> outTypeInfo, String operatorName)
-
addOperator
public <IN,OUT> void addOperator(Integer vertexID, @Nullable String slotSharingGroup, @Nullable String coLocationGroup, StreamOperatorFactory<OUT> operatorFactory, org.apache.flink.api.common.typeinfo.TypeInformation<IN> inTypeInfo, org.apache.flink.api.common.typeinfo.TypeInformation<OUT> outTypeInfo, String operatorName)
-
addCoOperator
public <IN1,IN2,OUT> void addCoOperator(Integer vertexID, String slotSharingGroup, @Nullable String coLocationGroup, StreamOperatorFactory<OUT> taskOperatorFactory, org.apache.flink.api.common.typeinfo.TypeInformation<IN1> in1TypeInfo, org.apache.flink.api.common.typeinfo.TypeInformation<IN2> in2TypeInfo, org.apache.flink.api.common.typeinfo.TypeInformation<OUT> outTypeInfo, String operatorName)
-
addMultipleInputOperator
public <OUT> void addMultipleInputOperator(Integer vertexID, String slotSharingGroup, @Nullable String coLocationGroup, StreamOperatorFactory<OUT> operatorFactory, List<org.apache.flink.api.common.typeinfo.TypeInformation<?>> inTypeInfos, org.apache.flink.api.common.typeinfo.TypeInformation<OUT> outTypeInfo, String operatorName)
-
addNode
protected StreamNode addNode(Integer vertexID, @Nullable String slotSharingGroup, @Nullable String coLocationGroup, Class<? extends TaskInvokable> vertexClass, @Nullable StreamOperatorFactory<?> operatorFactory, String operatorName)
-
addVirtualSideOutputNode
public void addVirtualSideOutputNode(Integer originalId, Integer virtualId, org.apache.flink.util.OutputTag outputTag)
Adds a new virtual node that is used to connect a downstream vertex to only the outputs with the selected side-outputOutputTag.- Parameters:
originalId- ID of the node that should be connected to.virtualId- ID of the virtual node.outputTag- The selected side-outputOutputTag.
-
addVirtualPartitionNode
public void addVirtualPartitionNode(Integer originalId, Integer virtualId, StreamPartitioner<?> partitioner, StreamExchangeMode exchangeMode)
Adds a new virtual node that is used to connect a downstream vertex to an input with a certain partitioning.When adding an edge from the virtual node to a downstream node the connection will be made to the original node, but with the partitioning given here.
- Parameters:
originalId- ID of the node that should be connected to.virtualId- ID of the virtual node.partitioner- The partitioner
-
getSlotSharingGroup
public String getSlotSharingGroup(Integer id)
Determines the slot sharing group of an operation across virtual nodes.
-
addEdge
public void addEdge(Integer upStreamVertexID, Integer downStreamVertexID, int typeNumber, IntermediateDataSetID intermediateDataSetId)
-
setParallelism
public void setParallelism(Integer vertexID, int parallelism)
-
isDynamic
public boolean isDynamic()
-
setParallelism
public void setParallelism(Integer vertexId, int parallelism, boolean parallelismConfigured)
-
setDynamic
public void setDynamic(boolean dynamic)
-
setMaxParallelism
public void setMaxParallelism(int vertexID, int maxParallelism)
-
setResources
public void setResources(int vertexID, org.apache.flink.api.common.operators.ResourceSpec minResources, org.apache.flink.api.common.operators.ResourceSpec preferredResources)
-
setManagedMemoryUseCaseWeights
public void setManagedMemoryUseCaseWeights(int vertexID, Map<org.apache.flink.core.memory.ManagedMemoryUseCase,Integer> operatorScopeUseCaseWeights, Set<org.apache.flink.core.memory.ManagedMemoryUseCase> slotScopeUseCases)
-
setOneInputStateKey
public void setOneInputStateKey(Integer vertexID, org.apache.flink.api.java.functions.KeySelector<?,?> keySelector, org.apache.flink.api.common.typeutils.TypeSerializer<?> keySerializer)
-
setTwoInputStateKey
public void setTwoInputStateKey(Integer vertexID, org.apache.flink.api.java.functions.KeySelector<?,?> keySelector1, org.apache.flink.api.java.functions.KeySelector<?,?> keySelector2, org.apache.flink.api.common.typeutils.TypeSerializer<?> keySerializer)
-
setMultipleInputStateKey
public void setMultipleInputStateKey(Integer vertexID, List<org.apache.flink.api.java.functions.KeySelector<?,?>> keySelectors, org.apache.flink.api.common.typeutils.TypeSerializer<?> keySerializer)
-
setBufferTimeout
public void setBufferTimeout(Integer vertexID, long bufferTimeout)
-
setSerializers
public void setSerializers(Integer vertexID, org.apache.flink.api.common.typeutils.TypeSerializer<?> in1, org.apache.flink.api.common.typeutils.TypeSerializer<?> in2, org.apache.flink.api.common.typeutils.TypeSerializer<?> out)
-
setInputFormat
public void setInputFormat(Integer vertexID, org.apache.flink.api.common.io.InputFormat<?,?> inputFormat)
-
setOutputFormat
public void setOutputFormat(Integer vertexID, org.apache.flink.api.common.io.OutputFormat<?> outputFormat)
-
getStreamNode
public StreamNode getStreamNode(Integer vertexID)
-
getVertexIDs
protected Collection<? extends Integer> getVertexIDs()
-
getStreamEdges
@VisibleForTesting public List<StreamEdge> getStreamEdges(int sourceId)
-
getStreamEdges
@VisibleForTesting public List<StreamEdge> getStreamEdges(int sourceId, int targetId)
-
getStreamEdgesOrThrow
@VisibleForTesting @Deprecated public List<StreamEdge> getStreamEdgesOrThrow(int sourceId, int targetId)
Deprecated.
-
getSourceIDs
public Collection<Integer> getSourceIDs()
-
getSinkIDs
public Collection<Integer> getSinkIDs()
-
getStreamNodes
public Collection<StreamNode> getStreamNodes()
-
getLoopTimeout
public long getLoopTimeout(Integer vertexID)
-
createIterationSourceAndSink
public org.apache.flink.api.java.tuple.Tuple2<StreamNode,StreamNode> createIterationSourceAndSink(int loopId, int sourceId, int sinkId, long timeout, int parallelism, int maxParallelism, org.apache.flink.api.common.operators.ResourceSpec minResources, org.apache.flink.api.common.operators.ResourceSpec preferredResources)
-
getIterationSourceSinkPairs
public Set<org.apache.flink.api.java.tuple.Tuple2<StreamNode,StreamNode>> getIterationSourceSinkPairs()
-
getSourceVertex
public StreamNode getSourceVertex(StreamEdge edge)
-
getTargetVertex
public StreamNode getTargetVertex(StreamEdge edge)
-
getJobGraph
@VisibleForTesting public JobGraph getJobGraph()
Gets the assembledJobGraphwith a randomJobID.
-
getJobGraph
public JobGraph getJobGraph(ClassLoader userClassLoader, @Nullable org.apache.flink.api.common.JobID jobID)
Gets the assembledJobGraphwith a specifiedJobID.
-
getStreamingPlanAsJSON
public String getStreamingPlanAsJSON()
-
setJobType
public void setJobType(JobType jobType)
-
getJobType
public JobType getJobType()
-
isAutoParallelismEnabled
public boolean isAutoParallelismEnabled()
-
setAutoParallelismEnabled
public void setAutoParallelismEnabled(boolean autoParallelismEnabled)
-
getVertexDescriptionMode
public org.apache.flink.configuration.PipelineOptions.VertexDescriptionMode getVertexDescriptionMode()
-
setVertexDescriptionMode
public void setVertexDescriptionMode(org.apache.flink.configuration.PipelineOptions.VertexDescriptionMode mode)
-
setVertexNameIncludeIndexPrefix
public void setVertexNameIncludeIndexPrefix(boolean includePrefix)
-
isVertexNameIncludeIndexPrefix
public boolean isVertexNameIncludeIndexPrefix()
-
registerJobStatusHook
public void registerJobStatusHook(org.apache.flink.core.execution.JobStatusHook hook)
Registers the JobStatusHook.
-
getJobStatusHooks
public List<org.apache.flink.core.execution.JobStatusHook> getJobStatusHooks()
-
setSupportsConcurrentExecutionAttempts
public void setSupportsConcurrentExecutionAttempts(Integer vertexId, boolean supportsConcurrentExecutionAttempts)
-
setAttribute
public void setAttribute(Integer vertexId, org.apache.flink.api.common.attribute.Attribute attribute)
-
-