Class ControlledJob
java.lang.Object
org.apache.hadoop.mapreduce.lib.jobcontrol.ControlledJob
- Direct Known Subclasses:
Job
This class encapsulates a MapReduce job and its dependency. It monitors
the states of the depending jobs and updates the state of this job.
A job starts in the WAITING state. If it does not have any depending jobs,
or all of the depending jobs are in SUCCESS state, then the job state
will become READY. If any depending jobs fail, the job will fail too.
When in READY state, the job can be submitted to Hadoop for execution, with
the state changing into RUNNING state. From RUNNING state, the job
can get into SUCCESS or FAILED state, depending
the status of the job execution.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionControlledJob(Configuration conf) Construct a job.ControlledJob(Job job, List<ControlledJob> dependingJobs) Construct a job. -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddDependingJob(ControlledJob dependingJob) Add a job to this jobs' dependency list.voidgetJob()getJobID()booleanbooleanisReady()voidkillJob()voidSet the mapreduce jobvoidSet the job ID for this job.voidsetJobName(String jobName) Set the job name for this job.protected voidsetJobState(ControlledJob.State state) Set the state for this job.voidsetMessage(String message) Set the message for this job.protected voidsubmit()Submit this job to mapred.toString()
-
Field Details
-
CREATE_DIR
- See Also:
-
-
Constructor Details
-
ControlledJob
Construct a job.- Parameters:
job- a mapreduce job to be executed.dependingJobs- an array of jobs the current job depends on- Throws:
IOException
-
ControlledJob
Construct a job.- Parameters:
conf- mapred job configuration representing a job to be executed.- Throws:
IOException
-
-
Method Details
-
toString
-
getJobName
- Returns:
- the job name of this job
-
setJobName
Set the job name for this job.- Parameters:
jobName- the job name
-
getJobID
- Returns:
- the job ID of this job assigned by JobControl
-
setJobID
Set the job ID for this job.- Parameters:
id- the job ID
-
getMapredJobId
- Returns:
- the mapred ID of this job as assigned by the mapred framework.
-
getJob
- Returns:
- the mapreduce job
-
setJob
Set the mapreduce job- Parameters:
job- the mapreduce job for this job.
-
getJobState
- Returns:
- the state of this job
-
setJobState
Set the state for this job.- Parameters:
state- the new state for this job.
-
getMessage
- Returns:
- the message of this job
-
setMessage
Set the message for this job.- Parameters:
message- the message for this job.
-
getDependentJobs
- Returns:
- the depending jobs of this job
-
addDependingJob
Add a job to this jobs' dependency list. Dependent jobs can only be added while a Job is waiting to run, not during or afterwards.- Parameters:
dependingJob- Job that this Job depends on.- Returns:
trueif the Job was added.
-
isCompleted
public boolean isCompleted()- Returns:
- true if this job is in a complete state
-
isReady
public boolean isReady()- Returns:
- true if this job is in READY state
-
killJob
- Throws:
IOExceptionInterruptedException
-
failJob
- Throws:
IOExceptionInterruptedException
-
submit
protected void submit()Submit this job to mapred. The state becomes RUNNING if submission is successful, FAILED otherwise.
-