You can get hold of the JobConf reference and get the no. of map tasks via JobConf.getNumMapTasks()
With the stable API, this ref will come in automatically by @Override-ing configure(JobConf conf) method. With the new API, implement the Configurable interface in your custom Partitioner class and it will get you a Configuration reference via getConf() [Settable via setConf(Configuration conf)]. The property you need is "mapred.map.tasks". Inside a job, "mapred.map.tasks" is guaranteed to be the exact number of mappers scheduled to run (not attempt count, just task count as you need it). -- Harsh J www.harshj.com