summaryrefslogtreecommitdiffstats
path: root/controller-server
diff options
context:
space:
mode:
authorJon Marius Venstad <jonmv@users.noreply.github.com>2017-08-29 10:46:02 +0200
committerGitHub <noreply@github.com>2017-08-29 10:46:02 +0200
commit835af22d7925caaa0f5abb498c43ed445bb43ea9 (patch)
treef289d08d0a723acc29e41e88864062e9d07c5ffc /controller-server
parent6c5dc8f0bdabeec182ee4ebe566080f8a7ff072f (diff)
parentbbed027737e3ad1a55bc403cb768adf53519b306 (diff)
Merge pull request #3242 from vespa-engine/mpolden/log-first-failing-time
Log the time when job started failing
Diffstat (limited to 'controller-server')
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/FailureRedeployer.java30
1 files changed, 14 insertions, 16 deletions
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/FailureRedeployer.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/FailureRedeployer.java
index 38d4a4a8a81..c3424b8d9af 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/FailureRedeployer.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/FailureRedeployer.java
@@ -3,14 +3,12 @@ package com.yahoo.vespa.hosted.controller.maintenance;
import com.yahoo.vespa.hosted.controller.Application;
import com.yahoo.vespa.hosted.controller.Controller;
-import com.yahoo.vespa.hosted.controller.application.DeploymentJobs.JobType;
import com.yahoo.vespa.hosted.controller.application.JobStatus;
import java.time.Duration;
import java.time.Instant;
import java.util.Comparator;
import java.util.List;
-import java.util.Map;
import java.util.Optional;
/**
@@ -41,9 +39,9 @@ public class FailureRedeployer extends Maintainer {
if (application.deploymentJobs().inProgress()) {
continue;
}
- Optional<Map.Entry<JobType, JobStatus>> failingJob = jobFailingFor(application);
- failingJob.ifPresent(job -> triggerFailing(application, "Job " + job.getKey().id() +
- " has been failing since " + job.getValue().lastCompleted().get()));
+ Optional<JobStatus> failingJob = jobFailingFor(application);
+ failingJob.ifPresent(job -> triggerFailing(application, "Job " + job.type().id() +
+ " has been failing since " + job.firstFailing().get()));
}
}
@@ -53,31 +51,31 @@ public class FailureRedeployer extends Maintainer {
if (!application.deploying().isPresent()) {
continue;
}
- Optional<Map.Entry<JobType, JobStatus>> job = oldestRunningJob(application);
+ Optional<JobStatus> job = oldestRunningJob(application);
if (!job.isPresent()) {
continue;
}
// Ignore job if it doesn't belong to a zone in this system
- if (!job.get().getKey().zone(controller().system()).isPresent()) {
+ if (!job.get().type().zone(controller().system()).isPresent()) {
continue;
}
- if (job.get().getValue().lastTriggered().get().at().isBefore(maxAge)) {
- triggerFailing(application, "Job " + job.get().getKey().id() +
+ if (job.get().lastTriggered().get().at().isBefore(maxAge)) {
+ triggerFailing(application, "Job " + job.get().type().id() +
" has been running for more than " + jobTimeout);
}
}
}
- private Optional<Map.Entry<JobType, JobStatus>> jobFailingFor(Application application) {
- return application.deploymentJobs().jobStatus().entrySet().stream()
- .filter(e -> !e.getValue().isSuccess() && e.getValue().lastCompletedFor(application.deploying().get()))
+ private Optional<JobStatus> jobFailingFor(Application application) {
+ return application.deploymentJobs().jobStatus().values().stream()
+ .filter(status -> !status.isSuccess() && status.lastCompletedFor(application.deploying().get()))
.findFirst();
}
- private Optional<Map.Entry<JobType, JobStatus>> oldestRunningJob(Application application) {
- return application.deploymentJobs().jobStatus().entrySet().stream()
- .filter(kv -> kv.getValue().inProgress())
- .sorted(Comparator.comparing(kv -> kv.getValue().lastTriggered().get().at()))
+ private Optional<JobStatus> oldestRunningJob(Application application) {
+ return application.deploymentJobs().jobStatus().values().stream()
+ .filter(JobStatus::inProgress)
+ .sorted(Comparator.comparing(status -> status.lastTriggered().get().at()))
.findFirst();
}