giulio
giulio

Reputation: 659

Getting job configuration in hadoop

I wrote some mapreduce code using the mapred import instead of mapreduce (I followed the example of WordCount for hadoop 1) I need to get some parameters that I saved in the job configuration. I read about configuration get when using mapreduce, but I did all my development using mapred and these two imports are conflicting. Is there a way to get the job configuration in the mapper using mapred?

Upvotes: 0

Views: 749

Answers (1)

Jeremy Beard
Jeremy Beard

Reputation: 2725

From the Mapper Javadoc:

Mapper implementations can access the JobConf for the job via the JobConfigurable.configure(JobConf) and initialize themselves.

And as JobConf extends Configuration you can access all the properties from the.

To make this accessible to your map() calls you could create a JobConf variable in your class and set it in your configure() so that when your map() calls run you can access it from there.

Upvotes: 1

Related Questions