org.apache.hadoop.mapred
Class JobConf

java.lang.Object
  extended byorg.apache.hadoop.conf.Configuration
      extended byorg.apache.hadoop.mapred.JobConf

public class JobConf
extends Configuration

A map/reduce job configuration. This names the Mapper, combiner (if any), Partitioner, Reducer, InputFormat, and OutputFormat implementations to be used. It also indicates the set of input files, and where the output files should be written.


Constructor Summary
JobConf()
          Construct a map/reduce job configuration.
JobConf(Class exampleClass)
          Construct a map/reduce job configuration.
JobConf(Configuration conf)
          Construct a map/reduce job configuration.
JobConf(Configuration conf, Class exampleClass)
          Construct a map/reduce job configuration.
JobConf(Path config)
          Construct a map/reduce configuration.
JobConf(String config)
          Construct a map/reduce configuration.
 
Method Summary
 void addInputDir(File dir)
          Deprecated. Call addInputPath(Path) instead.
 void addInputPath(Path dir)
           
 void deleteLocalFiles()
           
 void deleteLocalFiles(String subdir)
           
 Class getCombinerClass()
           
 InputFormat getInputFormat()
           
 Class getInputKeyClass()
           
 Path[] getInputPaths()
           
 Class getInputValueClass()
           
 String getJar()
           
 String getJobName()
          Get the user-specified job name.
 String[] getLocalDirs()
           
 File getLocalFile(String subdir, String name)
          Deprecated. Call getLocalPath(String) instead.
 Path getLocalPath(String pathString)
          Constructs a local file name.
 Class getMapOutputKeyClass()
          Get the key class for the map output data.
 Class getMapOutputValueClass()
          Get the value class for the map output data.
 Class getMapperClass()
           
 Class getMapRunnerClass()
           
 int getNumMapTasks()
           
 int getNumReduceTasks()
           
 File getOutputDir()
          Deprecated. Call getOutputPath() instead.
 OutputFormat getOutputFormat()
           
 Class getOutputKeyClass()
           
 WritableComparator getOutputKeyComparator()
           
 Path getOutputPath()
           
 Class getOutputValueClass()
           
 Class getPartitionerClass()
           
 Class getReducerClass()
           
 boolean getSpeculativeExecution()
          Should speculative execution be used for this job?
 Path getSystemDir()
           
 String getUser()
          Get the reported username for this job.
 Path getWorkingDirectory()
          Get the current working directory for the default file system.
 Object newInstance(Class theClass)
           
 void setCombinerClass(Class theClass)
           
 void setInputDir(File dir)
          Deprecated. Call setInputPath(Path) instead.
 void setInputFormat(Class theClass)
           
 void setInputKeyClass(Class theClass)
           
 void setInputPath(Path dir)
           
 void setInputValueClass(Class theClass)
           
 void setJar(String jar)
           
 void setJobName(String name)
          Set the user-specified job name.
 void setMapOutputKeyClass(Class theClass)
          Set the key class for the map output data.
 void setMapOutputValueClass(Class theClass)
          Set the value class for the map output data.
 void setMapperClass(Class theClass)
           
 void setMapRunnerClass(Class theClass)
           
 void setNumMapTasks(int n)
           
 void setNumReduceTasks(int n)
           
 void setOutputDir(File dir)
          Deprecated. Call setOutputPath(Path) instead.
 void setOutputFormat(Class theClass)
           
 void setOutputKeyClass(Class theClass)
           
 void setOutputKeyComparatorClass(Class theClass)
           
 void setOutputPath(Path dir)
           
 void setOutputValueClass(Class theClass)
           
 void setPartitionerClass(Class theClass)
           
 void setReducerClass(Class theClass)
           
 void setSpeculativeExecution(boolean new_val)
          Turn on or off speculative execution for this job.
 void setUser(String user)
          Set the reported username for this job.
 void setWorkingDirectory(Path dir)
          Set the current working directory for the default file system
 
Methods inherited from class org.apache.hadoop.conf.Configuration
addDefaultResource, addDefaultResource, addFinalResource, addFinalResource, get, get, get, getBoolean, getClass, getClass, getConfResourceAsInputStream, getConfResourceAsReader, getFile, getFloat, getInt, getLocalPath, getLong, getObject, getResource, getStrings, main, set, setBoolean, setClass, setInt, setLong, setObject, toString, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JobConf

public JobConf()
Construct a map/reduce job configuration.


JobConf

public JobConf(Class exampleClass)
Construct a map/reduce job configuration.

Parameters:
exampleClass - a class whose containing jar is used as the job's jar.

JobConf

public JobConf(Configuration conf)
Construct a map/reduce job configuration.

Parameters:
conf - a Configuration whose settings will be inherited.

JobConf

public JobConf(Configuration conf,
               Class exampleClass)
Construct a map/reduce job configuration.

Parameters:
conf - a Configuration whose settings will be inherited.
exampleClass - a class whose containing jar is used as the job's jar.

JobConf

public JobConf(String config)
Construct a map/reduce configuration.

Parameters:
config - a Configuration-format XML job description file

JobConf

public JobConf(Path config)
Construct a map/reduce configuration.

Parameters:
config - a Configuration-format XML job description file
Method Detail

getJar

public String getJar()

setJar

public void setJar(String jar)

getSystemDir

public Path getSystemDir()

getLocalDirs

public String[] getLocalDirs()
                      throws IOException
Throws:
IOException

deleteLocalFiles

public void deleteLocalFiles()
                      throws IOException
Throws:
IOException

deleteLocalFiles

public void deleteLocalFiles(String subdir)
                      throws IOException
Throws:
IOException

getLocalFile

public File getLocalFile(String subdir,
                         String name)
                  throws IOException
Deprecated. Call getLocalPath(String) instead.

Throws:
IOException

getLocalPath

public Path getLocalPath(String pathString)
                  throws IOException
Constructs a local file name. Files are distributed among configured local directories.

Throws:
IOException

setInputDir

public void setInputDir(File dir)
Deprecated. Call setInputPath(Path) instead.


setInputPath

public void setInputPath(Path dir)

addInputDir

public void addInputDir(File dir)
Deprecated. Call addInputPath(Path) instead.


addInputPath

public void addInputPath(Path dir)

getInputPaths

public Path[] getInputPaths()

getUser

public String getUser()
Get the reported username for this job.

Returns:
the username

setUser

public void setUser(String user)
Set the reported username for this job.

Parameters:
user - the username

setWorkingDirectory

public void setWorkingDirectory(Path dir)
Set the current working directory for the default file system

Parameters:
dir - the new current working directory

getWorkingDirectory

public Path getWorkingDirectory()
Get the current working directory for the default file system.

Returns:
the directory name

getOutputDir

public File getOutputDir()
Deprecated. Call getOutputPath() instead.


getOutputPath

public Path getOutputPath()

setOutputDir

public void setOutputDir(File dir)
Deprecated. Call setOutputPath(Path) instead.


setOutputPath

public void setOutputPath(Path dir)

getInputFormat

public InputFormat getInputFormat()

setInputFormat

public void setInputFormat(Class theClass)

getOutputFormat

public OutputFormat getOutputFormat()

setOutputFormat

public void setOutputFormat(Class theClass)

getInputKeyClass

public Class getInputKeyClass()

setInputKeyClass

public void setInputKeyClass(Class theClass)

getInputValueClass

public Class getInputValueClass()

setInputValueClass

public void setInputValueClass(Class theClass)

getMapOutputKeyClass

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

Returns:
map output key class

setMapOutputKeyClass

public void setMapOutputKeyClass(Class theClass)
Set the key class for the map output data. This allows the user to specify the map output key class to be different than the final output value 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:
map output value class

setMapOutputValueClass

public void setMapOutputValueClass(Class theClass)
Set the value class for the map output data. This allows the user to specify the map output value class to be different than the final output value class


getOutputKeyClass

public Class getOutputKeyClass()

setOutputKeyClass

public void setOutputKeyClass(Class theClass)

getOutputKeyComparator

public WritableComparator getOutputKeyComparator()

setOutputKeyComparatorClass

public void setOutputKeyComparatorClass(Class theClass)

getOutputValueClass

public Class getOutputValueClass()

setOutputValueClass

public void setOutputValueClass(Class theClass)

getMapperClass

public Class getMapperClass()

setMapperClass

public void setMapperClass(Class theClass)

getMapRunnerClass

public Class getMapRunnerClass()

setMapRunnerClass

public void setMapRunnerClass(Class theClass)

getPartitionerClass

public Class getPartitionerClass()

setPartitionerClass

public void setPartitionerClass(Class theClass)

getReducerClass

public Class getReducerClass()

setReducerClass

public void setReducerClass(Class theClass)

getCombinerClass

public Class getCombinerClass()

setCombinerClass

public void setCombinerClass(Class theClass)

getSpeculativeExecution

public boolean getSpeculativeExecution()
Should speculative execution be used for this job?

Returns:
Defaults to true

setSpeculativeExecution

public void setSpeculativeExecution(boolean new_val)
Turn on or off speculative execution for this job. In general, it should be turned off for map jobs that have side effects.


getNumMapTasks

public int getNumMapTasks()

setNumMapTasks

public void setNumMapTasks(int n)

getNumReduceTasks

public int getNumReduceTasks()

setNumReduceTasks

public void setNumReduceTasks(int n)

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 ""

setJobName

public void setJobName(String name)
Set the user-specified job name.

Parameters:
name - the job's new name

newInstance

public Object newInstance(Class theClass)


Copyright © 2006 The Apache Software Foundation