Example usage for org.apache.hadoop.mapred JobContext getProgressible

List of usage examples for org.apache.hadoop.mapred JobContext getProgressible

Introduction

In this page you can find the example usage for org.apache.hadoop.mapred JobContext getProgressible.

Prototype

public Progressable getProgressible();

Source Link

Document

Get the progress mechanism for reporting progress.

Usage

From source file:com.asakusafw.runtime.stage.output.LegacyBridgeOutputCommitter.java

License:Apache License

private org.apache.hadoop.mapreduce.TaskAttemptContext toTaskAttemptContext(JobContext jobContext) {
    assert jobContext != null;
    // NOTE: Only in Hadoop 2.x, JobContext can be instance of TaskAttemptContext.
    if (TaskAttemptContext.class.isInstance(jobContext)) {
        return TaskAttemptContext.class.cast(jobContext);
    }/*from  ww w . j  ava2s. c o  m*/
    Progressable progressable = jobContext.getProgressible();
    if (progressable == null) {
        LOG.warn(MessageFormat.format("JobContext has no progressable object: {0}",
                jobContext.getClass().getName()));
    }
    if (LOG.isDebugEnabled()) {
        LOG.debug(MessageFormat.format("Progressable object is found (jobId={0}, object={1})", //$NON-NLS-1$
                jobContext.getJobID(), progressable));
    }
    TaskAttemptID id = JobCompatibility.newTaskAttemptId(JobCompatibility.newTaskId(jobContext.getJobID()));
    return JobCompatibility.newTaskAttemptContext(jobContext.getConfiguration(), id, progressable);
}

From source file:com.ibm.bi.dml.runtime.matrix.data.MultipleOutputCommitter.java

License:Open Source License

@Override
public void cleanupJob(JobContext context) throws IOException {
    JobConf conf = context.getJobConf();
    // do the clean up of temporary directory
    Path outputPath = FileOutputFormat.getOutputPath(conf);
    if (outputPath != null) {
        FileSystem fs = outputPath.getFileSystem(conf);
        context.getProgressible().progress();
        if (fs.exists(outputPath))
            fs.delete(outputPath, true);
    }/*from  www.  j a v  a2s.c  o m*/
}