use of org.apache.flink.runtime.scheduler.adaptivebatch.AdaptiveBatchSchedulerFactory in project flink by apache.
the class DefaultSlotPoolServiceSchedulerFactory method fromConfiguration.
public static DefaultSlotPoolServiceSchedulerFactory fromConfiguration(Configuration configuration, JobType jobType) {
final Time rpcTimeout = Time.fromDuration(configuration.get(AkkaOptions.ASK_TIMEOUT_DURATION));
final Time slotIdleTimeout = Time.milliseconds(configuration.getLong(JobManagerOptions.SLOT_IDLE_TIMEOUT));
final Time batchSlotTimeout = Time.milliseconds(configuration.getLong(JobManagerOptions.SLOT_REQUEST_TIMEOUT));
final SlotPoolServiceFactory slotPoolServiceFactory;
final SchedulerNGFactory schedulerNGFactory;
JobManagerOptions.SchedulerType schedulerType = ClusterOptions.getSchedulerType(configuration);
if (schedulerType == JobManagerOptions.SchedulerType.Adaptive && jobType == JobType.BATCH) {
LOG.info("Adaptive Scheduler configured, but Batch job detected. Changing scheduler type to NG / DefaultScheduler.");
// overwrite
schedulerType = JobManagerOptions.SchedulerType.Ng;
}
switch(schedulerType) {
case Ng:
schedulerNGFactory = new DefaultSchedulerFactory();
slotPoolServiceFactory = new DeclarativeSlotPoolBridgeServiceFactory(SystemClock.getInstance(), rpcTimeout, slotIdleTimeout, batchSlotTimeout, getRequestSlotMatchingStrategy(configuration, jobType));
break;
case Adaptive:
schedulerNGFactory = getAdaptiveSchedulerFactoryFromConfiguration(configuration);
slotPoolServiceFactory = new DeclarativeSlotPoolServiceFactory(SystemClock.getInstance(), slotIdleTimeout, rpcTimeout);
break;
case AdaptiveBatch:
schedulerNGFactory = new AdaptiveBatchSchedulerFactory();
slotPoolServiceFactory = new DeclarativeSlotPoolBridgeServiceFactory(SystemClock.getInstance(), rpcTimeout, slotIdleTimeout, batchSlotTimeout, getRequestSlotMatchingStrategy(configuration, jobType));
break;
default:
throw new IllegalArgumentException(String.format("Illegal value [%s] for config option [%s]", schedulerType, JobManagerOptions.SCHEDULER.key()));
}
return new DefaultSlotPoolServiceSchedulerFactory(slotPoolServiceFactory, schedulerNGFactory);
}
Aggregations