Search in sources :

Example 16 with ApplicationInstanceReference

use of com.yahoo.vespa.applicationmodel.ApplicationInstanceReference 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)

Example 17 with ApplicationInstanceReference

use of com.yahoo.vespa.applicationmodel.ApplicationInstanceReference in project vespa by vespa-engine.

the class OrchestratorImplTest method setUp.

@Before
public void setUp() throws Exception {
    // Extract applications and hosts from dummy instance lookup service
    Iterator<ApplicationInstance> iterator = DummyInstanceLookupService.getApplications().iterator();
    ApplicationInstanceReference app1_ref = iterator.next().reference();
    app1 = OrchestratorUtil.toApplicationId(app1_ref);
    app1_host1 = DummyInstanceLookupService.getContentHosts(app1_ref).iterator().next();
    app2 = OrchestratorUtil.toApplicationId(iterator.next().reference());
    clustercontroller = new ClusterControllerClientFactoryMock();
    orchestrator = new OrchestratorImpl(clustercontroller, new InMemoryStatusService(), new OrchestratorConfig(new OrchestratorConfig.Builder()), new DummyInstanceLookupService());
    clustercontroller.setAllDummyNodesAsUp();
}
Also used : OrchestratorConfig(com.yahoo.vespa.orchestrator.config.OrchestratorConfig) ClusterControllerClientFactoryMock(com.yahoo.vespa.orchestrator.controller.ClusterControllerClientFactoryMock) ApplicationInstance(com.yahoo.vespa.applicationmodel.ApplicationInstance) InMemoryStatusService(com.yahoo.vespa.orchestrator.status.InMemoryStatusService) ApplicationInstanceReference(com.yahoo.vespa.applicationmodel.ApplicationInstanceReference) Before(org.junit.Before)

Aggregations

ApplicationInstanceReference (com.yahoo.vespa.applicationmodel.ApplicationInstanceReference)17 ApplicationInstance (com.yahoo.vespa.applicationmodel.ApplicationInstance)10 HostName (com.yahoo.vespa.applicationmodel.HostName)6 ClusterId (com.yahoo.vespa.applicationmodel.ClusterId)5 ConfigId (com.yahoo.vespa.applicationmodel.ConfigId)5 ServiceType (com.yahoo.vespa.applicationmodel.ServiceType)5 Test (org.junit.Test)5 ApplicationId (com.yahoo.config.provision.ApplicationId)4 ApplicationInstanceId (com.yahoo.vespa.applicationmodel.ApplicationInstanceId)4 TenantId (com.yahoo.vespa.applicationmodel.TenantId)4 ServiceCluster (com.yahoo.vespa.applicationmodel.ServiceCluster)3 ServiceInstance (com.yahoo.vespa.applicationmodel.ServiceInstance)3 ServiceModel (com.yahoo.vespa.service.monitor.ServiceModel)3 HashMap (java.util.HashMap)3 GET (javax.ws.rs.GET)3 Path (javax.ws.rs.Path)3 Produces (javax.ws.rs.Produces)3 SuperModel (com.yahoo.config.model.api.SuperModel)2 Zone (com.yahoo.config.provision.Zone)2 OrchestratorUtil.getHostsUsedByApplicationInstance (com.yahoo.vespa.orchestrator.OrchestratorUtil.getHostsUsedByApplicationInstance)2