Example usage for org.apache.hadoop.yarn.api.records ApplicationReport getApplicationType

List of usage examples for org.apache.hadoop.yarn.api.records ApplicationReport getApplicationType

Introduction

In this page you can find the example usage for org.apache.hadoop.yarn.api.records ApplicationReport getApplicationType.

Prototype

@Public
@Stable
public abstract String getApplicationType();

Source Link

Document

Get the application's Type

Usage

From source file:org.apache.hoya.tools.HoyaUtils.java

License:Apache License

public static String appReportToString(ApplicationReport r, String separator) {
    StringBuilder builder = new StringBuilder(512);
    builder.append("application ").append(r.getName()).append("/").append(r.getApplicationType());
    builder.append(separator).append("state: ").append(r.getYarnApplicationState());
    builder.append(separator).append("URL: ").append(r.getTrackingUrl());
    builder.append(separator).append("Started ").append(new Date(r.getStartTime()).toGMTString());
    long finishTime = r.getFinishTime();
    if (finishTime > 0) {
        builder.append(separator).append("Finished ").append(new Date(finishTime).toGMTString());
    }/*  ww w.  ja  va  2 s .  c o  m*/
    builder.append(separator).append("RPC :").append(r.getHost()).append(':').append(r.getRpcPort());
    String diagnostics = r.getDiagnostics();
    if (!diagnostics.isEmpty()) {
        builder.append(separator).append("Diagnostics :").append(diagnostics);
    }
    return builder.toString();
}

From source file:org.apache.hoya.tools.HoyaUtils.java

License:Apache License

/**
 * convert an AM report to a string for diagnostics
 * @param report the report//ww w .  ja  v  a2 s  . com
 * @return the string value
 */
public static String reportToString(ApplicationReport report) {
    if (report == null) {
        return "Null application report";
    }

    return "App " + report.getName() + "/" + report.getApplicationType() + "# " + report.getApplicationId()
            + " user " + report.getUser() + " is in state " + report.getYarnApplicationState() + "RPC: "
            + report.getHost() + ":" + report.getRpcPort();
}

From source file:org.apache.oozie.action.hadoop.TestYarnApplicationIdFinder.java

License:Apache License

@Test
public void whenOldLauncherAndMRobApplicationsAreFinishedAndNewLauncherPresentNewLauncherIsUsed()
        throws Exception {
    final ApplicationReport oldLauncher = mock(ApplicationReport.class);
    when(oldLauncher.getApplicationType()).thenReturn("Oozie Launcher");
    final ApplicationReport oldMRJob = mock(ApplicationReport.class);
    when(oldMRJob.getApplicationType()).thenReturn("MAPREDUCE");
    final ApplicationId oldMRJobId = mock(ApplicationId.class);
    when(oldMRJobId.toString()).thenReturn("application_1534164756526_0002");
    when(oldMRJob.getApplicationId()).thenReturn(oldMRJobId);
    final ApplicationReport newLauncher = mock(ApplicationReport.class);
    when(newLauncher.getApplicationType()).thenReturn("Oozie Launcher");
    final ApplicationReport newMRJob = mock(ApplicationReport.class);
    when(newMRJob.getApplicationType()).thenReturn("MAPREDUCE");
    final ApplicationId newMRJobId = mock(ApplicationId.class);
    when(newMRJobId.toString()).thenReturn("application_1534164756526_0004");
    when(newMRJob.getApplicationId()).thenReturn(newMRJobId);
    when(reader.read())//  www  .j av  a2 s  .  c om
            .thenReturn(new ArrayList<>(Arrays.asList(oldLauncher, oldMRJob, newLauncher, newMRJob)));

    when(workflowActionBean.getExternalId()).thenReturn("application_1534164756526_0003");
    assertEquals("newLauncher should be found", "application_1534164756526_0004",
            yarnApplicationIdFinder.find());

    when(workflowActionBean.getExternalId()).thenReturn("application_1534164756526_0004");
    assertEquals("newLauncher should be found", "application_1534164756526_0004",
            yarnApplicationIdFinder.find());

    when(workflowActionBean.getExternalId()).thenReturn("application_1534164756526_0005");
    assertEquals("workflowActionBean.externalId should be found", "application_1534164756526_0005",
            yarnApplicationIdFinder.find());
}

From source file:org.apache.slider.common.tools.SliderUtils.java

License:Apache License

public static String appReportToString(ApplicationReport r, String separator) {
    StringBuilder builder = new StringBuilder(512);
    builder.append("application ").append(r.getName()).append("/").append(r.getApplicationType())
            .append(separator);//from w w w. ja va  2 s .c  o m
    Set<String> tags = r.getApplicationTags();
    if (!tags.isEmpty()) {
        for (String tag : tags) {
            builder.append(tag).append(separator);
        }
    }
    DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm");
    dateFormat.setTimeZone(TimeZone.getDefault());
    builder.append("state: ").append(r.getYarnApplicationState());
    String trackingUrl = r.getTrackingUrl();
    if (isSet(trackingUrl)) {
        builder.append(separator).append("URL: ").append(trackingUrl);
    }
    builder.append(separator).append("Started: ").append(dateFormat.format(new Date(r.getStartTime())));
    long finishTime = r.getFinishTime();
    if (finishTime > 0) {
        builder.append(separator).append("Finished: ").append(dateFormat.format(new Date(finishTime)));
    }
    String rpcHost = r.getHost();
    if (!isSet(rpcHost)) {
        builder.append(separator).append("RPC :").append(rpcHost).append(':').append(r.getRpcPort());
    }
    String diagnostics = r.getDiagnostics();
    if (!isSet(diagnostics)) {
        builder.append(separator).append("Diagnostics :").append(diagnostics);
    }
    return builder.toString();
}

From source file:org.apache.slider.common.tools.SliderUtils.java

License:Apache License

/**
 * convert an AM report to a string for diagnostics
 * @param report the report/*from w  w  w .j  a  v a2 s  .c om*/
 * @return the string value
 */
public static String reportToString(ApplicationReport report) {
    if (report == null) {
        return "Null application report";
    }

    return "App " + report.getName() + "/" + report.getApplicationType() + "# " + report.getApplicationId()
            + " user " + report.getUser() + " is in state " + report.getYarnApplicationState() + " RPC: "
            + report.getHost() + ":" + report.getRpcPort() + " URL" + report.getOriginalTrackingUrl();
}

From source file:org.apache.slider.core.launch.SerializedApplicationReport.java

License:Apache License

public SerializedApplicationReport(ApplicationReport report) {
    this.applicationId = report.getApplicationId().toString();
    this.applicationAttemptId = report.getCurrentApplicationAttemptId().toString();
    this.name = report.getName();
    this.applicationType = report.getApplicationType();
    this.user = report.getUser();
    this.queue = report.getQueue();
    this.host = report.getHost();
    this.rpcPort = report.getRpcPort();
    this.state = report.getYarnApplicationState().toString();
    this.diagnostics = report.getDiagnostics();
    this.startTime = report.getStartTime();
    this.finishTime = report.getFinishTime();
    this.finalStatus = report.getFinalApplicationStatus().toString();
    this.progress = report.getProgress();
}