use of com.mesosphere.sdk.scheduler.recovery.constrain.LaunchConstrainer in project dcos-commons by mesosphere.
the class SchedulerBuilder method getRecoveryPlanManager.
private PlanManager getRecoveryPlanManager(ServiceSpec serviceSpec, Optional<RecoveryPlanOverriderFactory> recoveryOverriderFactory, StateStore stateStore, ConfigStore<ServiceSpec> configStore, Collection<Plan> plans) {
List<RecoveryPlanOverrider> overrideRecoveryPlanManagers = new ArrayList<>();
if (recoveryOverriderFactory.isPresent()) {
logger.info("Adding overriding recovery plan manager.");
overrideRecoveryPlanManagers.add(recoveryOverriderFactory.get().create(stateStore, plans));
}
final LaunchConstrainer launchConstrainer;
final FailureMonitor failureMonitor;
if (serviceSpec.getReplacementFailurePolicy().isPresent()) {
ReplacementFailurePolicy failurePolicy = serviceSpec.getReplacementFailurePolicy().get();
launchConstrainer = new TimedLaunchConstrainer(Duration.ofMinutes(failurePolicy.getMinReplaceDelayMin()));
failureMonitor = new TimedFailureMonitor(Duration.ofMinutes(failurePolicy.getPermanentFailureTimoutMin()), stateStore, configStore);
} else {
launchConstrainer = new UnconstrainedLaunchConstrainer();
failureMonitor = new NeverFailureMonitor();
}
return new DefaultRecoveryPlanManager(stateStore, configStore, PlanUtils.getLaunchableTasks(plans), launchConstrainer, failureMonitor, overrideRecoveryPlanManagers);
}
Aggregations