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