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 Object

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


Field Summary
static String CACHE_ARCHIVES_VISIBILITIES
           
static String CACHE_FILE_VISIBILITIES
           
protected static String COMBINE_CLASS_ATTR
           
protected  JobConf conf
           
protected  Credentials credentials
           
protected static String INPUT_FORMAT_CLASS_ATTR
           
static String JOB_ACL_MODIFY_JOB
           
static String JOB_ACL_VIEW_JOB
           
static String JOB_CANCEL_DELEGATION_TOKEN
           
static String JOB_NAMENODES
           
protected static String MAP_CLASS_ATTR
           
protected static String OUTPUT_FORMAT_CLASS_ATTR
           
protected static String PARTITIONER_CLASS_ATTR
           
protected static String REDUCE_CLASS_ATTR
           
protected  UserGroupInformation ugi
          The UserGroupInformation object that has a reference to the current user
static String USER_LOG_RETAIN_HOURS
           
 
Constructor Summary
JobContext(Configuration conf, JobID jobId)
           
 
Method Summary
 Class<? extends Reducer<?,?,?,?>> getCombinerClass()
          Get the combiner class for the job.
 Configuration getConfiguration()
          Return the configuration for the job.
 Credentials getCredentials()
          Get credentials for the job.
 RawComparator<?> getGroupingComparator()
          Get the user defined RawComparator comparator for grouping keys of inputs to the reduce.
 Class<? extends InputFormat<?,?>> getInputFormatClass()
          Get the InputFormat class for the job.
 String getJar()
          Get the pathname of the job's jar.
 JobID getJobID()
          Get the unique ID for the job.
 String getJobName()
          Get the user-specified job name.
 Class<?> getMapOutputKeyClass()
          Get the key class for the map output data.
 Class<?> getMapOutputValueClass()
          Get the value class for the map output data.
 Class<? extends Mapper<?,?,?,?>> getMapperClass()
          Get the Mapper class for the job.
 int getNumReduceTasks()
          Get configured the number of reduce tasks for this job.
 Class<? extends OutputFormat<?,?>> getOutputFormatClass()
          Get the OutputFormat class for the job.
 Class<?> getOutputKeyClass()
          Get the key class for the job output data.
 Class<?> getOutputValueClass()
          Get the value class for job outputs.
 Class<? extends Partitioner<?,?>> getPartitionerClass()
          Get the Partitioner class for the job.
 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 String INPUT_FORMAT_CLASS_ATTR
See Also:
Constant Field Values

MAP_CLASS_ATTR

protected static final String MAP_CLASS_ATTR
See Also:
Constant Field Values

COMBINE_CLASS_ATTR

protected static final String COMBINE_CLASS_ATTR
See Also:
Constant Field Values

REDUCE_CLASS_ATTR

protected static final String REDUCE_CLASS_ATTR
See Also:
Constant Field Values

OUTPUT_FORMAT_CLASS_ATTR

protected static final String OUTPUT_FORMAT_CLASS_ATTR
See Also:
Constant Field Values

PARTITIONER_CLASS_ATTR

protected static final String PARTITIONER_CLASS_ATTR
See Also:
Constant Field Values

conf

protected final JobConf conf

credentials

protected final Credentials credentials

JOB_NAMENODES

public static final String JOB_NAMENODES
See Also:
Constant Field Values

JOB_ACL_VIEW_JOB

public static final String JOB_ACL_VIEW_JOB
See Also:
Constant Field Values

JOB_ACL_MODIFY_JOB

public static final String JOB_ACL_MODIFY_JOB
See Also:
Constant Field Values

CACHE_FILE_VISIBILITIES

public static final String CACHE_FILE_VISIBILITIES
See Also:
Constant Field Values

CACHE_ARCHIVES_VISIBILITIES

public static final String CACHE_ARCHIVES_VISIBILITIES
See Also:
Constant Field Values

JOB_CANCEL_DELEGATION_TOKEN

public static final String JOB_CANCEL_DELEGATION_TOKEN
See Also:
Constant Field Values

USER_LOG_RETAIN_HOURS

public static final String USER_LOG_RETAIN_HOURS
See Also:
Constant Field Values

ugi

protected UserGroupInformation ugi
The UserGroupInformation object that has a reference to the current user

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

getCredentials

public Credentials getCredentials()
Get credentials for the job.

Returns:
credentials for the job

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 IOException
Get the current working directory for the default file system.

Returns:
the directory name.
Throws:
IOException

getOutputKeyClass

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

Returns:
the key class for the job output data.

getOutputValueClass

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

Returns:
the value class for job outputs.

getMapOutputKeyClass

public 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 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 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 Class<? extends InputFormat<?,?>> getInputFormatClass()
                                                      throws ClassNotFoundException
Get the InputFormat class for the job.

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

getMapperClass

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

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

getCombinerClass

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

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

getReducerClass

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

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

getOutputFormatClass

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

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

getPartitionerClass

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

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

getSortComparator

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

Returns:
the RawComparator comparator used to compare keys.

getJar

public 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