Search in sources :

Example 1 with LocationPreferenceSlotSelectionStrategy

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;
    }
}
Also used : LocationPreferenceSlotSelectionStrategy(org.apache.flink.runtime.jobmaster.slotpool.LocationPreferenceSlotSelectionStrategy) SlotSelectionStrategy(org.apache.flink.runtime.jobmaster.slotpool.SlotSelectionStrategy) PreviousAllocationSlotSelectionStrategy(org.apache.flink.runtime.jobmaster.slotpool.PreviousAllocationSlotSelectionStrategy)

Aggregations

LocationPreferenceSlotSelectionStrategy (org.apache.flink.runtime.jobmaster.slotpool.LocationPreferenceSlotSelectionStrategy)1 PreviousAllocationSlotSelectionStrategy (org.apache.flink.runtime.jobmaster.slotpool.PreviousAllocationSlotSelectionStrategy)1 SlotSelectionStrategy (org.apache.flink.runtime.jobmaster.slotpool.SlotSelectionStrategy)1