Example usage for org.apache.hadoop.mapreduce TaskAttemptContext progress

List of usage examples for org.apache.hadoop.mapreduce TaskAttemptContext progress

Introduction

In this page you can find the example usage for org.apache.hadoop.mapreduce TaskAttemptContext progress.

Prototype

public void progress();

Source Link

Document

Report progress to the Hadoop framework.

Usage

From source file:io.druid.indexer.JobHelper.java

License:Apache License

public static ProgressIndicator progressIndicatorForContext(final TaskAttemptContext context) {
    return new ProgressIndicator() {

        @Override// ww w.  j av a2s .c om
        public void progress() {
            context.progress();
        }

        @Override
        public void start() {
            context.progress();
            context.setStatus("STARTED");
        }

        @Override
        public void stop() {
            context.progress();
            context.setStatus("STOPPED");
        }

        @Override
        public void startSection(String section) {
            context.progress();
            context.setStatus(String.format("STARTED [%s]", section));
        }

        @Override
        public void progressSection(String section, String message) {
            log.info("Progress message for section [%s] : [%s]", section, message);
            context.progress();
            context.setStatus(String.format("PROGRESS [%s]", section));
        }

        @Override
        public void stopSection(String section) {
            context.progress();
            context.setStatus(String.format("STOPPED [%s]", section));
        }
    };
}