org.apache.hadoop.mapreduce
Class JobContext

java.lang.Object
  extended by org.apache.hadoop.mapreduce.JobContext
Direct Known Subclasses:
Job, JobContext, TaskAttemptContext

public class JobContext
extends java.lang.Object

A read-only view of the job that is provided to the tasks while they are running.


Field Summary
protected static java.lang.String COMBINE_CLASS_ATTR
           
protected  JobConf conf
           
protected static java.lang.String INPUT_FORMAT_CLASS_ATTR
           
protected static java.lang.String MAP_CLASS_ATTR
           
protected static java.lang.String OUTPUT_FORMAT_CLASS_ATTR
           
protected static java.lang.String PARTITIONER_CLASS_ATTR
           
protected static java.lang.String REDUCE_CLASS_ATTR
           
 
Constructor Summary
JobContext(Configuration conf, JobID jobId)
           
 
Method Summary
 java.lang.Class<? extends Reducer<?,?,?,?>> getCombinerClass()
          Get the combiner class for the job.
 Configuration getConfiguration()
          Return the configuration for the job.
 RawComparator<?> getGroupingComparator()
          Get the user defined RawComparator comparator for grouping keys of inputs to the reduce.
 java.lang.Class<? extends InputFormat<?,?>> getInputFormatClass()
          Get the InputFormat class for the job.
 java.lang.String getJar()
          Get the pathname of the job's jar.
 JobID getJobID()
          Get the unique ID for the job.
 java.lang.String getJobName()
          Get the user-specified job name.
 java.lang.Class<?> getMapOutputKeyClass()
          Get the key class for the map output data.
 java.lang.Class<?> getMapOutputValueClass()
          Get the value class for the map output data.
 java.lang.Class<? extends Mapper<?,?,?,?>> getMapperClass()
          Get the Mapper class for the job.
 int getNumReduceTasks()
          Get configured the number of reduce tasks for this job.
 java.lang.Class<? extends OutputFormat<?,?>> getOutputFormatClass()
          Get the OutputFormat class for the job.
 java.lang.Class<?> getOutputKeyClass()
          Get the key class for the job output data.
 java.lang.Class<?> getOutputValueClass()
          Get the value class for job outputs.
 java.lang.Class<? extends Partitioner<?,?>> getPartitionerClass()
          Get the Partitioner class for the job.
 java.lang.Class<? extends Reducer<?,?,?,?>> getReducerClass()
          Get the Reducer class for the job.
 RawComparator<?> getSortComparator()
          Get the RawComparator comparator used to compare keys.
 Path getWorkingDirectory()
          Get the current working directory for the default file system.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INPUT_FORMAT_CLASS_ATTR

protected static final java.lang.String INPUT_FORMAT_CLASS_ATTR
See Also:
Constant Field Values

MAP_CLASS_ATTR

protected static final java.lang.String MAP_CLASS_ATTR
See Also:
Constant Field Values

COMBINE_CLASS_ATTR

protected static final java.lang.String COMBINE_CLASS_ATTR
See Also:
Constant Field Values

REDUCE_CLASS_ATTR

protected static final java.lang.String REDUCE_CLASS_ATTR
See Also:
Constant Field Values

OUTPUT_FORMAT_CLASS_ATTR

protected static final java.lang.String OUTPUT_FORMAT_CLASS_ATTR
See Also:
Constant Field Values

PARTITIONER_CLASS_ATTR

protected static final java.lang.String PARTITIONER_CLASS_ATTR
See Also:
Constant Field Values

conf

protected final JobConf conf
Constructor Detail

JobContext

public JobContext(Configuration conf,
                  JobID jobId)
Method Detail

getConfiguration

public Configuration getConfiguration()
Return the configuration for the job.

Returns:
the shared configuration object

getJobID

public JobID getJobID()
Get the unique ID for the job.

Returns:
the object with the job id

getNumReduceTasks

public int getNumReduceTasks()
Get configured the number of reduce tasks for this job. Defaults to 1.

Returns:
the number of reduce tasks for this job.

getWorkingDirectory

public Path getWorkingDirectory()
                         throws java.io.IOException
Get the current working directory for the default file system.

Returns:
the directory name.
Throws:
java.io.IOException

getOutputKeyClass

public java.lang.Class<?> getOutputKeyClass()
Get the key class for the job output data.

Returns:
the key class for the job output data.

getOutputValueClass

public java.lang.Class<?> getOutputValueClass()
Get the value class for job outputs.

Returns:
the value class for job outputs.

getMapOutputKeyClass

public java.lang.Class<?> getMapOutputKeyClass()
Get the key class for the map output data. If it is not set, use the (final) output key class. This allows the map output key class to be different than the final output key class.

Returns:
the map output key class.

getMapOutputValueClass

public java.lang.Class<?> getMapOutputValueClass()
Get the value class for the map output data. If it is not set, use the (final) output value class This allows the map output value class to be different than the final output value class.

Returns:
the map output value class.

getJobName

public java.lang.String getJobName()
Get the user-specified job name. This is only used to identify the job to the user.

Returns:
the job's name, defaulting to "".

getInputFormatClass

public java.lang.Class<? extends InputFormat<?,?>> getInputFormatClass()
                                                                throws java.lang.ClassNotFoundException
Get the InputFormat class for the job.

Returns:
the InputFormat class for the job.
Throws:
java.lang.ClassNotFoundException

getMapperClass

public java.lang.Class<? extends Mapper<?,?,?,?>> getMapperClass()
                                                          throws java.lang.ClassNotFoundException
Get the Mapper class for the job.

Returns:
the Mapper class for the job.
Throws:
java.lang.ClassNotFoundException

getCombinerClass

public java.lang.Class<? extends Reducer<?,?,?,?>> getCombinerClass()
                                                             throws java.lang.ClassNotFoundException
Get the combiner class for the job.

Returns:
the combiner class for the job.
Throws:
java.lang.ClassNotFoundException

getReducerClass

public java.lang.Class<? extends Reducer<?,?,?,?>> getReducerClass()
                                                            throws java.lang.ClassNotFoundException
Get the Reducer class for the job.

Returns:
the Reducer class for the job.
Throws:
java.lang.ClassNotFoundException

getOutputFormatClass

public java.lang.Class<? extends OutputFormat<?,?>> getOutputFormatClass()
                                                                  throws java.lang.ClassNotFoundException
Get the OutputFormat class for the job.

Returns:
the OutputFormat class for the job.
Throws:
java.lang.ClassNotFoundException

getPartitionerClass

public java.lang.Class<? extends Partitioner<?,?>> getPartitionerClass()
                                                                throws java.lang.ClassNotFoundException
Get the Partitioner class for the job.

Returns:
the Partitioner class for the job.
Throws:
java.lang.ClassNotFoundException

getSortComparator

public RawComparator<?> getSortComparator()
Get the RawComparator comparator used to compare keys.

Returns:
the RawComparator comparator used to compare keys.

getJar

public java.lang.String getJar()
Get the pathname of the job's jar.

Returns:
the pathname

getGroupingComparator

public RawComparator<?> getGroupingComparator()
Get the user defined RawComparator comparator for grouping keys of inputs to the reduce.

Returns:
comparator set by the user for grouping values.
See Also:
for details.


Copyright © 2009 The Apache Software Foundation