Class DefaultVertexParallelismInfo
java.lang.Object
org.apache.flink.runtime.scheduler.DefaultVertexParallelismInfo
- All Implemented Interfaces:
VertexParallelismInformation
A
VertexParallelismInformation implementation that provides common validation.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe constant to use for the parallelism, if the system should use the number of currently available slots. -
Constructor Summary
ConstructorsConstructorDescriptionDefaultVertexParallelismInfo(int minParallelism, int parallelism, int maxParallelism, Function<Integer, Optional<String>> rescaleMaxValidator) DefaultVertexParallelismInfo(int parallelism, int maxParallelism, Function<Integer, Optional<String>> rescaleMaxValidator) CreateVertexParallelismInformationwith max parallelism rescaling validation for a vertex. -
Method Summary
Modifier and TypeMethodDescriptionbooleancanRescaleMaxParallelism(int desiredMaxParallelism) Returns whether the vertex's max parallelism can be changed to a given value.intReturns the vertex's max parallelism.intReturns a vertex's min parallelism.intReturns a vertex's parallelism.voidsetMaxParallelism(int maxParallelism) Changes a given vertex's max parallelism property.voidsetParallelism(int parallelism) Set a given vertex's parallelism property.
-
Field Details
-
PARALLELISM_AUTO_MAX
public static final int PARALLELISM_AUTO_MAXThe constant to use for the parallelism, if the system should use the number of currently available slots.- See Also:
-
-
Constructor Details
-
DefaultVertexParallelismInfo
public DefaultVertexParallelismInfo(int parallelism, int maxParallelism, Function<Integer, Optional<String>> rescaleMaxValidator) CreateVertexParallelismInformationwith 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
-
DefaultVertexParallelismInfo
-
-
Method Details
-
getMinParallelism
public int getMinParallelism()Description copied from interface:VertexParallelismInformationReturns a vertex's min parallelism.- Specified by:
getMinParallelismin interfaceVertexParallelismInformation- Returns:
- the min parallelism for the vertex
-
getParallelism
public int getParallelism()Description copied from interface:VertexParallelismInformationReturns a vertex's parallelism.- Specified by:
getParallelismin interfaceVertexParallelismInformation- Returns:
- the parallelism for the vertex
-
getMaxParallelism
public int getMaxParallelism()Description copied from interface:VertexParallelismInformationReturns the vertex's max parallelism.- Specified by:
getMaxParallelismin interfaceVertexParallelismInformation- Returns:
- the max parallelism for the vertex
-
setParallelism
public void setParallelism(int parallelism) Description copied from interface:VertexParallelismInformationSet 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:
setParallelismin interfaceVertexParallelismInformation- Parameters:
parallelism- the parallelism for the vertex
-
setMaxParallelism
public void setMaxParallelism(int maxParallelism) Description copied from interface:VertexParallelismInformationChanges 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:
setMaxParallelismin interfaceVertexParallelismInformation- Parameters:
maxParallelism- the new max parallelism for the vertex
-
canRescaleMaxParallelism
public boolean canRescaleMaxParallelism(int desiredMaxParallelism) Description copied from interface:VertexParallelismInformationReturns whether the vertex's max parallelism can be changed to a given value.- Specified by:
canRescaleMaxParallelismin interfaceVertexParallelismInformation- Parameters:
desiredMaxParallelism- the desired max parallelism for the vertex- Returns:
- whether the max parallelism can be changed to the given value
-