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

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

Introduction

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

Prototype

@Public
@Stable
public abstract String getQueue();

Source Link

Document

Get the queue to which the application was submitted.

Usage

From source file:yrun.commands.Yps.java

License:Apache License

public static void main(String[] args) throws YarnException, IOException {
    YarnClient yarnClient = YarnClient.createYarnClient();
    YarnConfiguration yarnConfiguration = new YarnConfiguration();
    yarnClient.init(yarnConfiguration);//from ww w.jav  a 2 s  .  com
    yarnClient.start();
    try {
        List<ApplicationReport> applications = yarnClient.getApplications();
        for (ApplicationReport applicationReport : applications) {
            ApplicationId applicationId = applicationReport.getApplicationId();
            String user = applicationReport.getUser();
            String queue = applicationReport.getQueue();
            String name = applicationReport.getName();
            YarnApplicationState yarnApplicationState = applicationReport.getYarnApplicationState();
            float progress = applicationReport.getProgress();
            System.out.printf("%s\t%s\t%s\t%s\t%s\t%f%n", toString(applicationId), user, queue, name,
                    yarnApplicationState.name(), progress);
        }
    } finally {
        yarnClient.stop();
        yarnClient.close();
    }
}