Search in sources :

Example 6 with HostStatus

use of com.yahoo.vespa.orchestrator.status.HostStatus in project vespa by vespa-engine.

the class InstanceResource method getInstance.

@GET
@Path("/{instanceId}")
@Produces(MediaType.APPLICATION_JSON)
public InstanceStatusResponse getInstance(@PathParam("instanceId") String instanceIdString) {
    ApplicationInstanceReference instanceId = parseInstanceId(instanceIdString);
    ApplicationInstance applicationInstance = instanceLookupService.findInstanceById(instanceId).orElseThrow(() -> new WebApplicationException(Response.status(Response.Status.NOT_FOUND).build()));
    Set<HostName> hostsUsedByApplicationInstance = getHostsUsedByApplicationInstance(applicationInstance);
    Map<HostName, HostStatus> hostStatusMap = getHostStatusMap(hostsUsedByApplicationInstance, statusService.forApplicationInstance(instanceId));
    Map<HostName, String> hostStatusStringMap = OrchestratorUtil.mapValues(hostStatusMap, HostStatus::name);
    return InstanceStatusResponse.create(applicationInstance, hostStatusStringMap);
}
Also used : OrchestratorUtil.getHostsUsedByApplicationInstance(com.yahoo.vespa.orchestrator.OrchestratorUtil.getHostsUsedByApplicationInstance) ApplicationInstance(com.yahoo.vespa.applicationmodel.ApplicationInstance) WebApplicationException(javax.ws.rs.WebApplicationException) ApplicationInstanceReference(com.yahoo.vespa.applicationmodel.ApplicationInstanceReference) HostStatus(com.yahoo.vespa.orchestrator.status.HostStatus) HostName(com.yahoo.vespa.applicationmodel.HostName) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Aggregations

HostStatus (com.yahoo.vespa.orchestrator.status.HostStatus)6 HostName (com.yahoo.vespa.applicationmodel.HostName)5 ApplicationInstance (com.yahoo.vespa.applicationmodel.ApplicationInstance)4 ApplicationId (com.yahoo.config.provision.ApplicationId)2 ApplicationInstanceReference (com.yahoo.vespa.applicationmodel.ApplicationInstanceReference)2 ServiceInstance (com.yahoo.vespa.applicationmodel.ServiceInstance)2 ServiceStatus (com.yahoo.vespa.applicationmodel.ServiceStatus)2 HostNameNotFoundException (com.yahoo.vespa.orchestrator.HostNameNotFoundException)2 ApplicationInstanceStatus (com.yahoo.vespa.orchestrator.status.ApplicationInstanceStatus)2 MutableStatusRegistry (com.yahoo.vespa.orchestrator.status.MutableStatusRegistry)2 List (java.util.List)2 Collectors (java.util.stream.Collectors)2 Inject (com.google.inject.Inject)1 Version (com.yahoo.component.Version)1 Metric (com.yahoo.jdisc.Metric)1 LogLevel (com.yahoo.log.LogLevel)1 ClusterId (com.yahoo.vespa.applicationmodel.ClusterId)1 ServiceCluster (com.yahoo.vespa.applicationmodel.ServiceCluster)1 ServiceType (com.yahoo.vespa.applicationmodel.ServiceType)1 Allocation (com.yahoo.vespa.hosted.provision.node.Allocation)1