## org.apache.hadoop.mapred.jobcontrol
Class Job

    java.lang.Object
      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 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.

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)` Construct a job.
`Job(JobConf jobConf, ArrayList<Job> dependingJobs)` Construct a job.

Method Summary
`boolean` `addDependingJob(Job dependingJob)` Add a job to this jobs' dependency list.
`JobID` `getAssignedJobID()`
`ArrayList<Job>` `getDependingJobs()`
`JobClient` `getJobClient()`
`JobConf` `getJobConf()`
`String` `getJobID()`
`String` `getJobName()`
`String` `getMapredJobID()` Deprecated. use `getAssignedJobID()` instead
`String` `getMessage()`
`int` `getState()`
`boolean` `isCompleted()`
`boolean` `isReady()`
`void` `setAssignedJobID(JobID mapredJobID)` Set the mapred ID for this job as assigned by the mapred framework.
`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)` Deprecated. use `setAssignedJobID(JobID)` instead
`void` `setMessage(String message)` Set the message for this job.
`protected void` `setState(int state)` Set the state for this job.
`protected 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<Job> 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`

### Job

    public Job(JobConf jobConf)
        throws IOException

  Construct a job.

  Parameters:
    `jobConf` - mapred job configuration representing a job to be executed.
  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 assigned by JobControl

### setJobID

    public void setJobID(String id)

  Set the job ID for this job.

  Parameters:
    `id` - the job ID

### getMapredJobID

    @Deprecated
    public String getMapredJobID()

  Deprecated. use `getAssignedJobID()` instead

  Returns:
    the mapred ID of this job

### setMapredJobID

    @Deprecated
    public void setMapredJobID(String mapredJobID)

  Deprecated. use `setAssignedJobID(JobID)` instead

  Set the mapred ID for this job.

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

### getAssignedJobID

    public JobID getAssignedJobID()

  Returns:
    the mapred ID of this job as assigned by the mapred framework.

### setAssignedJobID

    public void setAssignedJobID(JobID mapredJobID)

  Set the mapred ID for this job as assigned by the mapred framework.

  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

    protected 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.

### getJobClient

    public JobClient getJobClient()

  Returns:
    the job client of this job

### getDependingJobs

    public ArrayList<Job> getDependingJobs()

  Returns:
    the depending jobs of this job

### addDependingJob

    public boolean addDependingJob(Job dependingJob)

  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:
    `true` if 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

### submit

    protected void submit()

  Submit this job to mapred. The state becomes RUNNING if submission is successful, FAILED otherwise.

Copyright © 2009 The Apache Software Foundation