Search in sources :

Example 1 with SystemServiceLiveInfo

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();
}
Also used : TwillController(org.apache.twill.api.TwillController) SystemServiceLiveInfo(co.cask.cdap.proto.SystemServiceLiveInfo) Containers(co.cask.cdap.proto.Containers) ResourceReport(org.apache.twill.api.ResourceReport) TwillRunResources(org.apache.twill.api.TwillRunResources)

Aggregations

Containers (co.cask.cdap.proto.Containers)1 SystemServiceLiveInfo (co.cask.cdap.proto.SystemServiceLiveInfo)1 ResourceReport (org.apache.twill.api.ResourceReport)1 TwillController (org.apache.twill.api.TwillController)1 TwillRunResources (org.apache.twill.api.TwillRunResources)1