java.lang.Object
fr.ens.biologie.genomique.eoulsan.modules.mapping.hadoop.hadoopbamcli.ContextUtil

public class ContextUtil extends Object
Utility methods to allow applications to deal with inconsistencies between MapReduce Context Objects API between hadoop-0.20 and later versions.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.apache.hadoop.conf.Configuration
    getConfiguration(org.apache.hadoop.mapreduce.JobContext context)
    Invoke getConfiguration() method on JobContext.
    static org.apache.hadoop.mapreduce.Counter
    getCounter(org.apache.hadoop.mapreduce.TaskInputOutputContext<?,?,?,?> context, String groupName, String counterName)
    Get counter.
    static void
    incrementCounter(org.apache.hadoop.mapreduce.Counter counter, long increment)
    Increment counter.
    static org.apache.hadoop.mapreduce.Counter
    newGenericCounter(String name, String displayName, long value)
    Create a new generic counter.
    static org.apache.hadoop.mapreduce.JobContext
    newJobContext(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.mapreduce.JobID jobId)
    Creates JobContext from a JobConf and jobId using the correct constructor for based on Hadoop version.
    static org.apache.hadoop.mapreduce.TaskAttemptContext
    newTaskAttemptContext(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.mapreduce.TaskAttemptID taskAttemptId)
    Creates TaskAttempContext from a JobConf and jobId using the correct constructor for based on Hadoop version.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ContextUtil

      public ContextUtil()
  • Method Details

    • newJobContext

      public static org.apache.hadoop.mapreduce.JobContext newJobContext(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.mapreduce.JobID jobId)
      Creates JobContext from a JobConf and jobId using the correct constructor for based on Hadoop version. jobId could be null.
      Parameters:
      conf - Hadoop configuration
      jobId - job ID
      Returns:
      a JobContext object
    • newTaskAttemptContext

      public static org.apache.hadoop.mapreduce.TaskAttemptContext newTaskAttemptContext(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.mapreduce.TaskAttemptID taskAttemptId)
      Creates TaskAttempContext from a JobConf and jobId using the correct constructor for based on Hadoop version.
      Parameters:
      conf - Hadoop configuration
      taskAttemptId - task attempt ID
      Returns:
      a TaskAttemptContext object
    • newGenericCounter

      public static org.apache.hadoop.mapreduce.Counter newGenericCounter(String name, String displayName, long value)
      Create a new generic counter.
      Parameters:
      name - name of the counter
      displayName - display name
      value - the counter value
      Returns:
      with Hadoop 2 : new GenericCounter(args),
      with Hadoop 1 : new Counter(args)
    • getConfiguration

      public static org.apache.hadoop.conf.Configuration getConfiguration(org.apache.hadoop.mapreduce.JobContext context)
      Invoke getConfiguration() method on JobContext. Works with both Hadoop 1 and 2.
      Parameters:
      context - job context
      Returns:
      a Configuration object
    • getCounter

      public static org.apache.hadoop.mapreduce.Counter getCounter(org.apache.hadoop.mapreduce.TaskInputOutputContext<?,?,?,?> context, String groupName, String counterName)
      Get counter.
      Parameters:
      context - task context
      groupName - group name
      counterName - counter name
      Returns:
      a Counter object
    • incrementCounter

      public static void incrementCounter(org.apache.hadoop.mapreduce.Counter counter, long increment)
      Increment counter.
      Parameters:
      counter - counter to increment
      increment - increment of the counter