Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Plain View
Hadoop >> mail # general >> How i can test a Job finished and sucess in java


+
Alessandro Binhara 2011-03-04, 12:59
+
Harsh J 2011-03-04, 13:49
Copy link to this message
-
Re: How i can test a Job finished and sucess in java
El 3/4/2011 7:59 AM, Alessandro Binhara escribi�:
> hello all ..
>
> i writte mapreduce in java . It works very well.
> How i know  a Job finished and sucess in java ?
>
>
>   JobConf conf = new JobConf(AverageJob.class);
>      conf.setJobName("AverageProductTime");
>
>      FileInputFormat.addInputPath(conf, new Path(inputDir));
>      FileOutputFormat.setOutputPath(conf, new Path(outputDir));
>
>      conf.setMapperClass(MapAverage.class);
>      conf.setReducerClass(RedAverage.class);
>        conf.setOutputKeyClass(Text.class);
>        conf.setOutputValueClass(IntWritable.class);
>
>      JobClient.runJob(conf);
>
>
>      if (JobClient.SUCCESS == 0)
>      {
>                  ... do someting ...
>      }
>
> ????
>
> Thanks
>
>    
Regards, Alessandro.
I 'm going to use a example of the Pro Hadoop's book. On Chapter 2,
Jason Venner explains the different ways to see the success of a certain
job. The RunningJobs class has the right methods to do this. For example:
  logger.info("Launching the job...");
/** Send the job configuration to the framework
* and request that the job be run.
*/
final RunningJob job = JobClient.runJob(conf);
logger.info("The job has completed.");

Jason says that one of the more useful methods is job.isSuccessful(). I
recommend to you that you look on the Hadoop MapReduce API for this
class.(RunningJob)