Example usage for org.apache.hadoop.util StringUtils formatTime

List of usage examples for org.apache.hadoop.util StringUtils formatTime

Introduction

In this page you can find the example usage for org.apache.hadoop.util StringUtils formatTime.

Prototype

public static String formatTime(long timeDiff) 

Source Link

Document

Given the time in long milliseconds, returns a String in the format Xhrs, Ymins, Z sec.

Usage

From source file:com.kylinolap.job.hadoop.AbstractHadoopJob.java

License:Apache License

protected int waitForCompletion(Job job) throws IOException, InterruptedException, ClassNotFoundException {
    int retVal = 0;
    long start = System.nanoTime();

    if (isAsync) {
        job.submit();/*w w w  . ja v a 2s.c om*/
    } else {
        job.waitForCompletion(true);
        retVal = job.isSuccessful() ? 0 : 1;
    }

    log.debug("Job '" + job.getJobName() + "' finished "
            + (job.isSuccessful() ? "successfully in " : "with failures.  Time taken ")
            + StringUtils.formatTime((System.nanoTime() - start) / 1000000L));

    return retVal;
}