|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.hadoop.mapreduce.JobContext
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.JobContext |
---|
COMBINE_CLASS_ATTR, conf, INPUT_FORMAT_CLASS_ATTR, MAP_CLASS_ATTR, OUTPUT_FORMAT_CLASS_ATTR, PARTITIONER_CLASS_ATTR, REDUCE_CLASS_ATTR |
Constructor Summary | |
---|---|
Job()
|
|
Job(Configuration conf)
|
|
Job(Configuration conf,
java.lang.String jobName)
|
Method Summary | |
---|---|
void |
failTask(TaskAttemptID taskId)
Fail indicated task attempt. |
Counters |
getCounters()
Gets the counters for this job. |
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 |
setCombinerClass(java.lang.Class<? extends Reducer> cls)
Set the combiner class for the job. |
void |
setGroupingComparatorClass(java.lang.Class<? extends 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 |
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 |
setSortComparatorClass(java.lang.Class<? extends RawComparator> cls)
Define the comparator that controls how the keys are sorted before they are passed to the Reducer . |
void |
setWorkingDirectory(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 org.apache.hadoop.mapreduce.JobContext |
---|
getCombinerClass, getConfiguration, getGroupingComparator, getInputFormatClass, getJobID, getJobName, getMapOutputKeyClass, getMapOutputValueClass, getMapperClass, getNumReduceTasks, getOutputFormatClass, getOutputKeyClass, getOutputValueClass, getPartitionerClass, getReducerClass, getSortComparator, getWorkingDirectory |
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(Configuration conf) throws java.io.IOException
java.io.IOException
public Job(Configuration conf, java.lang.String jobName) throws java.io.IOException
java.io.IOException
Method Detail |
---|
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(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 class JobContext
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 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 RawComparator> cls) throws java.lang.IllegalStateException
Reducer
.
cls
- the raw comparator
java.lang.IllegalStateException
- if the job is submittedpublic void setGroupingComparatorClass(java.lang.Class<? extends 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 setJobName(java.lang.String name) throws java.lang.IllegalStateException
name
- the job's new name.
java.lang.IllegalStateException
- if the job is submittedpublic java.lang.String getTrackingURL()
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 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 |