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);
}
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")));
}
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));
}
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);
}
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);
}
Aggregations