Class StreamGraphGenerator
- java.lang.Object
-
- org.apache.flink.streaming.api.graph.StreamGraphGenerator
-
@Internal public class StreamGraphGenerator extends Object
A generator that generates aStreamGraphfrom a graph ofTransformations.This traverses the tree of
Transformationsstarting from the sinks. At each transformation we recursively transform the inputs, then create a node in theStreamGraphand add edges from the input Nodes to our newly created node. The transformation methods return the IDs of the nodes in the StreamGraph that represent the input transformation. Several IDs can be returned to be able to deal with feedback transformations and unions.Partitioning, split/select and union don't create actual nodes in the
StreamGraph. For these, we create a virtual node in theStreamGraphthat holds the specific property, i.e. partitioning, selector and so on. When an edge is created from a virtual node to a downstream node theStreamGraphresolved the id of the original node and creates an edge in the graph with the desired property. For example, if you have this graph:Map-1 -> HashPartition-2 -> Map-3where the numbers represent transformation IDs. We first recurse all the way down.
Map-1is transformed, i.e. we create aStreamNodewith ID 1. Then we transform theHashPartition, for this, we create virtual node of ID 4 that holds the propertyHashPartition. This transformation returns the ID 4. Then we transform theMap-3. We add the edge4 -> 3. TheStreamGraphresolved the actual node with ID 1 and creates and edge1 -> 3with the property HashPartition.
-
-
Field Summary
Fields Modifier and Type Field Description static StringDEFAULT_BATCH_JOB_NAMEstatic intDEFAULT_LOWER_BOUND_MAX_PARALLELISMstatic StringDEFAULT_SLOT_SHARING_GROUPstatic StringDEFAULT_STREAMING_JOB_NAMEprotected static IntegeriterationIdCounter
-
Constructor Summary
Constructors Constructor Description StreamGraphGenerator(List<org.apache.flink.api.dag.Transformation<?>> transformations, org.apache.flink.api.common.ExecutionConfig executionConfig, CheckpointConfig checkpointConfig)StreamGraphGenerator(List<org.apache.flink.api.dag.Transformation<?>> transformations, org.apache.flink.api.common.ExecutionConfig executionConfig, CheckpointConfig checkpointConfig, org.apache.flink.configuration.Configuration configuration)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description StreamGraphgenerate()static intgetNewIterationNodeId()voidsetSavepointRestoreSettings(SavepointRestoreSettings savepointRestoreSettings)StreamGraphGeneratorsetSlotSharingGroupResource(Map<String,ResourceProfile> slotSharingGroupResources)Specify fine-grained resource requirements for slot sharing groups.
-
-
-
Field Detail
-
DEFAULT_LOWER_BOUND_MAX_PARALLELISM
public static final int DEFAULT_LOWER_BOUND_MAX_PARALLELISM
- See Also:
- Constant Field Values
-
DEFAULT_STREAMING_JOB_NAME
public static final String DEFAULT_STREAMING_JOB_NAME
- See Also:
- Constant Field Values
-
DEFAULT_BATCH_JOB_NAME
public static final String DEFAULT_BATCH_JOB_NAME
- See Also:
- Constant Field Values
-
DEFAULT_SLOT_SHARING_GROUP
public static final String DEFAULT_SLOT_SHARING_GROUP
- See Also:
- Constant Field Values
-
iterationIdCounter
protected static Integer iterationIdCounter
-
-
Constructor Detail
-
StreamGraphGenerator
public StreamGraphGenerator(List<org.apache.flink.api.dag.Transformation<?>> transformations, org.apache.flink.api.common.ExecutionConfig executionConfig, CheckpointConfig checkpointConfig)
-
StreamGraphGenerator
public StreamGraphGenerator(List<org.apache.flink.api.dag.Transformation<?>> transformations, org.apache.flink.api.common.ExecutionConfig executionConfig, CheckpointConfig checkpointConfig, org.apache.flink.configuration.Configuration configuration)
-
-
Method Detail
-
getNewIterationNodeId
public static int getNewIterationNodeId()
-
setSlotSharingGroupResource
public StreamGraphGenerator setSlotSharingGroupResource(Map<String,ResourceProfile> slotSharingGroupResources)
Specify fine-grained resource requirements for slot sharing groups.Note that a slot sharing group hints the scheduler that the grouped operators CAN be deployed into a shared slot. There's no guarantee that the scheduler always deploy the grouped operators together. In cases grouped operators are deployed into separate slots, the slot resources will be derived from the specified group requirements.
-
setSavepointRestoreSettings
public void setSavepointRestoreSettings(SavepointRestoreSettings savepointRestoreSettings)
-
generate
public StreamGraph generate()
-
-