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()
           
JobConf(Configuration conf)
          Construct a map/reduce job configuration.
JobConf(Configuration conf, Class aClass)
          Construct a map/reduce job configuration.
JobConf(File config)
          Construct a map/reduce configuration.
JobConf(String config)
          Construct a map/reduce configuration.
 
Method Summary
 void addInputDir(File dir)
           
 void deleteLocalFiles()
           
 void deleteLocalFiles(String subdir)
           
 Class getCombinerClass()
           
 File[] getInputDirs()
           
 InputFormat getInputFormat()
           
 Class getInputKeyClass()
           
 Class getInputValueClass()
           
 String getJar()
           
 String getJobName()
          Get the user-specified job name.
 String[] getLocalDirs()
           
 File getLocalFile(String subdir, String name)
          Constructs a local file name.
 Class getMapperClass()
           
 Class getMapRunnerClass()
           
 int getNumMapTasks()
           
 int getNumReduceTasks()
           
 File getOutputDir()
           
 OutputFormat getOutputFormat()
           
 Class getOutputKeyClass()
           
 WritableComparator getOutputKeyComparator()
           
 Class getOutputValueClass()
           
 Class getPartitionerClass()
           
 Class getReducerClass()
           
 boolean getSpeculativeExecution()
          Should speculative execution be used for this job?
 File getSystemDir()
           
 String getUser()
          Get the reported username for this job.
 String getWorkingDirectory()
          Get the current working directory for the default file system.
 Object newInstance(Class theClass)
           
 void setCombinerClass(Class theClass)
           
 void setInputDir(File dir)
           
 void setInputFormat(Class theClass)
           
 void setInputKeyClass(Class theClass)
           
 void setInputValueClass(Class theClass)
           
 void setJar(String jar)
           
 void setJobName(String name)
          Set the user-specified job name.
 void setMapperClass(Class theClass)
           
 void setMapRunnerClass(Class theClass)
           
 void setNumMapTasks(int n)
           
 void setNumReduceTasks(int n)
           
 void setOutputDir(File dir)
           
 void setOutputFormat(Class theClass)
           
 void setOutputKeyClass(Class theClass)
           
 void setOutputKeyComparatorClass(Class theClass)
           
 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(String 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, 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()

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 aClass)
Construct a map/reduce job configuration.

Parameters:
conf - a Configuration whose settings will be inherited.
aClass - 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(File 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 File 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
Constructs a local file name. Files are distributed among configured local directories.

Throws:
IOException

setInputDir

public void setInputDir(File dir)

addInputDir

public void addInputDir(File dir)

getInputDirs

public File[] getInputDirs()

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(String dir)
Set the current working directory for the default file system

Parameters:
dir - the new current working directory

getWorkingDirectory

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

Returns:
the directory name

getOutputDir

public File getOutputDir()

setOutputDir

public void setOutputDir(File 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)

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