How to get the name of input file in MRjob How to get the name of input file in MRjob hadoop hadoop

How to get the name of input file in MRjob


map.input.file property will give the input file name.

According to the Hadoop - The Definitive Guide

The properties can be accessed from the job’s configuration, obtained in the old MapReduce API by providing an implementation of the configure() method for Mapper or Reducer, where the configuration is passed in as an argument. In the new API, these properties can be accessed from the context object passed to all methods of the Mapper or Reducer.


If you are using HADOOP 2.x with Python:

file_name = os.environ['mapreduce_map_input_file']