Package org.apache.flink.autoscaler
Class JobAutoScalerImpl<KEY,Context extends JobAutoScalerContext<KEY>>
- java.lang.Object
-
- org.apache.flink.autoscaler.JobAutoScalerImpl<KEY,Context>
-
- All Implemented Interfaces:
JobAutoScaler<KEY,Context>
public class JobAutoScalerImpl<KEY,Context extends JobAutoScalerContext<KEY>> extends java.lang.Object implements JobAutoScaler<KEY,Context>
The default implementation ofJobAutoScaler
.
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.String
AUTOSCALER_ERROR
-
Constructor Summary
Constructors Constructor Description JobAutoScalerImpl(ScalingMetricCollector<KEY,Context> metricsCollector, ScalingMetricEvaluator evaluator, ScalingExecutor<KEY,Context> scalingExecutor, AutoScalerEventHandler<KEY,Context> eventHandler, ScalingRealizer<KEY,Context> scalingRealizer, AutoScalerStateStore<KEY,Context> stateStore)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
applyParallelismOverrides(Context ctx)
If there are any parallelism overrides by theJobAutoScaler
apply them to the scalingRealizer.void
cleanup(KEY jobKey)
Called when the job is deleted.protected java.util.Map<java.lang.String,java.lang.String>
getParallelismOverrides(Context ctx)
void
scale(Context ctx)
Compute and apply new parallelism overrides for the provided job context.
-
-
-
Field Detail
-
AUTOSCALER_ERROR
@VisibleForTesting protected static final java.lang.String AUTOSCALER_ERROR
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
JobAutoScalerImpl
public JobAutoScalerImpl(ScalingMetricCollector<KEY,Context> metricsCollector, ScalingMetricEvaluator evaluator, ScalingExecutor<KEY,Context> scalingExecutor, AutoScalerEventHandler<KEY,Context> eventHandler, ScalingRealizer<KEY,Context> scalingRealizer, AutoScalerStateStore<KEY,Context> stateStore)
-
-
Method Detail
-
scale
public void scale(Context ctx) throws java.lang.Exception
Description copied from interface:JobAutoScaler
Compute and apply new parallelism overrides for the provided job context.- Specified by:
scale
in interfaceJobAutoScaler<KEY,Context extends JobAutoScalerContext<KEY>>
- Parameters:
ctx
- Job context.- Throws:
java.lang.Exception
-
cleanup
public void cleanup(KEY jobKey)
Description copied from interface:JobAutoScaler
Called when the job is deleted.- Specified by:
cleanup
in interfaceJobAutoScaler<KEY,Context extends JobAutoScalerContext<KEY>>
- Parameters:
jobKey
- Job key.
-
getParallelismOverrides
@VisibleForTesting protected java.util.Map<java.lang.String,java.lang.String> getParallelismOverrides(Context ctx) throws java.lang.Exception
- Throws:
java.lang.Exception
-
applyParallelismOverrides
@VisibleForTesting protected void applyParallelismOverrides(Context ctx) throws java.lang.Exception
If there are any parallelism overrides by theJobAutoScaler
apply them to the scalingRealizer.- Parameters:
ctx
- Job context- Throws:
java.lang.Exception
-
-