hadoop-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marcos Ortiz <mlor...@uci.cu>
Subject Re: How i can test a Job finished and sucess in java
Date Fri, 04 Mar 2011 15:42:43 GMT
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)



Mime
View raw message