Class DefaultVertexParallelismInfo
- java.lang.Object
-
- org.apache.flink.runtime.scheduler.DefaultVertexParallelismInfo
-
- All Implemented Interfaces:
VertexParallelismInformation
public class DefaultVertexParallelismInfo extends Object implements VertexParallelismInformation
AVertexParallelismInformationimplementation that provides common validation.
-
-
Field Summary
Fields Modifier and Type Field Description static intPARALLELISM_AUTO_MAXThe 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)CreateVertexParallelismInformationwith max parallelism rescaling validation for a vertex.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancanRescaleMaxParallelism(int desiredMaxParallelism)Returns whether the vertex's max parallelism can be changed to a given value.intgetMaxParallelism()Returns the vertex's max parallelism.intgetMinParallelism()Returns a vertex's min parallelism.intgetParallelism()Returns 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 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)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
-
-
Method Detail
-
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
-
-