JobID (Apache Hadoop Main 3.5.0 API)
Description: declaration: package: org.apache.hadoop.mapreduce, class: JobID

Package org.apache.hadoop.mapreduce

# Class JobID

java.lang.Object
org.apache.hadoop.mapreduce.ID
org.apache.hadoop.mapred.ID
org.apache.hadoop.mapreduce.JobID

All Implemented Interfaces:
  `Comparable<ID>`, `Writable`, `WritableComparable<ID>`

Direct Known Subclasses:
  `JobID`

@Public @Stable public class JobID extends ID implements Comparable<ID>
JobID represents the immutable and unique identifier for the job. JobID consists of two parts. First part represents the jobtracker identifier, so that jobID to jobtracker map is defined. For cluster setup this string is the jobtracker start time, for local setting, it is "local" and a random number. Second part of the JobID is the job number.
An example JobID is : `job_200707121733_0003` , which represents the third job running at the jobtracker started at `200707121733`.

Applications should never construct or parse JobID strings, but rather use appropriate constructors or `forName(String)` method.

See Also:
  - `TaskID`
  - `TaskAttemptID`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected static final NumberFormat`
  `idFormat`
  `static final String`
  `JOB`
  `static final String`
  `JOBID_REGEX`

  ### Fields inherited from class org.apache.hadoop.mapreduce.ID

  `id, SEPARATOR`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `JobID()`
  `JobID(String jtIdentifier, int id)`
  Constructs a JobID object

- ## Method Summary

  Modifier and Type
  Method
  Description
  `StringBuilder`
  `appendTo(StringBuilder builder)`
  Add the stuff after the "job" prefix to the given builder.
  `int`
  `compareTo(ID o)`
  Compare JobIds by first jtIdentifiers, then by job numbers
  `boolean`
  `equals(Object o)`
  `static JobID`
  `forName(String str)`
  Construct a JobId object from given string
  `String`
  `getJtIdentifier()`
  `int`
  `hashCode()`
  `void`
  `readFields(DataInput in)`
  Deserialize the fields of this object from `in`.
  `String`
  `toString()`
  `void`
  `write(DataOutput out)`
  Serialize the fields of this object to `out`.

  ### Methods inherited from class org.apache.hadoop.mapreduce.ID

  `getId`

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

  `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- ## Field Details

  - ### JOB

    public static final String JOB
    See Also:
      - Constant Field Values

  - ### JOBID_REGEX

    public static final String JOBID_REGEX
    See Also:
      - Constant Field Values

  - ### idFormat

    protected static final NumberFormat idFormat

- ## Constructor Details

  - ### JobID

    public JobID(String jtIdentifier, int id)
    Constructs a JobID object
    Parameters:
      `jtIdentifier` - jobTracker identifier
      `id` - job number

  - ### JobID

    public JobID()

- ## Method Details

  - ### getJtIdentifier

    public String getJtIdentifier()

  - ### equals

    public boolean equals(Object o)
    Overrides:
      `equals` in class `ID`

  - ### compareTo

    public int compareTo(ID o)
    Compare JobIds by first jtIdentifiers, then by job numbers
    Specified by:
      `compareTo` in interface `Comparable<ID>`
    Overrides:
      `compareTo` in class `ID`

  - ### appendTo

    public StringBuilder appendTo(StringBuilder builder)
    Add the stuff after the "job" prefix to the given builder. This is useful, because the sub-ids use this substring at the start of their string.
    Parameters:
      `builder` - the builder to append to
    Returns:
      the builder that was passed in

  - ### hashCode

    public int hashCode()
    Overrides:
      `hashCode` in class `ID`

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `ID`

  - ### readFields

    public void readFields(DataInput in) throws IOException
    Description copied from interface: `Writable`
    Deserialize the fields of this object from `in`.

    For efficiency, implementations should attempt to re-use storage in the existing object where possible.

    Specified by:
      `readFields` in interface `Writable`
    Overrides:
      `readFields` in class `ID`
    Parameters:
      `in` - `DataInput` to deseriablize this object from.
    Throws:
      `IOException` - any other problem for readFields.

  - ### write

    public void write(DataOutput out) throws IOException
    Description copied from interface: `Writable`
    Serialize the fields of this object to `out`.
    Specified by:
      `write` in interface `Writable`
    Overrides:
      `write` in class `ID`
    Parameters:
      `out` - `DataOuput` to serialize this object into.
    Throws:
      `IOException` - any other problem for write.

  - ### forName

    public static JobID forName(String str) throws IllegalArgumentException
    Construct a JobId object from given string
    Returns:
      constructed JobId object or null if the given String is null
    Throws:
      `IllegalArgumentException` - if the given string is malformed