use of co.cask.cdap.proto.SystemServiceLiveInfo in project cdap by caskdata.
the class AbstractDistributedMasterServiceManager method getLiveInfo.
@Override
public SystemServiceLiveInfo getLiveInfo() {
SystemServiceLiveInfo.Builder builder = SystemServiceLiveInfo.builder();
Iterable<TwillController> twillControllerList = twillRunnerService.lookup(Constants.Service.MASTER_SERVICES);
if (twillControllerList == null) {
return builder.build();
}
for (TwillController twillController : twillControllerList) {
if (twillController.getResourceReport() == null) {
continue;
}
ResourceReport resourceReport = twillController.getResourceReport();
Collection<TwillRunResources> runResources = resourceReport.getResources().get(serviceName);
for (TwillRunResources resources : runResources) {
Containers.ContainerInfo containerInfo = new Containers.ContainerInfo(Containers.ContainerType.SYSTEM_SERVICE, serviceName, resources.getInstanceId(), resources.getContainerId(), resources.getHost(), resources.getMemoryMB(), resources.getVirtualCores(), resources.getDebugPort());
builder.addContainer(containerInfo);
}
}
return builder.build();
}
Aggregations