Search in sources :

Example 51 with Application

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);
}
Also used : ApplicationList(com.yahoo.vespa.hosted.controller.application.ApplicationList) Application(com.yahoo.vespa.hosted.controller.Application) LockedApplication(com.yahoo.vespa.hosted.controller.LockedApplication)

Example 52 with Application

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;
}
Also used : Version(com.yahoo.component.Version) ApplicationId(com.yahoo.config.provision.ApplicationId) JobReport(com.yahoo.vespa.hosted.controller.application.DeploymentJobs.JobReport) ApplicationList(com.yahoo.vespa.hosted.controller.application.ApplicationList) JobList(com.yahoo.vespa.hosted.controller.application.JobList) Change(com.yahoo.vespa.hosted.controller.application.Change) Duration(java.time.Duration) JobStatus(com.yahoo.vespa.hosted.controller.application.JobStatus) Application(com.yahoo.vespa.hosted.controller.Application) LockedApplication(com.yahoo.vespa.hosted.controller.LockedApplication) ApplicationController(com.yahoo.vespa.hosted.controller.ApplicationController) Collection(java.util.Collection) ApplicationVersion(com.yahoo.vespa.hosted.controller.application.ApplicationVersion) CuratorDb(com.yahoo.vespa.hosted.controller.persistence.CuratorDb) Instant(java.time.Instant) Logger(java.util.logging.Logger) JobError(com.yahoo.vespa.hosted.controller.application.DeploymentJobs.JobError) Objects(java.util.Objects) JobType(com.yahoo.vespa.hosted.controller.application.DeploymentJobs.JobType) List(java.util.List) Stream(java.util.stream.Stream) SystemName(com.yahoo.config.provision.SystemName) Clock(java.time.Clock) Optional(java.util.Optional) Deployment(com.yahoo.vespa.hosted.controller.application.Deployment) Collections(java.util.Collections) Controller(com.yahoo.vespa.hosted.controller.Controller) Deployment(com.yahoo.vespa.hosted.controller.application.Deployment)

Example 53 with Application

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);
            }
        }
    }
}
Also used : DeploymentId(com.yahoo.vespa.hosted.controller.api.identifiers.DeploymentId) ClusterInfo(com.yahoo.vespa.hosted.controller.application.ClusterInfo) NodeList(com.yahoo.vespa.hosted.controller.api.integration.noderepository.NodeList) Deployment(com.yahoo.vespa.hosted.controller.application.Deployment) DeploymentId(com.yahoo.vespa.hosted.controller.api.identifiers.DeploymentId) ZoneId(com.yahoo.vespa.hosted.controller.api.integration.zone.ZoneId) IOException(java.io.IOException) Application(com.yahoo.vespa.hosted.controller.Application)

Example 54 with Application

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);
}
Also used : ApplicationId(com.yahoo.config.provision.ApplicationId) Application(com.yahoo.vespa.hosted.controller.Application)

Example 55 with Application

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;
        }
    }
}
Also used : DeploymentMetrics(com.yahoo.vespa.hosted.controller.application.DeploymentMetrics) MetricsService(com.yahoo.vespa.hosted.controller.api.integration.MetricsService) Deployment(com.yahoo.vespa.hosted.controller.application.Deployment) UncheckedIOException(java.io.UncheckedIOException) Application(com.yahoo.vespa.hosted.controller.Application)

Aggregations

Application (com.yahoo.vespa.hosted.controller.Application)75 Test (org.junit.Test)52 ApplicationPackage (com.yahoo.vespa.hosted.controller.application.ApplicationPackage)40 JobType.systemTest (com.yahoo.vespa.hosted.controller.application.DeploymentJobs.JobType.systemTest)34 Version (com.yahoo.component.Version)32 JobType.stagingTest (com.yahoo.vespa.hosted.controller.application.DeploymentJobs.JobType.stagingTest)28 ApplicationPackageBuilder (com.yahoo.vespa.hosted.controller.deployment.ApplicationPackageBuilder)26 DeploymentTester (com.yahoo.vespa.hosted.controller.deployment.DeploymentTester)25 Deployment (com.yahoo.vespa.hosted.controller.application.Deployment)15 VespaVersion (com.yahoo.vespa.hosted.controller.versions.VespaVersion)14 ApplicationId (com.yahoo.config.provision.ApplicationId)13 LockedApplication (com.yahoo.vespa.hosted.controller.LockedApplication)12 Slime (com.yahoo.slime.Slime)11 ControllerTester (com.yahoo.vespa.hosted.controller.ControllerTester)9 TenantId (com.yahoo.vespa.hosted.controller.api.identifiers.TenantId)8 ZoneId (com.yahoo.vespa.hosted.controller.api.integration.zone.ZoneId)8 ApplicationVersion (com.yahoo.vespa.hosted.controller.application.ApplicationVersion)8 SlimeJsonResponse (com.yahoo.vespa.hosted.controller.restapi.SlimeJsonResponse)7 Cursor (com.yahoo.slime.Cursor)6 Controller (com.yahoo.vespa.hosted.controller.Controller)6