Example usage for org.apache.hadoop.mapreduce Job monitorAndPrintJob

List of usage examples for org.apache.hadoop.mapreduce Job monitorAndPrintJob

Introduction

In this page you can find the example usage for org.apache.hadoop.mapreduce Job monitorAndPrintJob.

Prototype

public boolean monitorAndPrintJob() throws IOException, InterruptedException 

Source Link

Document

Monitor a job and print status in real-time as progress is made and tasks fail.

Usage

From source file:org.apache.jena.hadoop.rdf.stats.RdfStats.java

License:Apache License

private boolean runJob(Job job) throws Throwable {
    System.out.println("Submitting Job " + job.getJobName());
    long start = System.nanoTime();
    try {/*ww w . j av a  2  s  . c  o  m*/
        job.submit();
        if (job.monitorAndPrintJob()) {
            System.out.println("Job " + job.getJobName() + " succeeded");
            return true;
        } else {
            System.out.println("Job " + job.getJobName() + " failed");
            return false;
        }
    } catch (Throwable e) {
        System.out.println("Unexpected failure in Job " + job.getJobName());
        throw e;
    } finally {
        long end = System.nanoTime();
        System.out.println("Job " + job.getJobName() + " finished after "
                + String.format("%,d milliseconds", TimeUnit.NANOSECONDS.toMillis(end - start)));
        System.out.println();
    }
}