Home | About | Sematext search-lucene.com search-hadoop.com
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB
 Search Hadoop and all its subprojects:

Switch to Threaded View
HDFS >> mail # user >> Re: TaskID


Hi Bharati,

Your mapper class implementation methods have access to a MapContext:

http://hadoop.apache.org/docs/current/api/org/apache/hadoop/mapreduce/MapContext.html

This is a subclass of TaskAttemptContext:

http://hadoop.apache.org/docs/current/api/org/apache/hadoop/mapreduce/TaskAttemptContext.html

You can use the TaskAttemptContext to call getTaskAttemptId and retrieve a
TaskAttemptID object:

http://hadoop.apache.org/docs/current/api/org/apache/hadoop/mapreduce/TaskAttemptID.html

A task attempt ID consists of the task ID + an attempt number.  Note that
task ID alone is not guaranteed to be unique across execution of the whole
job.  Due to speculative execution or transient task failures, multiple
attempts of the same task can run, and they'll all have the same task ID.
 The task ID + attempt number is guaranteed to be unique within the job.

BTW, it's pretty much the same process for a reducer too, except you're
working with a ReduceContext instead of a MapContext.

Hope this helps,
--Chris

On Thu, Apr 25, 2013 at 8:45 AM, Bharati <[EMAIL PROTECTED]>wrote:

> Hi Folks,
>
> I need to find the task ID of the map task.
> Please send me any ideas or suggestions.
>
> Thanks,
> Bharati
>
> Sent from my iPad
>
> Fortigate Filtered
>
>
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB