Package co.cask.cdap.proto

Examples of co.cask.cdap.proto.DistributedProgramLiveInfo


    String[] programIdParts = args[0].split("\\.");
    String appId = programIdParts[0];
    String programId = programIdParts[1];

    DistributedProgramLiveInfo liveInfo = programClient.getLiveInfo(appId, elementType.getProgramType(), programId);

    new AsciiTable<DistributedProgramLiveInfo>(
      new String[] { "app", "type", "id", "runtime", "yarn app id"},
      Lists.newArrayList(liveInfo),
      new RowMaker<DistributedProgramLiveInfo>() {
        @Override
        public Object[] makeRow(DistributedProgramLiveInfo object) {
          return new Object[] { object.getApp(), object.getType(), object.getId(), object.getRuntime(),
            object.getYarnAppId() };
        }
      }
    ).print(output);

    if (liveInfo.getContainers() != null) {
      new AsciiTable<Containers.ContainerInfo>(
        new String[] { "containers", "instance", "host", "container", "memory", "virtual cores", "debug port" },
        liveInfo.getContainers(),
        new RowMaker<Containers.ContainerInfo>() {
          @Override
          public Object[] makeRow(Containers.ContainerInfo object) {
            return new Object[] { "", object.getInstance(), object.getHost(), object.getContainer(), object.getMemory(),
              object.getVirtualCores(), object.getDebugPort() };
View Full Code Here


      if (controllers.hasNext()) {
        LOG.warn("Expected at most one live instance of Twill app {} but found at least two.", twillAppName);
      }
      ResourceReport report = controller.getResourceReport();
      if (report != null) {
        DistributedProgramLiveInfo liveInfo = new DistributedProgramLiveInfo(program, type, report.getApplicationId());

        // if program type is flow then the container type is flowlet.
        Containers.ContainerType containerType = ProgramType.FLOW.equals(type) ? FLOWLET :
                                                 Containers.ContainerType.valueOf(type.name());

        for (Map.Entry<String, Collection<TwillRunResources>> entry : report.getResources().entrySet()) {
          for (TwillRunResources resources : entry.getValue()) {
            liveInfo.addContainer(new ContainerInfo(containerType,
                                                    entry.getKey(),
                                                    resources.getInstanceId(),
                                                    resources.getContainerId(),
                                                    resources.getHost(),
                                                    resources.getMemoryMB(),
                                                    resources.getVirtualCores(),
                                                    resources.getDebugPort()));
          }
        }

        // Add a list of announced services and their discoverables to the liveInfo.
        liveInfo.addServices(report.getServices());
        return liveInfo;
      }
    }
    return new NotRunningProgramLiveInfo(program, type);
  }
View Full Code Here

TOP

Related Classes of co.cask.cdap.proto.DistributedProgramLiveInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.