Search in sources :

Example 1 with Application

use of com.yahoo.vespa.config.server.application.Application in project vespa by vespa-engine.

the class ActivatedModelsBuilder method buildModelVersion.

@Override
protected Application buildModelVersion(ModelFactory modelFactory, ApplicationPackage applicationPackage, ApplicationId applicationId, com.yahoo.component.Version wantedNodeVespaVersion, // Ignored since we have this in the app package for activated models
Optional<AllocatedHosts> ignored, Instant now) {
    log.log(LogLevel.DEBUG, String.format("Loading model version %s for session %s application %s", modelFactory.getVersion(), appGeneration, applicationId));
    ServerCache cache = zkClient.loadServerCache();
    ModelContext modelContext = new ModelContextImpl(applicationPackage, Optional.empty(), permanentApplicationPackage.get().applicationPackage(), logger, configDefinitionRepo, getForVersionOrLatest(applicationPackage.getFileRegistryMap(), modelFactory.getVersion()).orElse(new MockFileRegistry()), createStaticProvisioner(applicationPackage.getAllocatedHosts()), createModelContextProperties(applicationId), Optional.empty(), new com.yahoo.component.Version(modelFactory.getVersion().toString()), wantedNodeVespaVersion);
    MetricUpdater applicationMetricUpdater = metrics.getOrCreateMetricUpdater(Metrics.createDimensions(applicationId));
    return new Application(modelFactory.createModel(modelContext), cache, appGeneration, modelFactory.getVersion(), applicationMetricUpdater, applicationId);
}
Also used : ServerCache(com.yahoo.vespa.config.server.ServerCache) ModelContext(com.yahoo.config.model.api.ModelContext) MetricUpdater(com.yahoo.vespa.config.server.monitoring.MetricUpdater) ModelContextImpl(com.yahoo.vespa.config.server.deploy.ModelContextImpl) MockFileRegistry(com.yahoo.config.model.application.provider.MockFileRegistry) Application(com.yahoo.vespa.config.server.application.Application)

Example 2 with Application

use of com.yahoo.vespa.config.server.application.Application in project vespa by vespa-engine.

the class TenantRequestHandlerTest method testListConfigs.

@Test
public void testListConfigs() throws IOException, SAXException {
    assertdefaultAppNotFound();
    /*assertTrue(server.allConfigIds(ApplicationId.defaultId()).isEmpty());
        assertTrue(server.allConfigsProduced(ApplicationId.defaultId()).isEmpty());
        assertTrue(server.listConfigs(ApplicationId.defaultId(), false).isEmpty());
        assertTrue(server.listConfigs(ApplicationId.defaultId(), true).isEmpty());*/
    VespaModel model = new VespaModel(FilesApplicationPackage.fromFile(new File("src/test/apps/app")));
    server.reloadConfig(ApplicationSet.fromSingle(new Application(model, new ServerCache(), 1, vespaVersion, MetricUpdater.createTestUpdater(), ApplicationId.defaultId())));
    Set<ConfigKey<?>> configNames = server.listConfigs(ApplicationId.defaultId(), Optional.of(vespaVersion), false);
    assertTrue(configNames.contains(new ConfigKey<>("sentinel", "hosts", "cloud.config")));
    // for (ConfigKey<?> ck : configNames) {
    // assertTrue(!"".equals(ck.getConfigId()));
    // }
    configNames = server.listConfigs(ApplicationId.defaultId(), Optional.of(vespaVersion), true);
    System.out.println(configNames);
    assertTrue(configNames.contains(new ConfigKey<>("feeder", "jdisc", "vespaclient.config")));
    assertTrue(configNames.contains(new ConfigKey<>("documentmanager", "jdisc", "document.config")));
    assertTrue(configNames.contains(new ConfigKey<>("documentmanager", "", "document.config")));
    assertTrue(configNames.contains(new ConfigKey<>("documenttypes", "", "document")));
    assertTrue(configNames.contains(new ConfigKey<>("documentmanager", "jdisc", "document.config")));
    assertTrue(configNames.contains(new ConfigKey<>("health-monitor", "jdisc", "container.jdisc.config")));
    assertTrue(configNames.contains(new ConfigKey<>("specific", "jdisc", "project")));
}
Also used : ServerCache(com.yahoo.vespa.config.server.ServerCache) ConfigKey(com.yahoo.vespa.config.ConfigKey) VespaModel(com.yahoo.vespa.model.VespaModel) File(java.io.File) Application(com.yahoo.vespa.config.server.application.Application) Test(org.junit.Test)

Example 3 with Application

use of com.yahoo.vespa.config.server.application.Application in project vespa by vespa-engine.

the class TenantsTestCase method testListenersAdded.

@Test
public void testListenersAdded() throws IOException, SAXException {
    tenants.getTenant(tenant1).getReloadHandler().reloadConfig(ApplicationSet.fromSingle(new Application(new VespaModel(MockApplicationPackage.createEmpty()), new ServerCache(), 4l, Version.fromIntValues(1, 2, 3), MetricUpdater.createTestUpdater(), ApplicationId.defaultId())));
    assertThat(listener.reloaded.get(), is(1));
}
Also used : ServerCache(com.yahoo.vespa.config.server.ServerCache) VespaModel(com.yahoo.vespa.model.VespaModel) Application(com.yahoo.vespa.config.server.application.Application) Test(org.junit.Test)

Example 4 with Application

use of com.yahoo.vespa.config.server.application.Application in project vespa by vespa-engine.

the class ApplicationRepository method redeployAllApplications.

void redeployAllApplications() throws InterruptedException {
    ExecutorService executor = Executors.newFixedThreadPool(configserverConfig.numParallelTenantLoaders(), new DaemonThreadFactory("redeploy apps"));
    // Keep track of deployment per application
    Map<ApplicationId, Future<?>> futures = new HashMap<>();
    tenants.getAllTenants().forEach(tenant -> listApplicationIds(tenant).forEach(appId -> deployFromLocalActive(appId).ifPresent(deployment -> futures.put(appId, executor.submit(deployment::activate)))));
    for (Map.Entry<ApplicationId, Future<?>> f : futures.entrySet()) {
        try {
            f.getValue().get();
        } catch (ExecutionException e) {
            throw new RuntimeException("Redeploying of " + f.getKey() + " failed", e);
        }
    }
    executor.shutdown();
    // Timeout should never happen
    executor.awaitTermination(365, TimeUnit.DAYS);
}
Also used : ApplicationMetaData(com.yahoo.config.application.api.ApplicationMetaData) FileDistributionStatus(com.yahoo.vespa.config.server.application.FileDistributionStatus) RemoteSession(com.yahoo.vespa.config.server.session.RemoteSession) Inject(com.google.inject.Inject) Vtag(com.yahoo.component.Vtag) ApplicationFile(com.yahoo.config.application.api.ApplicationFile) ConfigserverConfig(com.yahoo.cloud.config.ConfigserverConfig) DeployLogger(com.yahoo.config.application.api.DeployLogger) TenantName(com.yahoo.config.provision.TenantName) LogServerLogGrabber(com.yahoo.vespa.config.server.application.LogServerLogGrabber) Future(java.util.concurrent.Future) Path(com.yahoo.path.Path) Rotations(com.yahoo.vespa.config.server.tenant.Rotations) Provisioner(com.yahoo.config.provision.Provisioner) Duration(java.time.Duration) Map(java.util.Map) LogLevel(com.yahoo.log.LogLevel) CompressedApplicationInputStream(com.yahoo.vespa.config.server.http.CompressedApplicationInputStream) URI(java.net.URI) Application(com.yahoo.vespa.config.server.application.Application) Instant(java.time.Instant) Logger(java.util.logging.Logger) Executors(java.util.concurrent.Executors) HostFilter(com.yahoo.config.provision.HostFilter) RestartActions(com.yahoo.vespa.config.server.configchange.RestartActions) List(java.util.List) HostProvisionerProvider(com.yahoo.vespa.config.server.provision.HostProvisionerProvider) Optional(java.util.Optional) DeployHandlerLogger(com.yahoo.vespa.config.server.deploy.DeployHandlerLogger) HttpResponse(com.yahoo.container.jdisc.HttpResponse) ConfigChangeActions(com.yahoo.vespa.config.server.configchange.ConfigChangeActions) Version(com.yahoo.component.Version) ApplicationId(com.yahoo.config.provision.ApplicationId) Slime(com.yahoo.slime.Slime) DaemonThreadFactory(com.yahoo.concurrent.DaemonThreadFactory) Tenant(com.yahoo.vespa.config.server.tenant.Tenant) HashMap(java.util.HashMap) IOUtils(com.yahoo.io.IOUtils) TenantApplications(com.yahoo.vespa.config.server.application.TenantApplications) ApplicationConvergenceChecker(com.yahoo.vespa.config.server.application.ApplicationConvergenceChecker) Level(java.util.logging.Level) RefeedActions(com.yahoo.vespa.config.server.configchange.RefeedActions) Files(com.google.common.io.Files) NestedTransaction(com.yahoo.transaction.NestedTransaction) PrepareParams(com.yahoo.vespa.config.server.session.PrepareParams) ExecutorService(java.util.concurrent.ExecutorService) HttpProxy(com.yahoo.vespa.config.server.application.HttpProxy) PrepareResult(com.yahoo.vespa.config.server.http.v2.PrepareResult) SilentDeployLogger(com.yahoo.vespa.config.server.session.SilentDeployLogger) LocalSessionRepo(com.yahoo.vespa.config.server.session.LocalSessionRepo) ApplicationSet(com.yahoo.vespa.config.server.application.ApplicationSet) Environment(com.yahoo.config.provision.Environment) IOException(java.io.IOException) Tenants(com.yahoo.vespa.config.server.tenant.Tenants) SessionFactory(com.yahoo.vespa.config.server.session.SessionFactory) File(java.io.File) Deployment(com.yahoo.vespa.config.server.deploy.Deployment) ExecutionException(java.util.concurrent.ExecutionException) TimeUnit(java.util.concurrent.TimeUnit) LocalSession(com.yahoo.vespa.config.server.session.LocalSession) SimpleHttpFetcher(com.yahoo.vespa.config.server.http.SimpleHttpFetcher) Clock(java.time.Clock) Session(com.yahoo.vespa.config.server.session.Session) InputStream(java.io.InputStream) HashMap(java.util.HashMap) DaemonThreadFactory(com.yahoo.concurrent.DaemonThreadFactory) ExecutorService(java.util.concurrent.ExecutorService) Future(java.util.concurrent.Future) ApplicationId(com.yahoo.config.provision.ApplicationId) ExecutionException(java.util.concurrent.ExecutionException) Map(java.util.Map) HashMap(java.util.HashMap)

Example 5 with Application

use of com.yahoo.vespa.config.server.application.Application in project vespa by vespa-engine.

the class ApplicationRepository method clusterControllerStatusPage.

public HttpResponse clusterControllerStatusPage(Tenant tenant, ApplicationId applicationId, String hostName, String pathSuffix) {
    Application application = getApplication(tenant, applicationId);
    // WARNING: pathSuffix may be given by the external user. Make sure no security issues arise...
    // We should be OK here, because at most, pathSuffix may change the parent path, but cannot otherwise
    // change the hostname and port. Exposing other paths on the cluster controller should be fine.
    // TODO: It would be nice to have a simple check to verify pathSuffix doesn't contain /../ components.
    String relativePath = "clustercontroller-status/" + pathSuffix;
    return httpProxy.get(application, hostName, "container-clustercontroller", relativePath);
}
Also used : Application(com.yahoo.vespa.config.server.application.Application)

Aggregations

Application (com.yahoo.vespa.config.server.application.Application)6 ServerCache (com.yahoo.vespa.config.server.ServerCache)4 ApplicationSet (com.yahoo.vespa.config.server.application.ApplicationSet)2 VespaModel (com.yahoo.vespa.model.VespaModel)2 Test (org.junit.Test)2 Files (com.google.common.io.Files)1 Inject (com.google.inject.Inject)1 ConfigserverConfig (com.yahoo.cloud.config.ConfigserverConfig)1 Version (com.yahoo.component.Version)1 Vtag (com.yahoo.component.Vtag)1 DaemonThreadFactory (com.yahoo.concurrent.DaemonThreadFactory)1 ApplicationFile (com.yahoo.config.application.api.ApplicationFile)1 ApplicationMetaData (com.yahoo.config.application.api.ApplicationMetaData)1 DeployLogger (com.yahoo.config.application.api.DeployLogger)1 ModelContext (com.yahoo.config.model.api.ModelContext)1 MockFileRegistry (com.yahoo.config.model.application.provider.MockFileRegistry)1 ApplicationId (com.yahoo.config.provision.ApplicationId)1 Environment (com.yahoo.config.provision.Environment)1 HostFilter (com.yahoo.config.provision.HostFilter)1 Provisioner (com.yahoo.config.provision.Provisioner)1