|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.hadoop.mapreduce.task.JobContextImpl
org.apache.hadoop.mapreduce.Job
public class Job
The job submitter's view of the Job. It allows the user to configure the job, submit it, control its execution, and query the state. The set methods only work until the job is submitted, afterwards they will throw an IllegalStateException.
Nested Class Summary | |
---|---|
static class |
Job.JobState
|
Field Summary |
---|
Fields inherited from class org.apache.hadoop.mapreduce.task.JobContextImpl |
---|
conf, credentials, ugi |
Constructor Summary | |
---|---|
Job()
|
|
Job(org.apache.hadoop.conf.Configuration conf)
|
|
Job(org.apache.hadoop.conf.Configuration conf,
java.lang.String jobName)
|
Method Summary | |
---|---|
void |
failTask(TaskAttemptID taskId)
Fail indicated task attempt. |
Counters |
getCounters()
Gets the counters for this job. |
static Job |
getInstance()
Creates a new Job
A Job will be created with a generic Configuration . |
static Job |
getInstance(org.apache.hadoop.conf.Configuration conf)
Creates a new Job with a given Configuration . |
static Job |
getInstance(org.apache.hadoop.conf.Configuration conf,
java.lang.String jobName)
Creates a new Job with a given Configuration
and a given jobName. |
java.lang.String |
getJar()
Get the pathname of the job's jar. |
TaskCompletionEvent[] |
getTaskCompletionEvents(int startFrom)
Get events indicating completion (success/failure) of component tasks. |
java.lang.String |
getTrackingURL()
Get the URL where some job progress information will be displayed. |
boolean |
isComplete()
Check if the job is finished or not. |
boolean |
isSuccessful()
Check if the job completed successfully. |
void |
killJob()
Kill the running job. |
void |
killTask(TaskAttemptID taskId)
Kill indicated task attempt. |
float |
mapProgress()
Get the progress of the job's map-tasks, as a float between 0.0 and 1.0. |
float |
reduceProgress()
Get the progress of the job's reduce-tasks, as a float between 0.0 and 1.0. |
void |
setCancelDelegationTokenUponJobCompletion(boolean value)
Sets the flag that will allow the JobTracker to cancel the HDFS delegation tokens upon job completion. |
void |
setCombinerClass(java.lang.Class<? extends Reducer> cls)
Set the combiner class for the job. |
void |
setCombinerKeyGroupingComparatorClass(java.lang.Class<? extends org.apache.hadoop.io.RawComparator> cls)
Define the comparator that controls which keys are grouped together for a single call to combiner, Reducer.reduce(Object, Iterable,
org.apache.hadoop.mapreduce.Reducer.Context) |
void |
setGroupingComparatorClass(java.lang.Class<? extends org.apache.hadoop.io.RawComparator> cls)
Define the comparator that controls which keys are grouped together for a single call to Reducer.reduce(Object, Iterable,
org.apache.hadoop.mapreduce.Reducer.Context) |
void |
setInputFormatClass(java.lang.Class<? extends InputFormat> cls)
Set the InputFormat for the job. |
void |
setJarByClass(java.lang.Class<?> cls)
Set the Jar by finding where a given class came from. |
void |
setJobName(java.lang.String name)
Set the user-specified job name. |
void |
setMapOutputKeyClass(java.lang.Class<?> theClass)
Set the key class for the map output data. |
void |
setMapOutputValueClass(java.lang.Class<?> theClass)
Set the value class for the map output data. |
void |
setMapperClass(java.lang.Class<? extends Mapper> cls)
Set the Mapper for the job. |
void |
setMapSpeculativeExecution(boolean speculativeExecution)
Turn speculative execution on or off for this job for map tasks. |
void |
setNumReduceTasks(int tasks)
Set the number of reduce tasks for the job. |
void |
setOutputFormatClass(java.lang.Class<? extends OutputFormat> cls)
Set the OutputFormat for the job. |
void |
setOutputKeyClass(java.lang.Class<?> theClass)
Set the key class for the job output data. |
void |
setOutputValueClass(java.lang.Class<?> theClass)
Set the value class for job outputs. |
void |
setPartitionerClass(java.lang.Class<? extends Partitioner> cls)
Set the Partitioner for the job. |
void |
setReducerClass(java.lang.Class<? extends Reducer> cls)
Set the Reducer for the job. |
void |
setReduceSpeculativeExecution(boolean speculativeExecution)
Turn speculative execution on or off for this job for reduce tasks. |
void |
setSortComparatorClass(java.lang.Class<? extends org.apache.hadoop.io.RawComparator> cls)
Define the comparator that controls how the keys are sorted before they are passed to the Reducer . |
void |
setSpeculativeExecution(boolean speculativeExecution)
Turn speculative execution on or off for this job. |
float |
setupProgress()
Get the progress of the job's setup, as a float between 0.0 and 1.0. |
void |
setUserClassesTakesPrecedence(boolean value)
Set the boolean property for specifying which classpath takes precedence - the user's one or the system one, when the tasks are launched |
void |
setWorkingDirectory(org.apache.hadoop.fs.Path dir)
Set the current working directory for the default file system. |
void |
submit()
Submit the job to the cluster and return immediately. |
boolean |
waitForCompletion(boolean verbose)
Submit the job to the cluster and wait for it to finish. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Job() throws java.io.IOException
java.io.IOException
public Job(org.apache.hadoop.conf.Configuration conf) throws java.io.IOException
java.io.IOException
public Job(org.apache.hadoop.conf.Configuration conf, java.lang.String jobName) throws java.io.IOException
java.io.IOException
Method Detail |
---|
public static Job getInstance() throws java.io.IOException
Job
A Job will be created with a generic Configuration
.
Job
java.io.IOException
public static Job getInstance(org.apache.hadoop.conf.Configuration conf) throws java.io.IOException
Job
with a given Configuration
.
The Job
makes a copy of the Configuration
so
that any necessary internal modifications do not reflect on the incoming
parameter.
conf
- the Configuration
Job
java.io.IOException
public static Job getInstance(org.apache.hadoop.conf.Configuration conf, java.lang.String jobName) throws java.io.IOException
Job
with a given Configuration
and a given jobName.
The Job
makes a copy of the Configuration
so
that any necessary internal modifications do not reflect on the incoming
parameter.
conf
- the Configuration
jobName
- the job instance's name
Job
java.io.IOException
public void setNumReduceTasks(int tasks) throws java.lang.IllegalStateException
tasks
- the number of reduce tasks
java.lang.IllegalStateException
- if the job is submittedpublic void setWorkingDirectory(org.apache.hadoop.fs.Path dir) throws java.io.IOException
dir
- the new current working directory.
java.lang.IllegalStateException
- if the job is submitted
java.io.IOException
public void setInputFormatClass(java.lang.Class<? extends InputFormat> cls) throws java.lang.IllegalStateException
InputFormat
for the job.
cls
- the InputFormat
to use
java.lang.IllegalStateException
- if the job is submittedpublic void setOutputFormatClass(java.lang.Class<? extends OutputFormat> cls) throws java.lang.IllegalStateException
OutputFormat
for the job.
cls
- the OutputFormat
to use
java.lang.IllegalStateException
- if the job is submittedpublic void setMapperClass(java.lang.Class<? extends Mapper> cls) throws java.lang.IllegalStateException
Mapper
for the job.
cls
- the Mapper
to use
java.lang.IllegalStateException
- if the job is submittedpublic void setJarByClass(java.lang.Class<?> cls)
cls
- the example classpublic java.lang.String getJar()
getJar
in interface JobContext
getJar
in class JobContextImpl
public void setCombinerClass(java.lang.Class<? extends Reducer> cls) throws java.lang.IllegalStateException
cls
- the combiner to use
java.lang.IllegalStateException
- if the job is submittedpublic void setReducerClass(java.lang.Class<? extends Reducer> cls) throws java.lang.IllegalStateException
Reducer
for the job.
cls
- the Reducer
to use
java.lang.IllegalStateException
- if the job is submittedpublic void setPartitionerClass(java.lang.Class<? extends Partitioner> cls) throws java.lang.IllegalStateException
Partitioner
for the job.
cls
- the Partitioner
to use
java.lang.IllegalStateException
- if the job is submittedpublic void setMapOutputKeyClass(java.lang.Class<?> theClass) throws java.lang.IllegalStateException
theClass
- the map output key class.
java.lang.IllegalStateException
- if the job is submittedpublic void setMapOutputValueClass(java.lang.Class<?> theClass) throws java.lang.IllegalStateException
theClass
- the map output value class.
java.lang.IllegalStateException
- if the job is submittedpublic void setOutputKeyClass(java.lang.Class<?> theClass) throws java.lang.IllegalStateException
theClass
- the key class for the job output data.
java.lang.IllegalStateException
- if the job is submittedpublic void setSpeculativeExecution(boolean speculativeExecution)
speculativeExecution
- true
if speculative execution
should be turned on, else false
.public void setMapSpeculativeExecution(boolean speculativeExecution)
speculativeExecution
- true
if speculative execution
should be turned on for map tasks,
else false
.public void setReduceSpeculativeExecution(boolean speculativeExecution)
speculativeExecution
- true
if speculative execution
should be turned on for reduce tasks,
else false
.public void setOutputValueClass(java.lang.Class<?> theClass) throws java.lang.IllegalStateException
theClass
- the value class for job outputs.
java.lang.IllegalStateException
- if the job is submittedpublic void setSortComparatorClass(java.lang.Class<? extends org.apache.hadoop.io.RawComparator> cls) throws java.lang.IllegalStateException
Reducer
.
cls
- the raw comparator
java.lang.IllegalStateException
- if the job is submittedsetCombinerKeyGroupingComparatorClass(Class)
public void setCombinerKeyGroupingComparatorClass(java.lang.Class<? extends org.apache.hadoop.io.RawComparator> cls) throws java.lang.IllegalStateException
Reducer.reduce(Object, Iterable,
org.apache.hadoop.mapreduce.Reducer.Context)
cls
- the raw comparator to use
java.lang.IllegalStateException
- if the job is submittedpublic void setGroupingComparatorClass(java.lang.Class<? extends org.apache.hadoop.io.RawComparator> cls) throws java.lang.IllegalStateException
Reducer.reduce(Object, Iterable,
org.apache.hadoop.mapreduce.Reducer.Context)
cls
- the raw comparator to use
java.lang.IllegalStateException
- if the job is submittedsetCombinerKeyGroupingComparatorClass(Class)
public void setJobName(java.lang.String name) throws java.lang.IllegalStateException
name
- the job's new name.
java.lang.IllegalStateException
- if the job is submittedpublic void setUserClassesTakesPrecedence(boolean value)
value
- pass true if user's classes should take precedencepublic java.lang.String getTrackingURL()
public float setupProgress() throws java.io.IOException
java.io.IOException
public float mapProgress() throws java.io.IOException
java.io.IOException
public float reduceProgress() throws java.io.IOException
java.io.IOException
public boolean isComplete() throws java.io.IOException
true
if the job is complete, else false
.
java.io.IOException
public boolean isSuccessful() throws java.io.IOException
true
if the job succeeded, else false
.
java.io.IOException
public void killJob() throws java.io.IOException
java.io.IOException
public TaskCompletionEvent[] getTaskCompletionEvents(int startFrom) throws java.io.IOException
startFrom
- index to start fetching events from
TaskCompletionEvent
s
java.io.IOException
public void killTask(TaskAttemptID taskId) throws java.io.IOException
taskId
- the id of the task to be terminated.
java.io.IOException
public void failTask(TaskAttemptID taskId) throws java.io.IOException
taskId
- the id of the task to be terminated.
java.io.IOException
public Counters getCounters() throws java.io.IOException
java.io.IOException
public void setCancelDelegationTokenUponJobCompletion(boolean value)
public void submit() throws java.io.IOException, java.lang.InterruptedException, java.lang.ClassNotFoundException
java.io.IOException
java.lang.InterruptedException
java.lang.ClassNotFoundException
public boolean waitForCompletion(boolean verbose) throws java.io.IOException, java.lang.InterruptedException, java.lang.ClassNotFoundException
verbose
- print the progress to the user
java.io.IOException
- thrown if the communication with the
JobTracker
is lost
java.lang.InterruptedException
java.lang.ClassNotFoundException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |