@InterfaceAudience.Public @InterfaceStability.Stable public class TaskID extends ID
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. 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.
JobID
,
TaskAttemptID
Modifier and Type | Field and Description |
---|---|
protected static NumberFormat |
idFormat |
protected static String |
TASK |
static String |
TASK_ID_REGEX |
static Pattern |
taskIdPattern |
Constructor and Description |
---|
TaskID()
Default constructor for Writable.
|
TaskID(JobID jobId,
boolean isMap,
int id)
Deprecated.
|
TaskID(JobID jobId,
TaskType type,
int id)
Constructs a TaskID object from given
JobID . |
TaskID(String jtIdentifier,
int jobId,
boolean isMap,
int id)
Deprecated.
|
TaskID(String jtIdentifier,
int jobId,
TaskType type,
int id)
Constructs a TaskInProgressId object from given parts.
|
Modifier and Type | Method and Description |
---|---|
protected StringBuilder |
appendTo(StringBuilder builder)
Add the unique string to the given builder.
|
int |
compareTo(ID o)
Compare TaskInProgressIds by first jobIds, then by tip numbers.
|
boolean |
equals(Object o) |
static TaskID |
forName(String str)
Construct a TaskID object from given string.
|
static String |
getAllTaskTypes()
Returns a string of characters describing all possible
TaskType
values |
JobID |
getJobID()
Returns the
JobID object that this tip belongs to. |
static char |
getRepresentingCharacter(TaskType type)
Gets the character representing the
TaskType . |
TaskType |
getTaskType()
Get the type of the task.
|
static TaskType |
getTaskType(char c)
Gets the
TaskType corresponding to the character. |
int |
hashCode() |
boolean |
isMap()
Deprecated.
|
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 . |
protected static final String TASK
protected static final NumberFormat idFormat
public static final String TASK_ID_REGEX
public static final Pattern taskIdPattern
public TaskID(JobID jobId, TaskType type, int id)
JobID
.jobId
- JobID that this tip belongs totype
- the TaskType
of the taskid
- the tip numberpublic TaskID(String jtIdentifier, int jobId, TaskType type, int id)
jtIdentifier
- jobTracker identifierjobId
- job numbertype
- the TaskTypeid
- the tip number@Deprecated public TaskID(JobID jobId, boolean isMap, int id)
JobID
.jobId
- JobID that this tip belongs toisMap
- whether the tip is a mapid
- the tip number@Deprecated public TaskID(String jtIdentifier, int jobId, boolean isMap, int id)
jtIdentifier
- jobTracker identifierjobId
- job numberisMap
- whether the tip is a mapid
- the tip numberpublic TaskID()
TaskType.REDUCE
, the ID to 0, and the job ID to an empty job ID.public JobID getJobID()
JobID
object that this tip belongs to.@Deprecated public boolean isMap()
public TaskType getTaskType()
public int compareTo(ID o)
compareTo
in interface Comparable<ID>
compareTo
in class ID
o
- the TaskID against which to compareprotected StringBuilder appendTo(StringBuilder builder)
builder
- the builder to append topublic void readFields(DataInput in) throws IOException
Writable
in
.
For efficiency, implementations should attempt to re-use storage in the existing object where possible.
readFields
in interface Writable
readFields
in class ID
in
- DataInput
to deseriablize this object from.IOException
public void write(DataOutput out) throws IOException
Writable
out
.write
in interface Writable
write
in class ID
out
- DataOuput
to serialize this object into.IOException
public static TaskID forName(String str) throws IllegalArgumentException
str
- the target stringIllegalArgumentException
- if the given string is malformedpublic static char getRepresentingCharacter(TaskType type)
TaskType
.type
- the TaskTypepublic static TaskType getTaskType(char c)
TaskType
corresponding to the character.c
- the characterCopyright © 2021 Apache Software Foundation. All rights reserved.