Example usage for org.apache.hadoop.yarn.client.cli LogsCLI LogsCLI

List of usage examples for org.apache.hadoop.yarn.client.cli LogsCLI LogsCLI

Introduction

In this page you can find the example usage for org.apache.hadoop.yarn.client.cli LogsCLI LogsCLI.

Prototype

LogsCLI

Source Link

Usage

From source file:io.hops.tensorflow.TestUtils.java

License:Apache License

public static boolean dumpAllAggregatedContainersLogs(MiniYARNCluster yarnCluster, ApplicationId appId)
        throws Exception {
    LogsCLI logDumper = new LogsCLI();
    logDumper.setConf(yarnCluster.getConfig());
    int resultCode = logDumper.run(new String[] { "-applicationId", appId.toString() });
    return resultCode == 0;
}

From source file:nl.tudelft.graphalytics.giraph.reporting.logging.GraphalyticLogger.java

License:Apache License

public static void collectYarnLog(String applicationId, String yarnlogPath) {

    try {/*  ww  w .  ja v a 2s.  com*/

        PrintStream console = System.out;

        File file = new File(yarnlogPath);
        FileOutputStream fos = new FileOutputStream(file);
        PrintStream ps = new PrintStream(fos);
        System.setOut(ps);
        waitInterval(20);

        LogsCLI logDumper = new LogsCLI();
        logDumper.setConf(new YarnConfiguration());

        String[] args = { "-applicationId", applicationId };

        logDumper.run(args);
        System.setOut(console);

    } catch (Exception e) {
        e.printStackTrace();
    }
}