use of com.yahoo.vespa.hosted.controller.Application in project vespa by vespa-engine.
the class DeploymentTrigger method triggerReadyJobs.
/**
* Find jobs that can and should run but are currently not.
*/
public void triggerReadyJobs() {
ApplicationList applications = ApplicationList.from(applications().asList());
applications = applications.notPullRequest();
for (Application application : applications.asList()) applications().lockIfPresent(application.id(), this::triggerReadyJobs);
}
use of com.yahoo.vespa.hosted.controller.Application in project vespa by vespa-engine.
the class DeploymentTrigger method changeDeployed.
/**
* Returns whether the given application should skip deployment of its current change to the given production job zone.
*
* If the currently deployed application has a newer platform or application version than the application's
* current change, the method returns {@code true}, to avoid a downgrade.
* Otherwise, it returns whether the current change is redundant, i.e., all its components are already deployed.
*/
private boolean changeDeployed(Application application, JobType job) {
if (!job.isProduction())
throw new IllegalArgumentException(job + " is not a production job!");
Deployment deployment = application.deployments().get(job.zone(controller.system()).get());
if (deployment == null)
return false;
int applicationComparison = application.change().application().map(version -> version.compareTo(deployment.applicationVersion())).orElse(0);
int platformComparion = application.change().platform().map(version -> version.compareTo(deployment.version())).orElse(0);
if (applicationComparison == -1 || platformComparion == -1)
// Avoid downgrades!
return true;
return applicationComparison == 0 && platformComparion == 0;
}
use of com.yahoo.vespa.hosted.controller.Application in project vespa by vespa-engine.
the class ClusterInfoMaintainer method maintain.
@Override
protected void maintain() {
for (Application application : ApplicationList.from(controller().applications().asList()).notPullRequest().asList()) {
for (Deployment deployment : application.deployments().values()) {
DeploymentId deploymentId = new DeploymentId(application.id(), deployment.zone());
try {
NodeList nodes = controller.nodeRepositoryClient().listNodes(deploymentId.zoneId(), deploymentId.applicationId().tenant().value(), deploymentId.applicationId().application().value(), deploymentId.applicationId().instance().value());
Map<ClusterSpec.Id, ClusterInfo> clusterInfo = getClusterInfo(nodes, deployment.zone());
controller().applications().lockIfPresent(application.id(), lockedApplication -> controller.applications().store(lockedApplication.withClusterInfo(deployment.zone(), clusterInfo)));
} catch (IOException | IllegalArgumentException e) {
log.log(Level.WARNING, "Failing getting cluster info of for " + deploymentId, e);
}
}
}
}
use of com.yahoo.vespa.hosted.controller.Application in project vespa by vespa-engine.
the class DeploymentIssueReporter method maintainDeploymentIssues.
/**
* File issues for applications which have failed deployment for longer than maxFailureAge
* and store the issue id for the filed issues. Also, clear the issueIds of applications
* where deployment has not failed for this amount of time.
*/
private void maintainDeploymentIssues(List<Application> applications) {
Set<ApplicationId> failingApplications = ApplicationList.from(applications).failingApplicationChangeSince(controller().clock().instant().minus(maxFailureAge)).asList().stream().map(Application::id).collect(Collectors.toSet());
for (Application application : applications) if (failingApplications.contains(application.id()))
fileDeploymentIssueFor(application.id());
else
store(application.id(), null);
}
use of com.yahoo.vespa.hosted.controller.Application in project vespa by vespa-engine.
the class DeploymentMetricsMaintainer method maintain.
@Override
protected void maintain() {
boolean hasWarned = false;
for (Application application : ApplicationList.from(controller().applications().asList()).notPullRequest().asList()) {
try {
controller().applications().lockIfPresent(application.id(), lockedApplication -> controller().applications().store(lockedApplication.with(controller().metricsService().getApplicationMetrics(application.id()))));
for (Deployment deployment : application.deployments().values()) {
MetricsService.DeploymentMetrics deploymentMetrics = controller().metricsService().getDeploymentMetrics(application.id(), deployment.zone());
DeploymentMetrics appMetrics = new DeploymentMetrics(deploymentMetrics.queriesPerSecond(), deploymentMetrics.writesPerSecond(), deploymentMetrics.documentCount(), deploymentMetrics.queryLatencyMillis(), deploymentMetrics.writeLatencyMillis());
controller().applications().lockIfPresent(application.id(), lockedApplication -> controller().applications().store(lockedApplication.with(deployment.zone(), appMetrics)));
}
} catch (UncheckedIOException e) {
if (// produce only one warning per maintenance interval
!hasWarned)
log.log(Level.WARNING, "Failed talking to YAMAS: " + Exceptions.toMessageString(e) + ". Retrying in " + maintenanceInterval());
hasWarned = true;
}
}
}
Aggregations