Example usage for org.apache.hadoop.mapred.jobcontrol Job getJob

List of usage examples for org.apache.hadoop.mapred.jobcontrol Job getJob

Introduction

In this page you can find the example usage for org.apache.hadoop.mapred.jobcontrol Job getJob.

Prototype

public synchronized Job getJob() 

Source Link

Usage

From source file:org.apache.pig.backend.hadoop.executionengine.shims.HadoopShims.java

License:Apache License

public static Counters getCounters(Job job) throws IOException {
    try {//from   w ww  .  j a  v a  2s  .  c  om
        return new Counters(job.getJob().getCounters());
    } catch (Exception ir) {
        throw new IOException(ir);
    }
}

From source file:org.apache.pig.backend.hadoop.executionengine.shims.HadoopShims.java

License:Apache License

/**
 * Returns the progress of a Job j which is part of a submitted JobControl
 * object. The progress is for this Job. So it has to be scaled down by the
 * num of jobs that are present in the JobControl.
 *
 * @param j The Job for which progress is required
 * @return Returns the percentage progress of this Job
 * @throws IOException/*from  w ww. j  av a2s.com*/
 */
public static double progressOfRunningJob(Job j) throws IOException {
    org.apache.hadoop.mapreduce.Job mrJob = j.getJob();
    try {
        return (mrJob.mapProgress() + mrJob.reduceProgress()) / 2;
    } catch (Exception ir) {
        return 0;
    }
}

From source file:org.apache.pig.backend.hadoop.executionengine.shims.HadoopShims.java

License:Apache License

public static void killJob(Job job) throws IOException {
    org.apache.hadoop.mapreduce.Job mrJob = job.getJob();
    try {// w  w  w.  j ava2 s.c  o m
        if (mrJob != null) {
            mrJob.killJob();
        }
    } catch (Exception ir) {
        throw new IOException(ir);
    }
}

From source file:org.apache.pig.backend.hadoop.executionengine.shims.HadoopShims.java

License:Apache License

public static TaskReport[] getTaskReports(Job job, TaskType type) throws IOException {
    if (job.getJobConf().getBoolean(PigConfiguration.PIG_NO_TASK_REPORT, false)) {
        LOG.info("TaskReports are disabled for job: " + job.getAssignedJobID());
        return null;
    }/*from   w ww .  j a v a  2  s . com*/
    org.apache.hadoop.mapreduce.Job mrJob = job.getJob();
    try {
        org.apache.hadoop.mapreduce.TaskReport[] reports = mrJob.getTaskReports(type);
        return DowngradeHelper.downgradeTaskReports(reports);
    } catch (InterruptedException ir) {
        throw new IOException(ir);
    }
}