Search in sources :

Example 1 with Controller

use of com.yahoo.vespa.hosted.controller.Controller in project vespa by vespa-engine.

the class VersionStatus method findConfigServerVersions.

private static ListMap<Version, String> findConfigServerVersions(Controller controller) {
    List<URI> configServers = controller.zoneRegistry().zones().controllerManaged().not().among(ZoneId.from("prod.cd-us-east-1a"), ZoneId.from("prod.aws-us-east-1a")).ids().stream().flatMap(zoneId -> controller.zoneRegistry().getConfigServerUris(zoneId).stream()).collect(Collectors.toList());
    ListMap<Version, String> versions = new ListMap<>();
    for (URI configServer : configServers) versions.put(controller.applications().configServer().version(configServer), configServer.getHost());
    return versions;
}
Also used : JobError.outOfCapacity(com.yahoo.vespa.hosted.controller.application.DeploymentJobs.JobError.outOfCapacity) Version(com.yahoo.component.Version) Vtag(com.yahoo.component.Vtag) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Level(java.util.logging.Level) ApplicationList(com.yahoo.vespa.hosted.controller.application.ApplicationList) HashSet(java.util.HashSet) ZoneId(com.yahoo.vespa.hosted.controller.api.integration.zone.ZoneId) ImmutableList(com.google.common.collect.ImmutableList) JobList(com.yahoo.vespa.hosted.controller.application.JobList) Map(java.util.Map) URI(java.net.URI) Application(com.yahoo.vespa.hosted.controller.Application) Collection(java.util.Collection) Set(java.util.Set) Instant(java.time.Instant) Logger(java.util.logging.Logger) Collectors(java.util.stream.Collectors) GitSha(com.yahoo.vespa.hosted.controller.api.integration.github.GitSha) List(java.util.List) Optional(java.util.Optional) Deployment(com.yahoo.vespa.hosted.controller.application.Deployment) Collections(java.util.Collections) ListMap(com.yahoo.collections.ListMap) Controller(com.yahoo.vespa.hosted.controller.Controller) Version(com.yahoo.component.Version) URI(java.net.URI) ListMap(com.yahoo.collections.ListMap)

Example 2 with Controller

use of com.yahoo.vespa.hosted.controller.Controller in project vespa by vespa-engine.

the class DeploymentTester method completeDeployment.

private void completeDeployment(Application application, ApplicationPackage applicationPackage, Optional<JobType> failOnJob, boolean includingProductionZones) {
    DeploymentOrder order = new DeploymentOrder(controller());
    List<JobType> jobs = order.jobsFrom(applicationPackage.deploymentSpec());
    if (!includingProductionZones)
        jobs = jobs.stream().filter(job -> !job.isProduction()).collect(Collectors.toList());
    for (JobType job : jobs) {
        boolean failJob = failOnJob.map(j -> j.equals(job)).orElse(false);
        deployAndNotify(application, applicationPackage, !failJob, false, job);
        if (failJob) {
            break;
        }
    }
    if (failOnJob.isPresent()) {
        assertTrue(applications().require(application.id()).change().isPresent());
        assertTrue(applications().require(application.id()).deploymentJobs().hasFailures());
    } else if (includingProductionZones) {
        assertFalse(applications().require(application.id()).change().isPresent());
    } else {
        assertTrue(applications().require(application.id()).change().isPresent());
    }
}
Also used : Version(com.yahoo.component.Version) ApplicationId(com.yahoo.config.provision.ApplicationId) DeploymentJobs(com.yahoo.vespa.hosted.controller.application.DeploymentJobs) JobControl(com.yahoo.vespa.hosted.controller.maintenance.JobControl) ArtifactRepositoryMock(com.yahoo.vespa.hosted.controller.ArtifactRepositoryMock) Change(com.yahoo.vespa.hosted.controller.application.Change) TenantId(com.yahoo.vespa.hosted.controller.api.identifiers.TenantId) Duration(java.time.Duration) Application(com.yahoo.vespa.hosted.controller.Application) Upgrader(com.yahoo.vespa.hosted.controller.maintenance.Upgrader) Environment(com.yahoo.config.provision.Environment) ApplicationController(com.yahoo.vespa.hosted.controller.ApplicationController) ConfigServerClientMock(com.yahoo.vespa.hosted.controller.ConfigServerClientMock) ManualClock(com.yahoo.test.ManualClock) Assert.assertTrue(org.junit.Assert.assertTrue) UUID(java.util.UUID) Collectors(java.util.stream.Collectors) ApplicationPackage(com.yahoo.vespa.hosted.controller.application.ApplicationPackage) JobType(com.yahoo.vespa.hosted.controller.application.DeploymentJobs.JobType) List(java.util.List) ControllerTester(com.yahoo.vespa.hosted.controller.ControllerTester) Assert.assertFalse(org.junit.Assert.assertFalse) Optional(java.util.Optional) BuildService(com.yahoo.vespa.hosted.controller.api.integration.BuildService) ReadyJobsTrigger(com.yahoo.vespa.hosted.controller.maintenance.ReadyJobsTrigger) VersionStatus(com.yahoo.vespa.hosted.controller.versions.VersionStatus) Controller(com.yahoo.vespa.hosted.controller.Controller) Assert.assertEquals(org.junit.Assert.assertEquals) JobType(com.yahoo.vespa.hosted.controller.application.DeploymentJobs.JobType)

Aggregations

Version (com.yahoo.component.Version)2 Application (com.yahoo.vespa.hosted.controller.Application)2 Controller (com.yahoo.vespa.hosted.controller.Controller)2 List (java.util.List)2 Optional (java.util.Optional)2 Collectors (java.util.stream.Collectors)2 ImmutableList (com.google.common.collect.ImmutableList)1 ListMap (com.yahoo.collections.ListMap)1 Vtag (com.yahoo.component.Vtag)1 ApplicationId (com.yahoo.config.provision.ApplicationId)1 Environment (com.yahoo.config.provision.Environment)1 ManualClock (com.yahoo.test.ManualClock)1 ApplicationController (com.yahoo.vespa.hosted.controller.ApplicationController)1 ArtifactRepositoryMock (com.yahoo.vespa.hosted.controller.ArtifactRepositoryMock)1 ConfigServerClientMock (com.yahoo.vespa.hosted.controller.ConfigServerClientMock)1 ControllerTester (com.yahoo.vespa.hosted.controller.ControllerTester)1 TenantId (com.yahoo.vespa.hosted.controller.api.identifiers.TenantId)1 BuildService (com.yahoo.vespa.hosted.controller.api.integration.BuildService)1 GitSha (com.yahoo.vespa.hosted.controller.api.integration.github.GitSha)1 ZoneId (com.yahoo.vespa.hosted.controller.api.integration.zone.ZoneId)1