Class DefaultVertexParallelismInfo
- java.lang.Object
-
- org.apache.flink.runtime.scheduler.DefaultVertexParallelismInfo
-
- All Implemented Interfaces:
VertexParallelismInformation
public class DefaultVertexParallelismInfo extends Object implements VertexParallelismInformation
AVertexParallelismInformation
implementation that provides common validation.
-
-
Field Summary
Fields Modifier and Type Field Description static int
PARALLELISM_AUTO_MAX
The constant to use for the parallelism, if the system should use the number of currently available slots.
-
Constructor Summary
Constructors Constructor Description DefaultVertexParallelismInfo(int minParallelism, int parallelism, int maxParallelism, Function<Integer,Optional<String>> rescaleMaxValidator)
DefaultVertexParallelismInfo(int parallelism, int maxParallelism, Function<Integer,Optional<String>> rescaleMaxValidator)
CreateVertexParallelismInformation
with max parallelism rescaling validation for a vertex.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canRescaleMaxParallelism(int desiredMaxParallelism)
Returns whether the vertex's max parallelism can be changed to a given value.int
getMaxParallelism()
Returns the vertex's max parallelism.int
getMinParallelism()
Returns a vertex's min parallelism.int
getParallelism()
Returns a vertex's parallelism.void
setMaxParallelism(int maxParallelism)
Changes a given vertex's max parallelism property.void
setParallelism(int parallelism)
Set a given vertex's parallelism property.
-
-
-
Field Detail
-
PARALLELISM_AUTO_MAX
public static final int PARALLELISM_AUTO_MAX
The constant to use for the parallelism, if the system should use the number of currently available slots.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DefaultVertexParallelismInfo
public DefaultVertexParallelismInfo(int parallelism, int maxParallelism, Function<Integer,Optional<String>> rescaleMaxValidator)
CreateVertexParallelismInformation
with max parallelism rescaling validation for a vertex.- Parameters:
parallelism
- the vertex's parallelismmaxParallelism
- the vertex's max parallelismrescaleMaxValidator
- the validation function to provide an error message if a max parallelism rescale is not allowed
-
-
Method Detail
-
getMinParallelism
public int getMinParallelism()
Description copied from interface:VertexParallelismInformation
Returns a vertex's min parallelism.- Specified by:
getMinParallelism
in interfaceVertexParallelismInformation
- Returns:
- the min parallelism for the vertex
-
getParallelism
public int getParallelism()
Description copied from interface:VertexParallelismInformation
Returns a vertex's parallelism.- Specified by:
getParallelism
in interfaceVertexParallelismInformation
- Returns:
- the parallelism for the vertex
-
getMaxParallelism
public int getMaxParallelism()
Description copied from interface:VertexParallelismInformation
Returns the vertex's max parallelism.- Specified by:
getMaxParallelism
in interfaceVertexParallelismInformation
- Returns:
- the max parallelism for the vertex
-
setParallelism
public void setParallelism(int parallelism)
Description copied from interface:VertexParallelismInformation
Set a given vertex's parallelism property. The parallelism can be changed only if the vertex parallelism was not decided yet (i.e. was -1).- Specified by:
setParallelism
in interfaceVertexParallelismInformation
- Parameters:
parallelism
- the parallelism for the vertex
-
setMaxParallelism
public void setMaxParallelism(int maxParallelism)
Description copied from interface:VertexParallelismInformation
Changes a given vertex's max parallelism property. The caller should first check the validity of the new setting viaVertexParallelismInformation.canRescaleMaxParallelism(int)
, otherwise this operation may fail.- Specified by:
setMaxParallelism
in interfaceVertexParallelismInformation
- Parameters:
maxParallelism
- the new max parallelism for the vertex
-
canRescaleMaxParallelism
public boolean canRescaleMaxParallelism(int desiredMaxParallelism)
Description copied from interface:VertexParallelismInformation
Returns whether the vertex's max parallelism can be changed to a given value.- Specified by:
canRescaleMaxParallelism
in interfaceVertexParallelismInformation
- Parameters:
desiredMaxParallelism
- the desired max parallelism for the vertex- Returns:
- whether the max parallelism can be changed to the given value
-
-