org.apache.hadoop.mapred.jobcontrol
Class Job

java.lang.Object
  extended by org.apache.hadoop.mapred.jobcontrol.Job

public class Job
extends Object

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 stats in the WAITING state. If it does not have any deoending 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 jon execution.


Field Summary
static int DEPENDENT_FAILED
           
static int FAILED
           
static int READY
           
static int RUNNING
           
static int SUCCESS
           
static int WAITING
           
 
Constructor Summary
Job(JobConf jobConf, ArrayList dependingJobs)
          Construct a job.
 
Method Summary
 int checkState()
          Check and update the state of this job.
 ArrayList getDependingJobs()
           
 JobConf getJobConf()
           
 String getJobID()
           
 String getJobName()
           
 String getMapredJobID()
           
 String getMessage()
           
 int getState()
           
 boolean isCompleted()
           
 boolean isReady()
           
static void main(String[] args)
           
 void setJobConf(JobConf jobConf)
          Set the mapred job conf for this job.
 void setJobID(String id)
          Set the job ID for this job.
 void setJobName(String jobName)
          Set the job name for this job.
 void setMapredJobID(String mapredJobID)
          Set the mapred ID for this job.
 void setMessage(String message)
          Set the message for this job.
 void setState(int state)
          Set the state for this job.
 void submit()
          Submit this job to mapred.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SUCCESS

public static final int SUCCESS
See Also:
Constant Field Values

WAITING

public static final int WAITING
See Also:
Constant Field Values

RUNNING

public static final int RUNNING
See Also:
Constant Field Values

READY

public static final int READY
See Also:
Constant Field Values

FAILED

public static final int FAILED
See Also:
Constant Field Values

DEPENDENT_FAILED

public static final int DEPENDENT_FAILED
See Also:
Constant Field Values
Constructor Detail

Job

public Job(JobConf jobConf,
           ArrayList dependingJobs)
    throws IOException
Construct a job.

Parameters:
jobConf - a mapred job configuration representing a job to be executed.
dependingJobs - an array of jobs the current job depends on
Throws:
IOException
Method Detail

toString

public String toString()
Overrides:
toString in class Object

getJobName

public String getJobName()
Returns:
the job name of this job

setJobName

public void setJobName(String jobName)
Set the job name for this job.

Parameters:
jobName - the job name

getJobID

public String getJobID()
Returns:
the job ID of this job

setJobID

public void setJobID(String id)
Set the job ID for this job.

Parameters:
id - the job ID

getMapredJobID

public String getMapredJobID()
Returns:
the mapred ID of this job

setMapredJobID

public void setMapredJobID(String mapredJobID)
Set the mapred ID for this job.

Parameters:
mapredJobID - the mapred job ID for this job.

getJobConf

public JobConf getJobConf()
Returns:
the mapred job conf of this job

setJobConf

public void setJobConf(JobConf jobConf)
Set the mapred job conf for this job.

Parameters:
jobConf - the mapred job conf for this job.

getState

public int getState()
Returns:
the state of this job

setState

public void setState(int state)
Set the state for this job.

Parameters:
state - the new state for this job.

getMessage

public String getMessage()
Returns:
the message of this job

setMessage

public void setMessage(String message)
Set the message for this job.

Parameters:
message - the message for this job.

getDependingJobs

public ArrayList getDependingJobs()
Returns:
the depending jobs of this job

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

checkState

public int checkState()
Check and update the state of this job. The state changes depending on its current state and the states of the depending jobs.


submit

public void submit()
Submit this job to mapred. The state becomes RUNNING if submission is successful, FAILED otherwise.


main

public static void main(String[] args)
Parameters:
args -


Copyright © 2006 The Apache Software Foundation