0

I have written cascade flow which executes MapReduce flow containg both Mapper and Reducer. In reduce() method, it throwsIllegalArgumentException. How to handle this exception ? I have written catch block in class where I created JobConf for the same and added it into MapReduceFlow constructor.

Santhosh
  • 28,097
  • 9
  • 82
  • 87
user2664210
  • 145
  • 2
  • 13

1 Answers1

0

In your Cascading job, you can use failure traps to do this. From the example on the link, it's something like:

flowDef.addTrap( "assertions", trap );
Paul Sanwald
  • 10,899
  • 6
  • 44
  • 59
  • Thanks for the reply. Is this API available for Cascading 1.2 version ? I am using Flow API to create cascade flow and MapReduceFlow API to run this mapreduce job as cascade flow. – user2664210 Sep 03 '13 at 07:27
  • can anyone tell me how to resolve this issue ? I am using cascading 1.2 . Is FlowDef api available in 1.2?? if not then what is alternative solution ? – user2664210 Sep 03 '13 at 12:37
  • http://docs.cascading.org/cascading/1.2/javadoc/cascading/flow/Flow.html#setTraps(java.util.Map) – Paul Sanwald Sep 03 '13 at 17:02
  • could you please provide sample code showing how to use setTraps?I have a method say buildFlow() return type is Flow.In this method I have created JobConf & passed to MapReduceFlow(JobConf).I have added Mapper and Reducer.in reduce() method,I'm creating output path.here it gets empty string & throws IllegalArgumentException.whenever this exception is thrown I want to terminate this cascade flow.Whenever this exception occurs the code ran which I have written in onThrowable() method of Custom FlowListener & also wanted to run code written in catch blk.But I am not able to handle this exception. – user2664210 Sep 04 '13 at 05:55
  • I forgot to mention 1 thing that : I have not used any pipe in cascade. Simply added MapReduceFlow in cascade flow. – user2664210 Sep 04 '13 at 13:09
  • I don't have any sample code that does this offhand. it doesn't sound like your job is benefitting from cascading all that much? why not just deal with exceptions in your mapper/reducer? – Paul Sanwald Sep 04 '13 at 21:44
  • actually, there are many sub module which contains cascade flow and having pipe assembly. These modules execute in sequense one after other. Only one module is there which uses mapreduce flow and I have added it in Cascading usingMapReduceJob api. But exception thrown by reduce() method is not being caught in catch blk. – user2664210 Sep 05 '13 at 05:52