Java Code Examples for org.apache.hadoop.yarn.api.records.ApplicationReport#getName()

The following examples show how to use org.apache.hadoop.yarn.api.records.ApplicationReport#getName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AppInfo.java    From hadoop with Apache License 2.0 6 votes vote down vote up
public AppInfo(ApplicationReport app) {
  appId = app.getApplicationId().toString();
  if (app.getCurrentApplicationAttemptId() != null) {
    currentAppAttemptId = app.getCurrentApplicationAttemptId().toString();
  }
  user = app.getUser();
  queue = app.getQueue();
  name = app.getName();
  type = app.getApplicationType();
  host = app.getHost();
  rpcPort = app.getRpcPort();
  appState = app.getYarnApplicationState();
  diagnosticsInfo = app.getDiagnostics();
  trackingUrl = app.getTrackingUrl();
  originalTrackingUrl = app.getOriginalTrackingUrl();
  submittedTime = app.getStartTime();
  startedTime = app.getStartTime();
  finishedTime = app.getFinishTime();
  elapsedTime = Times.elapsed(startedTime, finishedTime);
  finalAppStatus = app.getFinalApplicationStatus();
  progress = app.getProgress() * 100; // in percent
  if (app.getApplicationTags() != null && !app.getApplicationTags().isEmpty()) {
    this.applicationTags = CSV_JOINER.join(app.getApplicationTags());
  }
}
 
Example 2
Source File: AppInfo.java    From big-c with Apache License 2.0 6 votes vote down vote up
public AppInfo(ApplicationReport app) {
  appId = app.getApplicationId().toString();
  if (app.getCurrentApplicationAttemptId() != null) {
    currentAppAttemptId = app.getCurrentApplicationAttemptId().toString();
  }
  user = app.getUser();
  queue = app.getQueue();
  name = app.getName();
  type = app.getApplicationType();
  host = app.getHost();
  rpcPort = app.getRpcPort();
  appState = app.getYarnApplicationState();
  diagnosticsInfo = app.getDiagnostics();
  trackingUrl = app.getTrackingUrl();
  originalTrackingUrl = app.getOriginalTrackingUrl();
  submittedTime = app.getStartTime();
  startedTime = app.getStartTime();
  finishedTime = app.getFinishTime();
  elapsedTime = Times.elapsed(startedTime, finishedTime);
  finalAppStatus = app.getFinalApplicationStatus();
  progress = app.getProgress() * 100; // in percent
  if (app.getApplicationTags() != null && !app.getApplicationTags().isEmpty()) {
    this.applicationTags = CSV_JOINER.join(app.getApplicationTags());
  }
}
 
Example 3
Source File: TypeConverter.java    From hadoop with Apache License 2.0 5 votes vote down vote up
public static JobStatus fromYarn(ApplicationReport application,
    String jobFile) {
  String trackingUrl = application.getTrackingUrl();
  trackingUrl = trackingUrl == null ? "" : trackingUrl;
  JobStatus jobStatus =
    new JobStatus(
        TypeConverter.fromYarn(application.getApplicationId()),
        0.0f, 0.0f, 0.0f, 0.0f,
        TypeConverter.fromYarn(application.getYarnApplicationState(), application.getFinalApplicationStatus()),
        org.apache.hadoop.mapreduce.JobPriority.NORMAL,
        application.getUser(), application.getName(),
        application.getQueue(), jobFile, trackingUrl, false
    );
  jobStatus.setSchedulingInfo(trackingUrl); // Set AM tracking url
  jobStatus.setStartTime(application.getStartTime());
  jobStatus.setFinishTime(application.getFinishTime());
  jobStatus.setFailureInfo(application.getDiagnostics());
  ApplicationResourceUsageReport resourceUsageReport =
      application.getApplicationResourceUsageReport();
  if (resourceUsageReport != null) {
    jobStatus.setNeededMem(
        resourceUsageReport.getNeededResources().getMemory());
    jobStatus.setNumReservedSlots(
        resourceUsageReport.getNumReservedContainers());
    jobStatus.setNumUsedSlots(resourceUsageReport.getNumUsedContainers());
    jobStatus.setReservedMem(
        resourceUsageReport.getReservedResources().getMemory());
    jobStatus.setUsedMem(resourceUsageReport.getUsedResources().getMemory());
  }
  return jobStatus;
}
 
Example 4
Source File: TypeConverter.java    From big-c with Apache License 2.0 5 votes vote down vote up
public static JobStatus fromYarn(ApplicationReport application,
    String jobFile) {
  String trackingUrl = application.getTrackingUrl();
  trackingUrl = trackingUrl == null ? "" : trackingUrl;
  JobStatus jobStatus =
    new JobStatus(
        TypeConverter.fromYarn(application.getApplicationId()),
        0.0f, 0.0f, 0.0f, 0.0f,
        TypeConverter.fromYarn(application.getYarnApplicationState(), application.getFinalApplicationStatus()),
        org.apache.hadoop.mapreduce.JobPriority.NORMAL,
        application.getUser(), application.getName(),
        application.getQueue(), jobFile, trackingUrl, false
    );
  jobStatus.setSchedulingInfo(trackingUrl); // Set AM tracking url
  jobStatus.setStartTime(application.getStartTime());
  jobStatus.setFinishTime(application.getFinishTime());
  jobStatus.setFailureInfo(application.getDiagnostics());
  ApplicationResourceUsageReport resourceUsageReport =
      application.getApplicationResourceUsageReport();
  if (resourceUsageReport != null) {
    jobStatus.setNeededMem(
        resourceUsageReport.getNeededResources().getMemory());
    jobStatus.setNumReservedSlots(
        resourceUsageReport.getNumReservedContainers());
    jobStatus.setNumUsedSlots(resourceUsageReport.getNumUsedContainers());
    jobStatus.setReservedMem(
        resourceUsageReport.getReservedResources().getMemory());
    jobStatus.setUsedMem(resourceUsageReport.getUsedResources().getMemory());
  }
  return jobStatus;
}