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

Package org.apache.hadoop.mapred

# Class TaskID

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

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

@Public @Stable public class TaskID extends TaskID
TaskID represents the immutable and unique identifier for a Map or Reduce Task. Each TaskID encompasses multiple attempts made to execute the Map or Reduce Task, each of which are uniquely indentified by their TaskAttemptID. TaskID consists of 3 parts. First part is the `JobID`, that this TaskInProgress belongs to. Second part of the TaskID is either 'm' or 'r' representing whether the task is a map task or a reduce task. And the third part is the task number.
An example TaskID is : `task_200707121733_0003_m_000005` , which represents the fifth map task in the third job running at the jobtracker started at `200707121733`.

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

See Also:
  - `JobID`
  - `TaskAttemptID`

- ## Field Summary

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

  `idFormat, TASK, TASK_ID_REGEX, taskIdPattern`

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

  `id, SEPARATOR`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `TaskID()`
  `TaskID(String jtIdentifier, int jobId, boolean isMap, int id)`
  Deprecated.
  Use `TaskID(org.apache.hadoop.mapreduce.JobID, TaskType, int)`
  `TaskID(String jtIdentifier, int jobId, TaskType type, int id)`
  Constructs a TaskInProgressId object from given parts.
  `TaskID(JobID jobId, boolean isMap, int id)`
  Deprecated.
  Use `TaskID(String, int, TaskType, int)`
  `TaskID(JobID jobId, TaskType type, int id)`
  Constructs a TaskID object from given `JobID`.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static TaskID`
  `downgrade(TaskID old)`
  Downgrade a new TaskID to an old one
  `static TaskID`
  `forName(String str)`
  `JobID`
  `getJobID()`
  Returns the `JobID` object that this tip belongs to.
  `static String`
  `getTaskIDsPattern(String jtIdentifier, Integer jobId, Boolean isMap, Integer taskId)`
  Deprecated.
  Use `getTaskIDsPattern(String, Integer, TaskType, Integer)`
  `static String`
  `getTaskIDsPattern(String jtIdentifier, Integer jobId, TaskType type, Integer taskId)`
  Deprecated.
  `static TaskID`
  `read(DataInput in)`
  Deprecated.

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

  `appendTo, compareTo, equals, getAllTaskTypes, getRepresentingCharacter, getTaskType, getTaskType, hashCode, isMap, readFields, toString, write`

  ### 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`

- ## Constructor Details

  - ### TaskID

    @Deprecated public TaskID(JobID jobId, boolean isMap, int id)
    Deprecated.
    Use `TaskID(String, int, TaskType, int)`
    Constructs a TaskID object from given `JobID`.
    Parameters:
      `jobId` - JobID that this tip belongs to
      `isMap` - whether the tip is a map
      `id` - the tip number

  - ### TaskID

    @Deprecated public TaskID(String jtIdentifier, int jobId, boolean isMap, int id)
    Deprecated.
    Use `TaskID(org.apache.hadoop.mapreduce.JobID, TaskType, int)`
    Constructs a TaskInProgressId object from given parts.
    Parameters:
      `jtIdentifier` - jobTracker identifier
      `jobId` - job number
      `isMap` - whether the tip is a map
      `id` - the tip number

  - ### TaskID

    public TaskID(JobID jobId, TaskType type, int id)
    Constructs a TaskID object from given `JobID`.
    Parameters:
      `jobId` - JobID that this tip belongs to
      `type` - the `TaskType`
      `id` - the tip number

  - ### TaskID

    public TaskID(String jtIdentifier, int jobId, TaskType type, int id)
    Constructs a TaskInProgressId object from given parts.
    Parameters:
      `jtIdentifier` - jobTracker identifier
      `jobId` - job number
      `type` - the `TaskType`
      `id` - the tip number

  - ### TaskID

    public TaskID()

- ## Method Details

  - ### downgrade

    public static TaskID downgrade(TaskID old)
    Downgrade a new TaskID to an old one
    Parameters:
      `old` - a new or old TaskID
    Returns:
      either old or a new TaskID build to match old

  - ### read

    @Deprecated public static TaskID read(DataInput in) throws IOException
    Deprecated.
    Throws:
      `IOException`

  - ### getJobID

    public JobID getJobID()
    Description copied from class: `TaskID`
    Returns the `JobID` object that this tip belongs to.
    Overrides:
      `getJobID` in class `TaskID`
    Returns:
      the JobID object

  - ### getTaskIDsPattern

    @Deprecated public static String getTaskIDsPattern(String jtIdentifier, Integer jobId, Boolean isMap, Integer taskId)
    Deprecated.
    Use `getTaskIDsPattern(String, Integer, TaskType, Integer)`
    Returns a regex pattern which matches task IDs. Arguments can be given null, in which case that part of the regex will be generic. For example to obtain a regex matching the first map task of any jobtracker, of any job, we would use :

         TaskID.getTaskIDsPattern(null, null, true, 1);

    which will return :

         "task_[^_]*_[0-9]*_m_000001*"

    Parameters:
      `jtIdentifier` - jobTracker identifier, or null
      `jobId` - job number, or null
      `isMap` - whether the tip is a map, or null
      `taskId` - taskId number, or null
    Returns:
      a regex pattern matching TaskIDs

  - ### getTaskIDsPattern

    @Deprecated public static String getTaskIDsPattern(String jtIdentifier, Integer jobId, TaskType type, Integer taskId)
    Deprecated.
    Returns a regex pattern which matches task IDs. Arguments can be given null, in which case that part of the regex will be generic. For example to obtain a regex matching the first map task of any jobtracker, of any job, we would use :

         TaskID.getTaskIDsPattern(null, null, true, 1);

    which will return :

         "task_[^_]*_[0-9]*_m_000001*"

    Parameters:
      `jtIdentifier` - jobTracker identifier, or null
      `jobId` - job number, or null
      `type` - the `TaskType`, or null
      `taskId` - taskId number, or null
    Returns:
      a regex pattern matching TaskIDs

  - ### forName

    public static TaskID forName(String str) throws IllegalArgumentException
    Throws:
      `IllegalArgumentException`