Search in sources :

Example 1 with FailureMonitor

use of com.mesosphere.sdk.scheduler.recovery.monitor.FailureMonitor 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);
}
Also used : RecoveryPlanOverrider(com.mesosphere.sdk.scheduler.recovery.RecoveryPlanOverrider) UnconstrainedLaunchConstrainer(com.mesosphere.sdk.scheduler.recovery.constrain.UnconstrainedLaunchConstrainer) TimedLaunchConstrainer(com.mesosphere.sdk.scheduler.recovery.constrain.TimedLaunchConstrainer) LaunchConstrainer(com.mesosphere.sdk.scheduler.recovery.constrain.LaunchConstrainer) TimedLaunchConstrainer(com.mesosphere.sdk.scheduler.recovery.constrain.TimedLaunchConstrainer) TimedFailureMonitor(com.mesosphere.sdk.scheduler.recovery.monitor.TimedFailureMonitor) DefaultRecoveryPlanManager(com.mesosphere.sdk.scheduler.recovery.DefaultRecoveryPlanManager) UnconstrainedLaunchConstrainer(com.mesosphere.sdk.scheduler.recovery.constrain.UnconstrainedLaunchConstrainer) TimedFailureMonitor(com.mesosphere.sdk.scheduler.recovery.monitor.TimedFailureMonitor) NeverFailureMonitor(com.mesosphere.sdk.scheduler.recovery.monitor.NeverFailureMonitor) FailureMonitor(com.mesosphere.sdk.scheduler.recovery.monitor.FailureMonitor) NeverFailureMonitor(com.mesosphere.sdk.scheduler.recovery.monitor.NeverFailureMonitor)

Aggregations

DefaultRecoveryPlanManager (com.mesosphere.sdk.scheduler.recovery.DefaultRecoveryPlanManager)1 RecoveryPlanOverrider (com.mesosphere.sdk.scheduler.recovery.RecoveryPlanOverrider)1 LaunchConstrainer (com.mesosphere.sdk.scheduler.recovery.constrain.LaunchConstrainer)1 TimedLaunchConstrainer (com.mesosphere.sdk.scheduler.recovery.constrain.TimedLaunchConstrainer)1 UnconstrainedLaunchConstrainer (com.mesosphere.sdk.scheduler.recovery.constrain.UnconstrainedLaunchConstrainer)1 FailureMonitor (com.mesosphere.sdk.scheduler.recovery.monitor.FailureMonitor)1 NeverFailureMonitor (com.mesosphere.sdk.scheduler.recovery.monitor.NeverFailureMonitor)1 TimedFailureMonitor (com.mesosphere.sdk.scheduler.recovery.monitor.TimedFailureMonitor)1