diff options
author | Jon Marius Venstad <venstad@gmail.com> | 2021-08-19 12:05:35 +0200 |
---|---|---|
committer | Jon Marius Venstad <venstad@gmail.com> | 2021-08-19 12:05:35 +0200 |
commit | a36f3ee1bedc1917e8ff1aeddcaa3b81f6dfe54e (patch) | |
tree | ede07fd593f341c1b097ad319d83c8e6261bd7eb /controller-server | |
parent | d360cfdd5dc6dc5c6475c17dc6b961786e6b7c34 (diff) |
Remove dead code
Diffstat (limited to 'controller-server')
-rw-r--r-- | controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTrigger.java | 71 |
1 files changed, 0 insertions, 71 deletions
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTrigger.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTrigger.java index aab4e943b94..30e731853f2 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTrigger.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTrigger.java @@ -289,10 +289,6 @@ public class DeploymentTrigger { return controller.applications(); } - private Optional<Deployment> deploymentFor(Instance instance, JobType jobType) { - return Optional.ofNullable(instance.deployments().get(jobType.zone(controller.system()))); - } - // ---------- Ready job computation ---------- /** Returns the set of all jobs which have changes to propagate from the upstream steps. */ @@ -339,73 +335,6 @@ public class DeploymentTrigger { return false; } - /** Returns whether the given job can trigger at the given instant */ - public boolean triggerAt(Instant instant, JobType job, JobStatus jobStatus, Versions versions, Instance instance, DeploymentSpec deploymentSpec) { - if (instance.jobPause(job).map(until -> until.isAfter(clock.instant())).orElse(false)) return false; - if (jobStatus.lastTriggered().isEmpty()) return true; - if (jobStatus.isSuccess()) return true; // Success - if (jobStatus.lastCompleted().isEmpty()) return true; // Never completed - if (jobStatus.firstFailing().isEmpty()) return true; // Should not happen as firstFailing should be set for an unsuccessful job - if ( ! versions.targetsMatch(jobStatus.lastCompleted().get().versions())) return true; // Always trigger as targets have changed - if (deploymentSpec.requireInstance(instance.name()).upgradePolicy() == DeploymentSpec.UpgradePolicy.canary) return true; // Don't throttle canaries - - Instant firstFailing = jobStatus.firstFailing().get().end().get(); - Instant lastCompleted = jobStatus.lastCompleted().get().end().get(); - - // Retry all errors immediately for 1 minute - if (firstFailing.isAfter(instant.minus(Duration.ofMinutes(1)))) return true; - - // Retry out of capacity errors in test environments every minute - if (job.environment().isTest() && jobStatus.isOutOfCapacity()) { - return lastCompleted.isBefore(instant.minus(Duration.ofMinutes(1))); - } - - // Retry other errors - if (firstFailing.isAfter(instant.minus(Duration.ofHours(1)))) { // If we failed within the last hour ... - return lastCompleted.isBefore(instant.minus(Duration.ofMinutes(10))); // ... retry every 10 minutes - } - return lastCompleted.isBefore(instant.minus(Duration.ofHours(2))); // Retry at most every 2 hours - } - - // ---------- Completion logic ---------- - - /** - * Returns whether the given change is complete for the given application for the given job. - * - * Any job is complete if the given change is already successful on that job. - * A production job is also considered complete if its current change is strictly dominated by what - * is already deployed in its zone, i.e., no parts of the change are upgrades, and the full current - * change for the application downgrades the deployment, which is an acknowledgement that the deployed - * version is broken somehow, such that the job may be locked in failure until a new version is released. - * - * Additionally, if the application is pinned to a Vespa version, and the given change has a (this) platform, - * the deployment for the job must be on the pinned version. - */ - public boolean isComplete(Change change, Change fullChange, Instance instance, JobType jobType, - JobStatus status) { - Optional<Deployment> existingDeployment = deploymentFor(instance, jobType); - if ( change.isPinned() - && change.platform().isPresent() - && ! existingDeployment.map(Deployment::version).equals(change.platform())) - return false; - - return status.lastSuccess() - .map(run -> change.platform().map(run.versions().targetPlatform()::equals).orElse(true) - && change.application().map(run.versions().targetApplication()::equals).orElse(true)) - .orElse(false) - || jobType.isProduction() - && existingDeployment.map(deployment -> ! isUpgrade(change, deployment) && isDowngrade(fullChange, deployment)) - .orElse(false); - } - - private static boolean isUpgrade(Change change, Deployment deployment) { - return change.upgrades(deployment.version()) || change.upgrades(deployment.applicationVersion()); - } - - private static boolean isDowngrade(Change change, Deployment deployment) { - return change.downgrades(deployment.version()) || change.downgrades(deployment.applicationVersion()); - } - // ---------- Change management o_O ---------- private boolean acceptNewApplicationVersion(DeploymentStatus status, InstanceName instance) { |