use of org.apache.flink.runtime.jobmaster.slotpool.LocationPreferenceSlotSelectionStrategy in project flink by apache.
the class SlotSelectionStrategyUtils method selectSlotSelectionStrategy.
public static SlotSelectionStrategy selectSlotSelectionStrategy(final JobType jobType, final Configuration configuration) {
final boolean evenlySpreadOutSlots = configuration.getBoolean(ClusterOptions.EVENLY_SPREAD_OUT_SLOTS_STRATEGY);
final SlotSelectionStrategy locationPreferenceSlotSelectionStrategy;
locationPreferenceSlotSelectionStrategy = evenlySpreadOutSlots ? LocationPreferenceSlotSelectionStrategy.createEvenlySpreadOut() : LocationPreferenceSlotSelectionStrategy.createDefault();
final boolean isLocalRecoveryEnabled = configuration.getBoolean(CheckpointingOptions.LOCAL_RECOVERY);
if (isLocalRecoveryEnabled) {
if (jobType == JobType.STREAMING) {
return PreviousAllocationSlotSelectionStrategy.create(locationPreferenceSlotSelectionStrategy);
} else {
LOG.warn("Batch job does not support local recovery. Falling back to use " + locationPreferenceSlotSelectionStrategy.getClass());
return locationPreferenceSlotSelectionStrategy;
}
} else {
return locationPreferenceSlotSelectionStrategy;
}
}
Aggregations