org.apache.hadoop.mapreduce.lib.jobcontrol

## Class JobControl

- java.lang.Object
- - org.apache.hadoop.mapreduce.lib.jobcontrol.JobControl

- All Implemented Interfaces:
    Runnable
  Direct Known Subclasses:
    JobControl

      @InterfaceAudience.Public
       @InterfaceStability.Evolving
      public class JobControl
      extends Object
      implements Runnable

  This class encapsulates a set of MapReduce jobs and its dependency. It tracks the states of the jobs by placing them into different tables according to their states. This class provides APIs for the client app to add a job to the group and to get the jobs in the group in different states. When a job is added, an ID unique to the group is assigned to the job. This class has a thread that submits jobs when they become ready, monitors the states of the running jobs, and updates the states of jobs based on the state changes of their depending jobs states. The class provides APIs for suspending/resuming the thread, and for stopping the thread.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `JobControl.ThreadState`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `JobControl(String groupName)` Construct a job control for a group of jobs.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `addJob(ControlledJob aJob)` Add a new controlled job.
    `String` | `addJob(Job aJob)` Add a new job.
    `void` | `addJobCollection(Collection<ControlledJob> jobs)` Add a collection of jobs
    `boolean` | `allFinished()`
    `List<ControlledJob>` | `getFailedJobList()`
    `List<ControlledJob>` | `getReadyJobsList()`
    `List<ControlledJob>` | `getRunningJobList()`
    `List<ControlledJob>` | `getSuccessfulJobList()`
    `JobControl.ThreadState` | `getThreadState()`
    `List<ControlledJob>` | `getWaitingJobList()`
    `void` | `resume()` resume the suspended thread
    `void` | `run()` The main loop for the thread.
    `void` | `stop()` set the thread state to STOPPING so that the thread will stop when it wakes up.
    `void` | `suspend()` suspend the running thread

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### JobControl

          public JobControl(String groupName)

      Construct a job control for a group of jobs.
      Parameters:
        `groupName` - a name identifying this group

  - ### Method Detail

    - #### getWaitingJobList

          public List<ControlledJob> getWaitingJobList()

      Returns:
        the jobs in the waiting state

    - #### getRunningJobList

          public List<ControlledJob> getRunningJobList()

      Returns:
        the jobs in the running state

    - #### getReadyJobsList

          public List<ControlledJob> getReadyJobsList()

      Returns:
        the jobs in the ready state

    - #### getSuccessfulJobList

          public List<ControlledJob> getSuccessfulJobList()

      Returns:
        the jobs in the success state

    - #### getFailedJobList

          public List<ControlledJob> getFailedJobList()

    - #### addJob

          public String addJob(ControlledJob aJob)

      Add a new controlled job.
      Parameters:
        `aJob` - the new controlled job

    - #### addJob

          public String addJob(Job aJob)

      Add a new job.
      Parameters:
        `aJob` - the new job

    - #### addJobCollection

          public void addJobCollection(Collection<ControlledJob> jobs)

      Add a collection of jobs
      Parameters:
        `jobs` -

    - #### getThreadState

          public JobControl.ThreadState getThreadState()

      Returns:
        the thread state

    - #### stop

          public void stop()

      set the thread state to STOPPING so that the thread will stop when it wakes up.

    - #### suspend

          public void suspend()

      suspend the running thread

    - #### resume

          public void resume()

      resume the suspended thread

    - #### allFinished

          public boolean allFinished()

    - #### run

          public void run()

      The main loop for the thread. The loop does the following: Check the states of the running jobs Update the states of waiting jobs Submit the jobs in ready state
      Specified by:
        `run` in interface `Runnable`

Copyright © 2008–2022 Apache Software Foundation. All rights reserved.