Package org.apache.hadoop.mapreduce
Class TaskAttemptID
java.lang.Object
org.apache.hadoop.mapreduce.ID
org.apache.hadoop.mapred.ID
org.apache.hadoop.mapreduce.TaskAttemptID
- All Implemented Interfaces:
Comparable<ID>,Writable,WritableComparable<ID>
- Direct Known Subclasses:
TaskAttemptID
TaskAttemptID represents the immutable and unique identifier for
a task attempt. Each task attempt is one particular instance of a Map or
Reduce Task identified by its TaskID.
TaskAttemptID consists of 2 parts. First part is the
An example TaskAttemptID is :
TaskID, that this TaskAttemptID belongs to.
Second part is the task attempt number. An example TaskAttemptID is :
attempt_200707121733_0003_m_000005_0 , which represents the
zeroth task attempt for the fifth map task in the third job
running at the jobtracker started at 200707121733.
Applications should never construct or parse TaskAttemptID strings
, but rather use appropriate constructors or forName(String)
method.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionTaskAttemptID(String jtIdentifier, int jobId, boolean isMap, int taskId, int id) Deprecated.TaskAttemptID(String jtIdentifier, int jobId, TaskType type, int taskId, int id) Constructs a TaskId object from given parts.TaskAttemptID(TaskID taskId, int id) Constructs a TaskAttemptID object from givenTaskID. -
Method Summary
Modifier and TypeMethodDescriptionprotected StringBuilderappendTo(StringBuilder builder) Add the unique string to the StringBuilderintCompare TaskIds by first tipIds, then by task numbers.booleanstatic TaskAttemptIDConstruct a TaskAttemptID object from given stringgetJobID()Returns theJobIDobject that this task attempt belongs toReturns theTaskIDobject that this task attempt belongs toReturns the TaskType of the TaskAttemptIDinthashCode()booleanisMap()Deprecated.voidreadFields(DataInput in) Deserialize the fields of this object fromin.toString()voidwrite(DataOutput out) Serialize the fields of this object toout.
-
Field Details
-
ATTEMPT
- See Also:
-
-
Constructor Details
-
TaskAttemptID
Constructs a TaskAttemptID object from givenTaskID.- Parameters:
taskId- TaskID that this task belongs toid- the task attempt number
-
TaskAttemptID
Constructs a TaskId object from given parts.- Parameters:
jtIdentifier- jobTracker identifierjobId- job numbertype- the TaskTypetaskId- taskId numberid- the task attempt number
-
TaskAttemptID
Deprecated.Constructs a TaskId object from given parts.- Parameters:
jtIdentifier- jobTracker identifierjobId- job numberisMap- whether the tip is a maptaskId- taskId numberid- the task attempt number
-
TaskAttemptID
public TaskAttemptID()
-
-
Method Details
-
getJobID
Returns theJobIDobject that this task attempt belongs to -
getTaskID
Returns theTaskIDobject that this task attempt belongs to -
isMap
Deprecated.Returns whether this TaskID is a map ID -
getTaskType
Returns the TaskType of the TaskAttemptID -
equals
-
appendTo
Add the unique string to the StringBuilder- Parameters:
builder- the builder to append ot- Returns:
- the builder that was passed in.
-
readFields
Description copied from interface:WritableDeserialize the fields of this object fromin.For efficiency, implementations should attempt to re-use storage in the existing object where possible.
- Specified by:
readFieldsin interfaceWritable- Overrides:
readFieldsin classID- Parameters:
in-DataInputto deseriablize this object from.- Throws:
IOException- any other problem for readFields.
-
write
Description copied from interface:WritableSerialize the fields of this object toout.- Specified by:
writein interfaceWritable- Overrides:
writein classID- Parameters:
out-DataOuputto serialize this object into.- Throws:
IOException- any other problem for write.
-
hashCode
public int hashCode() -
compareTo
Compare TaskIds by first tipIds, then by task numbers.- Specified by:
compareToin interfaceComparable<ID>- Overrides:
compareToin classID
-
toString
-
forName
Construct a TaskAttemptID object from given string- Returns:
- constructed TaskAttemptID object or null if the given String is null
- Throws:
IllegalArgumentException- if the given string is malformed
-