org.apache.hadoop.tools.util
Class HadoopCompat

java.lang.Object
  extended by org.apache.hadoop.tools.util.HadoopCompat

public class HadoopCompat
extends Object

Utility methods to allow applications to deal with inconsistencies between MapReduce Context Objects API between Hadoop 1.x and 2.x.


Constructor Summary
HadoopCompat()
           
 
Method Summary
static org.apache.hadoop.conf.Configuration getConfiguration(org.apache.hadoop.mapreduce.JobContext context)
          Invoke getConfiguration() on JobContext.
static org.apache.hadoop.mapreduce.Counter getCounter(org.apache.hadoop.mapreduce.TaskInputOutputContext context, Enum count)
          Invoke getCounter() on TaskInputOutputContext.
static org.apache.hadoop.security.Credentials getCredentials(org.apache.hadoop.mapreduce.JobContext context)
          Gets the credential associated to job context.
static org.apache.hadoop.mapreduce.JobID getJobId(org.apache.hadoop.mapreduce.JobContext context)
          Gets the jobid associated with JobContext, works for both Hadoop 1.0 and 2.0
static org.apache.hadoop.mapreduce.TaskAttemptID getTaskAttemptID(org.apache.hadoop.mapreduce.TaskAttemptContext taskContext)
          returns TaskAttemptContext.getTaskAttemptID().
static org.apache.hadoop.conf.Configuration getTaskConfiguration(org.apache.hadoop.mapreduce.TaskAttemptContext taskAttemptContext)
          Gets the configuration object associated to a particular task attempt.
static void incrementCounter(org.apache.hadoop.mapreduce.Counter counter, long increment)
          Increment the counter.
static void progress(org.apache.hadoop.mapreduce.TaskAttemptContext context)
          Invoke progress() on TaskAttemptContext.
static void setStatus(org.apache.hadoop.mapreduce.TaskAttemptContext context, String status)
          Invoke setStatus() on TaskAttemptContext.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HadoopCompat

public HadoopCompat()
Method Detail

getConfiguration

public static org.apache.hadoop.conf.Configuration getConfiguration(org.apache.hadoop.mapreduce.JobContext context)
Invoke getConfiguration() on JobContext. Works with both Hadoop 1 and 2.


getJobId

public static org.apache.hadoop.mapreduce.JobID getJobId(org.apache.hadoop.mapreduce.JobContext context)
Gets the jobid associated with JobContext, works for both Hadoop 1.0 and 2.0

Parameters:
context -
Returns:
jobid

getCredentials

public static org.apache.hadoop.security.Credentials getCredentials(org.apache.hadoop.mapreduce.JobContext context)
Gets the credential associated to job context. Works with Hadoop 1.0 and 2.0

Parameters:
context -
Returns:
credentials

setStatus

public static void setStatus(org.apache.hadoop.mapreduce.TaskAttemptContext context,
                             String status)
Invoke setStatus() on TaskAttemptContext. Works with both Hadoop 1 and 2.


progress

public static void progress(org.apache.hadoop.mapreduce.TaskAttemptContext context)
Invoke progress() on TaskAttemptContext. Works with both Hadoop 1 and 2.


getTaskAttemptID

public static org.apache.hadoop.mapreduce.TaskAttemptID getTaskAttemptID(org.apache.hadoop.mapreduce.TaskAttemptContext taskContext)
returns TaskAttemptContext.getTaskAttemptID(). Works with both Hadoop 1 and 2.


getTaskConfiguration

public static org.apache.hadoop.conf.Configuration getTaskConfiguration(org.apache.hadoop.mapreduce.TaskAttemptContext taskAttemptContext)
Gets the configuration object associated to a particular task attempt. Works with both Hadoop 1 and 2

Parameters:
taskAttemptContext -
Returns:
configuration

getCounter

public static org.apache.hadoop.mapreduce.Counter getCounter(org.apache.hadoop.mapreduce.TaskInputOutputContext context,
                                                             Enum count)
Invoke getCounter() on TaskInputOutputContext. Works with both Hadoop 1 and 2.


incrementCounter

public static void incrementCounter(org.apache.hadoop.mapreduce.Counter counter,
                                    long increment)
Increment the counter. Works with both Hadoop 1 and 2



Copyright © 2014 InMobi. All rights reserved.