org.apache.hadoop.mapreduce
Class JobID

java.lang.Object
  extended by org.apache.hadoop.mapreduce.ID
      extended by org.apache.hadoop.mapred.ID
          extended by org.apache.hadoop.mapreduce.JobID
All Implemented Interfaces:
Comparable<ID>, Writable, WritableComparable<ID>
Direct Known Subclasses:
JobID

@InterfaceAudience.Public
@InterfaceStability.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
protected static NumberFormat idFormat
           
static String JOB
           
static String JOBID_REGEX
           
 
Fields inherited from class org.apache.hadoop.mapreduce.ID
id, SEPARATOR
 
Constructor Summary
JobID()
           
JobID(String jtIdentifier, int id)
          Constructs a JobID object
 
Method Summary
 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 Detail

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 Detail

JobID

public JobID(String jtIdentifier,
             int id)
Constructs a JobID object

Parameters:
jtIdentifier - jobTracker identifier
id - job number

JobID

public JobID()
Method Detail

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

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

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


Copyright © 2014 Apache Software Foundation. All Rights Reserved.