Search in sources :

Example 6 with ApplicationId

use of com.yahoo.config.provision.ApplicationId in project vespa by vespa-engine.

the class TenantRequestHandler method setLiveApp.

private void setLiveApp(ApplicationSet applicationSet) {
    ApplicationId id = applicationSet.getId();
    final Collection<String> hostsForApp = applicationSet.getAllHosts();
    hostRegistry.update(id, hostsForApp);
    applicationSet.updateHostMetrics();
    tenantMetricUpdater.setApplications(applicationMapper.numApplications());
    applicationMapper.register(id, applicationSet);
}
Also used : ApplicationId(com.yahoo.config.provision.ApplicationId)

Example 7 with ApplicationId

use of com.yahoo.config.provision.ApplicationId in project vespa by vespa-engine.

the class TenantRequestHandler method removeApplicationsExcept.

@Override
public void removeApplicationsExcept(Set<ApplicationId> applications) {
    for (ApplicationId activeApplication : applicationMapper.listApplicationIds()) {
        if (!applications.contains(activeApplication)) {
            log.log(LogLevel.INFO, "Will remove deleted application " + activeApplication.toShortString());
            removeApplication(activeApplication);
        }
    }
}
Also used : ApplicationId(com.yahoo.config.provision.ApplicationId)

Example 8 with ApplicationId

use of com.yahoo.config.provision.ApplicationId in project vespa by vespa-engine.

the class SuperModelConfigProvider method getConfig.

public <CONFIGTYPE extends ConfigInstance> CONFIGTYPE getConfig(Class<CONFIGTYPE> configClass, ApplicationId applicationId, String configId) {
    TenantName tenant = applicationId.tenant();
    if (!superModel.getAllModels().containsKey(tenant)) {
        throw new IllegalArgumentException("Tenant " + tenant + " not found");
    }
    Map<ApplicationId, ApplicationInfo> applications = superModel.getAllModels().get(tenant);
    if (!applications.containsKey(applicationId)) {
        throw new IllegalArgumentException("Application id " + applicationId + " not found");
    }
    ApplicationInfo application = applications.get(applicationId);
    ConfigKey<CONFIGTYPE> key = new ConfigKey<>(configClass, configId);
    ConfigPayload payload = application.getModel().getConfig(key, null);
    return payload.toInstance(configClass, configId);
}
Also used : ConfigKey(com.yahoo.vespa.config.ConfigKey) ConfigPayload(com.yahoo.vespa.config.ConfigPayload) TenantName(com.yahoo.config.provision.TenantName) ApplicationInfo(com.yahoo.config.model.api.ApplicationInfo) ApplicationId(com.yahoo.config.provision.ApplicationId)

Example 9 with ApplicationId

use of com.yahoo.config.provision.ApplicationId in project vespa by vespa-engine.

the class ApplicationHandler method handleDELETE.

@Override
public HttpResponse handleDELETE(HttpRequest request) {
    ApplicationId applicationId = getApplicationIdFromRequest(request);
    boolean removed = applicationRepository.remove(applicationId);
    if (!removed)
        return HttpErrorResponse.notFoundError("Unable to delete " + applicationId + ": Not found");
    return new DeleteApplicationResponse(Response.Status.OK, applicationId);
}
Also used : ApplicationId(com.yahoo.config.provision.ApplicationId)

Example 10 with ApplicationId

use of com.yahoo.config.provision.ApplicationId in project vespa by vespa-engine.

the class ApplicationHandler method handlePOST.

@Override
public HttpResponse handlePOST(HttpRequest request) {
    ApplicationId applicationId = getApplicationIdFromRequest(request);
    Tenant tenant = verifyTenantAndApplication(applicationId);
    if (request.getUri().getPath().endsWith("restart"))
        return restart(request, applicationId);
    if (request.getUri().getPath().endsWith("log"))
        return grabLog(request, applicationId, tenant);
    throw new NotFoundException("Illegal POST request '" + request.getUri() + "': Must end by /restart or /log");
}
Also used : Tenant(com.yahoo.vespa.config.server.tenant.Tenant) NotFoundException(com.yahoo.vespa.config.server.http.NotFoundException) ApplicationId(com.yahoo.config.provision.ApplicationId)

Aggregations

ApplicationId (com.yahoo.config.provision.ApplicationId)173 Test (org.junit.Test)102 Zone (com.yahoo.config.provision.Zone)52 Node (com.yahoo.vespa.hosted.provision.Node)30 ClusterSpec (com.yahoo.config.provision.ClusterSpec)22 TenantName (com.yahoo.config.provision.TenantName)20 Flavor (com.yahoo.config.provision.Flavor)19 List (java.util.List)16 HashSet (java.util.HashSet)15 HostSpec (com.yahoo.config.provision.HostSpec)12 Duration (java.time.Duration)12 HashMap (java.util.HashMap)12 Map (java.util.Map)12 Set (java.util.Set)12 Collectors (java.util.stream.Collectors)12 Version (com.yahoo.component.Version)11 OutOfCapacityException (com.yahoo.config.provision.OutOfCapacityException)11 Slime (com.yahoo.slime.Slime)11 ArrayList (java.util.ArrayList)11 Optional (java.util.Optional)11