samza-yarn/src/main/java/org/apache/samza/job/yarn/YarnAppState.java [41:137]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
public class YarnAppState {

  /**
   /**
  * State indicating whether the job is healthy or not
  * Modified by both the AMRMCallbackThread and the ContainerAllocator thread
  */

  public Map<String, YarnContainer> runningProcessors = new ConcurrentHashMap<>();

  public Map<String, YarnContainer> pendingProcessors = new ConcurrentHashMap<>();

  public ConcurrentMap<String, ContainerStatus> failedContainersStatus = new ConcurrentHashMap<>();

  public YarnAppState(int taskId,
                      ContainerId amContainerId,
                      String nodeHost,
                      int nodePort,
                      int nodeHttpPort
                      ) {
    this.taskId = taskId;
    this.amContainerId = amContainerId;
    this.nodeHost = nodeHost;
    this.nodePort = nodePort;
    this.nodeHttpPort = nodeHttpPort;
    this.appAttemptId = amContainerId.getApplicationAttemptId();
  }


  @Override
  public String toString() {
    return "YarnAppState{" +
        ", taskId=" + taskId +
        ", amContainerId=" + amContainerId +
        ", nodeHost='" + nodeHost + '\'' +
        ", nodePort=" + nodePort +
        ", nodeHttpPort=" + nodeHttpPort +
        ", appAttemptId=" + appAttemptId +
        ", coordinatorUrl=" + coordinatorUrl +
        ", rpcUrl=" + rpcUrl +
        ", trackingUrl=" + trackingUrl +
        ", runningProcessors=" + runningProcessors +
        ", failedContainersStatus=" + failedContainersStatus +
        '}';
  }

   /* The following state variables are primarily used for reference in the AM web services   */

  /**
   * Task Id of the AM
   * Used for displaying in the AM UI. Usage found in {@link org.apache.samza.webapp.ApplicationMasterRestServlet}
   * and scalate/WEB-INF/views/index.scaml
   */

  public final int taskId;
  /**
   * Id of the AM container (as allocated by the RM)
   * Used for displaying in the AM UI. Usage in {@link org.apache.samza.webapp.ApplicationMasterRestServlet}
   * and scalate/WEB-INF/views/index.scaml
   */
  public final ContainerId amContainerId;
  /**
   * Host name of the NM on which the AM is running
   * Used for displaying in the AM UI. See scalate/WEB-INF/views/index.scaml
   */
  public final String nodeHost;
  /**
   * NM port on which the AM is running
   * Used for displaying in the AM UI. See scalate/WEB-INF/views/index.scaml
   */
  public final int nodePort;
  /**
   * Http port of the NM on which the AM is running
   * Used for displaying in the AM UI. See scalate/WEB-INF/views/index.scaml
   */
  public final int nodeHttpPort;
  /**
   * Application Attempt Id as provided by Yarn
   * Used for displaying in the AM UI. See scalate/WEB-INF/views/index.scaml
   * and {@link org.apache.samza.webapp.ApplicationMasterRestServlet}
   */
  public final ApplicationAttemptId appAttemptId;

  //TODO: Make the below 3 variables immutable. Tracked as a part of SAMZA-902. Save for later.
  /**
   * Job Coordinator URL
   * Usage in {@link org.apache.samza.job.yarn.SamzaYarnAppMasterService} &amp; YarnContainerRunner
   */
  public URL coordinatorUrl = null;
  /**
   * URL of the {@link org.apache.samza.webapp.ApplicationMasterRestServlet}
   */
  public URL rpcUrl = null;
  /**
   * URL of the {@link org.apache.samza.webapp.ApplicationMasterWebServlet}
   */
  public URL trackingUrl = null;
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



samza-yarn3/src/main/java/org/apache/samza/job/yarn/YarnAppState.java [41:137]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
public class YarnAppState {

  /**
   /**
  * State indicating whether the job is healthy or not
  * Modified by both the AMRMCallbackThread and the ContainerAllocator thread
  */

  public Map<String, YarnContainer> runningProcessors = new ConcurrentHashMap<>();

  public Map<String, YarnContainer> pendingProcessors = new ConcurrentHashMap<>();

  public ConcurrentMap<String, ContainerStatus> failedContainersStatus = new ConcurrentHashMap<>();

  public YarnAppState(int taskId,
                      ContainerId amContainerId,
                      String nodeHost,
                      int nodePort,
                      int nodeHttpPort
                      ) {
    this.taskId = taskId;
    this.amContainerId = amContainerId;
    this.nodeHost = nodeHost;
    this.nodePort = nodePort;
    this.nodeHttpPort = nodeHttpPort;
    this.appAttemptId = amContainerId.getApplicationAttemptId();
  }


  @Override
  public String toString() {
    return "YarnAppState{" +
        ", taskId=" + taskId +
        ", amContainerId=" + amContainerId +
        ", nodeHost='" + nodeHost + '\'' +
        ", nodePort=" + nodePort +
        ", nodeHttpPort=" + nodeHttpPort +
        ", appAttemptId=" + appAttemptId +
        ", coordinatorUrl=" + coordinatorUrl +
        ", rpcUrl=" + rpcUrl +
        ", trackingUrl=" + trackingUrl +
        ", runningProcessors=" + runningProcessors +
        ", failedContainersStatus=" + failedContainersStatus +
        '}';
  }

   /* The following state variables are primarily used for reference in the AM web services   */

  /**
   * Task Id of the AM
   * Used for displaying in the AM UI. Usage found in {@link org.apache.samza.webapp.ApplicationMasterRestServlet}
   * and scalate/WEB-INF/views/index.scaml
   */

  public final int taskId;
  /**
   * Id of the AM container (as allocated by the RM)
   * Used for displaying in the AM UI. Usage in {@link org.apache.samza.webapp.ApplicationMasterRestServlet}
   * and scalate/WEB-INF/views/index.scaml
   */
  public final ContainerId amContainerId;
  /**
   * Host name of the NM on which the AM is running
   * Used for displaying in the AM UI. See scalate/WEB-INF/views/index.scaml
   */
  public final String nodeHost;
  /**
   * NM port on which the AM is running
   * Used for displaying in the AM UI. See scalate/WEB-INF/views/index.scaml
   */
  public final int nodePort;
  /**
   * Http port of the NM on which the AM is running
   * Used for displaying in the AM UI. See scalate/WEB-INF/views/index.scaml
   */
  public final int nodeHttpPort;
  /**
   * Application Attempt Id as provided by Yarn
   * Used for displaying in the AM UI. See scalate/WEB-INF/views/index.scaml
   * and {@link org.apache.samza.webapp.ApplicationMasterRestServlet}
   */
  public final ApplicationAttemptId appAttemptId;

  //TODO: Make the below 3 variables immutable. Tracked as a part of SAMZA-902. Save for later.
  /**
   * Job Coordinator URL
   * Usage in {@link org.apache.samza.job.yarn.SamzaYarnAppMasterService} &amp; YarnContainerRunner
   */
  public URL coordinatorUrl = null;
  /**
   * URL of the {@link org.apache.samza.webapp.ApplicationMasterRestServlet}
   */
  public URL rpcUrl = null;
  /**
   * URL of the {@link org.apache.samza.webapp.ApplicationMasterWebServlet}
   */
  public URL trackingUrl = null;
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



