Search in sources :

Example 1 with UnhealthyTasksLimitDisruptionBudgetPolicy

use of com.netflix.titus.api.jobmanager.model.job.disruptionbudget.UnhealthyTasksLimitDisruptionBudgetPolicy in project titus-control-plane by Netflix.

the class GrpcJobManagementModelConverters method toGrpcDisruptionBudget.

public static com.netflix.titus.grpc.protogen.JobDisruptionBudget toGrpcDisruptionBudget(DisruptionBudget coreDisruptionBudget) {
    JobDisruptionBudget.Builder builder = JobDisruptionBudget.newBuilder();
    DisruptionBudgetPolicy disruptionBudgetPolicy = coreDisruptionBudget.getDisruptionBudgetPolicy();
    if (disruptionBudgetPolicy instanceof SelfManagedDisruptionBudgetPolicy) {
        builder.setSelfManaged(JobDisruptionBudget.SelfManaged.newBuilder().setRelocationTimeMs(((SelfManagedDisruptionBudgetPolicy) disruptionBudgetPolicy).getRelocationTimeMs()));
    } else if (disruptionBudgetPolicy instanceof AvailabilityPercentageLimitDisruptionBudgetPolicy) {
        builder.setAvailabilityPercentageLimit(JobDisruptionBudget.AvailabilityPercentageLimit.newBuilder().setPercentageOfHealthyContainers(((AvailabilityPercentageLimitDisruptionBudgetPolicy) disruptionBudgetPolicy).getPercentageOfHealthyContainers()));
    } else if (disruptionBudgetPolicy instanceof UnhealthyTasksLimitDisruptionBudgetPolicy) {
        builder.setUnhealthyTasksLimit(JobDisruptionBudget.UnhealthyTasksLimit.newBuilder().setLimitOfUnhealthyContainers(((UnhealthyTasksLimitDisruptionBudgetPolicy) disruptionBudgetPolicy).getLimitOfUnhealthyContainers()));
    } else if (disruptionBudgetPolicy instanceof RelocationLimitDisruptionBudgetPolicy) {
        builder.setRelocationLimit(JobDisruptionBudget.RelocationLimit.newBuilder().setLimit(((RelocationLimitDisruptionBudgetPolicy) disruptionBudgetPolicy).getLimit()));
    }
    DisruptionBudgetRate disruptionBudgetRate = coreDisruptionBudget.getDisruptionBudgetRate();
    if (disruptionBudgetRate instanceof UnlimitedDisruptionBudgetRate) {
        builder.setRateUnlimited(JobDisruptionBudget.RateUnlimited.newBuilder().build());
    } else if (disruptionBudgetRate instanceof PercentagePerHourDisruptionBudgetRate) {
        builder.setRatePercentagePerHour(JobDisruptionBudget.RatePercentagePerHour.newBuilder().setMaxPercentageOfContainersRelocatedInHour(((PercentagePerHourDisruptionBudgetRate) disruptionBudgetRate).getMaxPercentageOfContainersRelocatedInHour()));
    } else if (disruptionBudgetRate instanceof RatePerIntervalDisruptionBudgetRate) {
        RatePerIntervalDisruptionBudgetRate ratePerInterval = (RatePerIntervalDisruptionBudgetRate) disruptionBudgetRate;
        builder.setRatePerInterval(JobDisruptionBudget.RatePerInterval.newBuilder().setIntervalMs(ratePerInterval.getIntervalMs()).setLimitPerInterval(ratePerInterval.getLimitPerInterval()).build());
    } else if (disruptionBudgetRate instanceof RatePercentagePerIntervalDisruptionBudgetRate) {
        RatePercentagePerIntervalDisruptionBudgetRate ratePercentagePerInterval = (RatePercentagePerIntervalDisruptionBudgetRate) disruptionBudgetRate;
        builder.setRatePercentagePerInterval(JobDisruptionBudget.RatePercentagePerInterval.newBuilder().setIntervalMs(ratePercentagePerInterval.getIntervalMs()).setPercentageLimitPerInterval(ratePercentagePerInterval.getPercentageLimitPerInterval()).build());
    }
    return builder.addAllTimeWindows(toGrpcTimeWindows(coreDisruptionBudget.getTimeWindows())).addAllContainerHealthProviders(toGrpcContainerHealthProviders(coreDisruptionBudget.getContainerHealthProviders())).build();
}
Also used : PercentagePerHourDisruptionBudgetRate(com.netflix.titus.api.jobmanager.model.job.disruptionbudget.PercentagePerHourDisruptionBudgetRate) RelocationLimitDisruptionBudgetPolicy(com.netflix.titus.api.jobmanager.model.job.disruptionbudget.RelocationLimitDisruptionBudgetPolicy) RatePerIntervalDisruptionBudgetRate(com.netflix.titus.api.jobmanager.model.job.disruptionbudget.RatePerIntervalDisruptionBudgetRate) JobDisruptionBudget(com.netflix.titus.grpc.protogen.JobDisruptionBudget) SelfManagedDisruptionBudgetPolicy(com.netflix.titus.api.jobmanager.model.job.disruptionbudget.SelfManagedDisruptionBudgetPolicy) AvailabilityPercentageLimitDisruptionBudgetPolicy(com.netflix.titus.api.jobmanager.model.job.disruptionbudget.AvailabilityPercentageLimitDisruptionBudgetPolicy) DisruptionBudgetPolicy(com.netflix.titus.api.jobmanager.model.job.disruptionbudget.DisruptionBudgetPolicy) RelocationLimitDisruptionBudgetPolicy(com.netflix.titus.api.jobmanager.model.job.disruptionbudget.RelocationLimitDisruptionBudgetPolicy) UnhealthyTasksLimitDisruptionBudgetPolicy(com.netflix.titus.api.jobmanager.model.job.disruptionbudget.UnhealthyTasksLimitDisruptionBudgetPolicy) SelfManagedDisruptionBudgetPolicy(com.netflix.titus.api.jobmanager.model.job.disruptionbudget.SelfManagedDisruptionBudgetPolicy) UnlimitedDisruptionBudgetRate(com.netflix.titus.api.jobmanager.model.job.disruptionbudget.UnlimitedDisruptionBudgetRate) RatePercentagePerIntervalDisruptionBudgetRate(com.netflix.titus.api.jobmanager.model.job.disruptionbudget.RatePercentagePerIntervalDisruptionBudgetRate) DisruptionBudgetRate(com.netflix.titus.api.jobmanager.model.job.disruptionbudget.DisruptionBudgetRate) UnlimitedDisruptionBudgetRate(com.netflix.titus.api.jobmanager.model.job.disruptionbudget.UnlimitedDisruptionBudgetRate) RatePercentagePerIntervalDisruptionBudgetRate(com.netflix.titus.api.jobmanager.model.job.disruptionbudget.RatePercentagePerIntervalDisruptionBudgetRate) PercentagePerHourDisruptionBudgetRate(com.netflix.titus.api.jobmanager.model.job.disruptionbudget.PercentagePerHourDisruptionBudgetRate) RatePerIntervalDisruptionBudgetRate(com.netflix.titus.api.jobmanager.model.job.disruptionbudget.RatePerIntervalDisruptionBudgetRate) UnhealthyTasksLimitDisruptionBudgetPolicy(com.netflix.titus.api.jobmanager.model.job.disruptionbudget.UnhealthyTasksLimitDisruptionBudgetPolicy) AvailabilityPercentageLimitDisruptionBudgetPolicy(com.netflix.titus.api.jobmanager.model.job.disruptionbudget.AvailabilityPercentageLimitDisruptionBudgetPolicy)

Example 2 with UnhealthyTasksLimitDisruptionBudgetPolicy

use of com.netflix.titus.api.jobmanager.model.job.disruptionbudget.UnhealthyTasksLimitDisruptionBudgetPolicy in project titus-control-plane by Netflix.

the class UnhealthyTasksLimitTrackerTest method testComputeHealthyPoolSizeFromAbsoluteLimit.

private void testComputeHealthyPoolSizeFromAbsoluteLimit(Job<?> job, int expectedHealthyPoolSize) {
    UnhealthyTasksLimitDisruptionBudgetPolicy policy = (UnhealthyTasksLimitDisruptionBudgetPolicy) job.getJobDescriptor().getDisruptionBudget().getDisruptionBudgetPolicy();
    assertThat(computeHealthyPoolSizeFromAbsoluteLimit(job, policy)).isEqualTo(expectedHealthyPoolSize);
}
Also used : UnhealthyTasksLimitDisruptionBudgetPolicy(com.netflix.titus.api.jobmanager.model.job.disruptionbudget.UnhealthyTasksLimitDisruptionBudgetPolicy)

Example 3 with UnhealthyTasksLimitDisruptionBudgetPolicy

use of com.netflix.titus.api.jobmanager.model.job.disruptionbudget.UnhealthyTasksLimitDisruptionBudgetPolicy in project titus-control-plane by Netflix.

the class JobQuotaController method buildQuotaTrackers.

@VisibleForTesting
static List<QuotaTracker> buildQuotaTrackers(Job<?> job, V3JobOperations jobOperations, EffectiveJobDisruptionBudgetResolver effectiveDisruptionBudgetResolver, ContainerHealthService containerHealthService, TitusRuntime titusRuntime) {
    List<QuotaTracker> quotaTrackers = new ArrayList<>();
    DisruptionBudget effectiveBudget = effectiveDisruptionBudgetResolver.resolve(job);
    if (!effectiveBudget.getTimeWindows().isEmpty()) {
        quotaTrackers.add(new TimeWindowQuotaTracker(effectiveBudget.getTimeWindows(), titusRuntime));
    }
    DisruptionBudgetPolicy policy = effectiveBudget.getDisruptionBudgetPolicy();
    if (policy instanceof AvailabilityPercentageLimitDisruptionBudgetPolicy) {
        quotaTrackers.add(UnhealthyTasksLimitTracker.percentageLimit(job, (AvailabilityPercentageLimitDisruptionBudgetPolicy) policy, jobOperations, containerHealthService));
    } else if (policy instanceof UnhealthyTasksLimitDisruptionBudgetPolicy) {
        quotaTrackers.add(UnhealthyTasksLimitTracker.absoluteLimit(job, (UnhealthyTasksLimitDisruptionBudgetPolicy) policy, jobOperations, containerHealthService));
    }
    return quotaTrackers;
}
Also used : TimeWindowQuotaTracker(com.netflix.titus.master.eviction.service.quota.TimeWindowQuotaTracker) QuotaTracker(com.netflix.titus.master.eviction.service.quota.QuotaTracker) UnhealthyTasksLimitDisruptionBudgetPolicy(com.netflix.titus.api.jobmanager.model.job.disruptionbudget.UnhealthyTasksLimitDisruptionBudgetPolicy) RelocationLimitDisruptionBudgetPolicy(com.netflix.titus.api.jobmanager.model.job.disruptionbudget.RelocationLimitDisruptionBudgetPolicy) DisruptionBudgetPolicy(com.netflix.titus.api.jobmanager.model.job.disruptionbudget.DisruptionBudgetPolicy) AvailabilityPercentageLimitDisruptionBudgetPolicy(com.netflix.titus.api.jobmanager.model.job.disruptionbudget.AvailabilityPercentageLimitDisruptionBudgetPolicy) DisruptionBudget(com.netflix.titus.api.jobmanager.model.job.disruptionbudget.DisruptionBudget) ArrayList(java.util.ArrayList) TimeWindowQuotaTracker(com.netflix.titus.master.eviction.service.quota.TimeWindowQuotaTracker) UnhealthyTasksLimitDisruptionBudgetPolicy(com.netflix.titus.api.jobmanager.model.job.disruptionbudget.UnhealthyTasksLimitDisruptionBudgetPolicy) AvailabilityPercentageLimitDisruptionBudgetPolicy(com.netflix.titus.api.jobmanager.model.job.disruptionbudget.AvailabilityPercentageLimitDisruptionBudgetPolicy) VisibleForTesting(com.google.common.annotations.VisibleForTesting)

Aggregations

UnhealthyTasksLimitDisruptionBudgetPolicy (com.netflix.titus.api.jobmanager.model.job.disruptionbudget.UnhealthyTasksLimitDisruptionBudgetPolicy)3 AvailabilityPercentageLimitDisruptionBudgetPolicy (com.netflix.titus.api.jobmanager.model.job.disruptionbudget.AvailabilityPercentageLimitDisruptionBudgetPolicy)2 DisruptionBudgetPolicy (com.netflix.titus.api.jobmanager.model.job.disruptionbudget.DisruptionBudgetPolicy)2 RelocationLimitDisruptionBudgetPolicy (com.netflix.titus.api.jobmanager.model.job.disruptionbudget.RelocationLimitDisruptionBudgetPolicy)2 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 DisruptionBudget (com.netflix.titus.api.jobmanager.model.job.disruptionbudget.DisruptionBudget)1 DisruptionBudgetRate (com.netflix.titus.api.jobmanager.model.job.disruptionbudget.DisruptionBudgetRate)1 PercentagePerHourDisruptionBudgetRate (com.netflix.titus.api.jobmanager.model.job.disruptionbudget.PercentagePerHourDisruptionBudgetRate)1 RatePerIntervalDisruptionBudgetRate (com.netflix.titus.api.jobmanager.model.job.disruptionbudget.RatePerIntervalDisruptionBudgetRate)1 RatePercentagePerIntervalDisruptionBudgetRate (com.netflix.titus.api.jobmanager.model.job.disruptionbudget.RatePercentagePerIntervalDisruptionBudgetRate)1 SelfManagedDisruptionBudgetPolicy (com.netflix.titus.api.jobmanager.model.job.disruptionbudget.SelfManagedDisruptionBudgetPolicy)1 UnlimitedDisruptionBudgetRate (com.netflix.titus.api.jobmanager.model.job.disruptionbudget.UnlimitedDisruptionBudgetRate)1 JobDisruptionBudget (com.netflix.titus.grpc.protogen.JobDisruptionBudget)1 QuotaTracker (com.netflix.titus.master.eviction.service.quota.QuotaTracker)1 TimeWindowQuotaTracker (com.netflix.titus.master.eviction.service.quota.TimeWindowQuotaTracker)1 ArrayList (java.util.ArrayList)1