Return-Path: X-Original-To: apmail-hadoop-mapreduce-user-archive@minotaur.apache.org Delivered-To: apmail-hadoop-mapreduce-user-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A197FF231 for ; Wed, 24 Apr 2013 05:54:24 +0000 (UTC) Received: (qmail 23310 invoked by uid 500); 24 Apr 2013 05:54:14 -0000 Delivered-To: apmail-hadoop-mapreduce-user-archive@hadoop.apache.org Received: (qmail 22829 invoked by uid 500); 24 Apr 2013 05:54:13 -0000 Mailing-List: contact user-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@hadoop.apache.org Delivered-To: mailing list user@hadoop.apache.org Received: (qmail 22742 invoked by uid 99); 24 Apr 2013 05:54:09 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 24 Apr 2013 05:54:09 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of shekhar.kotekar@gmail.com designates 209.85.217.175 as permitted sender) Received: from [209.85.217.175] (HELO mail-lb0-f175.google.com) (209.85.217.175) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 24 Apr 2013 05:54:04 +0000 Received: by mail-lb0-f175.google.com with SMTP id w20so488053lbh.6 for ; Tue, 23 Apr 2013 22:53:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:mime-version:in-reply-to:references:from:date:message-id :subject:to:content-type; bh=OcRxxqNBW1Lyxt9Bgr5QXRjXZ6WgqeeXwwkL4M0zXVo=; b=BI/l6QoEzE7KMwprVaAEjTn0ULrXGv9UYGm3ecYPX6NrN0aUUMJ9Vhx+gMlzDeYrDc VD6G0Wcpb0unIcRGT3f2DlKW3pTAoauLp67om3+S4VtkD7E+ZV6qL8SmuhEDbLYrQDXn fLgcvcO7w7hEQbq3lrnUV0CGijXyHNyJLG8UlQU61l+eHGHTvsArCXgTNqWXovBGVpeS 2pbsmvMYvLdR5launMtmvON9jlsCqL+eMQRAkVQ2s0o0h1ktar4zt6xLitrf9xR9KwOd wFXkNE/2/snGwIJ1y3u/x4dvJsDwhV0t+51uXOvRoE8mjufS95xabbEYuPhh/Q2VM8Sm I/Mw== X-Received: by 10.112.132.129 with SMTP id ou1mr6592926lbb.13.1366782822877; Tue, 23 Apr 2013 22:53:42 -0700 (PDT) MIME-Version: 1.0 Received: by 10.112.71.12 with HTTP; Tue, 23 Apr 2013 22:53:22 -0700 (PDT) In-Reply-To: References: From: Chandrashekhar Kotekar Date: Wed, 24 Apr 2013 11:23:22 +0530 Message-ID: Subject: Fwd: Multiple ways to write Hadoop program driver - Which one to choose? To: user@hadoop.apache.org Content-Type: multipart/alternative; boundary=047d7b3a821ca4924404db14ec96 X-Virus-Checked: Checked by ClamAV on apache.org --047d7b3a821ca4924404db14ec96 Content-Type: text/plain; charset=ISO-8859-1 Hi, I have observed that there are multiple ways to write driver method of Hadoop program. Following method is given in Hadoop Tutorial by Yahoo public void run(String inputPath, String outputPath) throws Exception { JobConf conf = new JobConf(WordCount.class); conf.setJobName("wordcount"); // the keys are words (strings) conf.setOutputKeyClass(Text.class); // the values are counts (ints) conf.setOutputValueClass(IntWritable.class); conf.setMapperClass(MapClass.class); conf.setReducerClass(Reduce.class); FileInputFormat.addInputPath(conf, new Path(inputPath)); FileOutputFormat.setOutputPath(conf, new Path(outputPath)); JobClient.runJob(conf); } and this method is given in Hadoop The Definitive Guide 2012 book by Oreilly. public static void main(String[] args) throws Exception { if (args.length != 2) { System.err.println("Usage: MaxTemperature "); System.exit(-1); } Job job = new Job(); job.setJarByClass(MaxTemperature.class); job.setJobName("Max temperature"); FileInputFormat.addInputPath(job, new Path(args[0])); FileOutputFormat.setOutputPath(job, new Path(args[1])); job.setMapperClass(MaxTemperatureMapper.class); job.setReducerClass(MaxTemperatureReducer.class); job.setOutputKeyClass(Text.class); job.setOutputValueClass(IntWritable.class); System.exit(job.waitForCompletion(true) ? 0 : 1); } While trying program given in Oreilly book I found that constructors of Job class are deprecated. As Oreilly book is based on Hadoop 2 (yarn) I was surprised to see that they have used deprecated class. I would like to know which method everyone uses? Regards, Chandrash3khar K0tekar Mobile - 8884631122 --047d7b3a821ca4924404db14ec96 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Hi,


I have observed that there are multiple ways to write driver method of Hado= op program.

Following method is given in=A0Hadoop Tutorial by Yahoo


 public void run(String inputPath, String=
 outputPath) throws Exception {
    JobConf conf =3D new JobConf(WordCount.class);
    conf.setJobName("wordcount");

    // the keys are words (strings)
    conf.setOutputKeyClass(Text.class);
    // the values are counts (ints)
    conf.setOutputValueClass(IntWritable.class);

    conf.setMapperClass(MapClass.class);
    conf.setReducerClass(Reduce.class);

    FileInputFormat.addInputPath(conf, new Path(inputPath));
    FileOutputFormat.setOutputPath(conf, new Path(outputPath));

    JobClient.runJob(conf);
  }

and this method is given in=A0Hadoop The Definitive Guide 2012=A0book b= y Oreilly.


public static void main(String[] args) th=
rows Exception {
  if (args.length !=3D 2) {
    System.err.println("Usage: MaxTemperature <input path> <o=
utput path>");
    System.exit(-1);
  }
  Job job =3D new Job();
  job.setJarByClass(MaxTemperature.class);
  job.setJobName("Max temperature");
  FileInputFormat.addInputPath(job, new Path(args[0]));
  FileOutputFormat.setOutputPath(job, new Path(args[1]));
  job.setMapperClass(MaxTemperatureMapper.class);
  job.setReducerClass(MaxTemperatureReducer.class);
  job.setOutputKeyClass(Text.class);
  job.setOutputValueClass(IntWritable.class);
  System.exit(job.waitForCompletion(true) ? 0 : 1);
}

While trying program given in Oreilly book I found that constructors of=A0<= code style=3D"margin:0px;padding:1px 5px;border:0px;vertical-align:baseline= ;background-color:rgb(238,238,238);font-family:Consolas,Menlo,Monaco,'L= ucida Console','Liberation Mono','DejaVu Sans Mono',= 9;Bitstream Vera Sans Mono','Courier New',monospace,serif">Job<= /code>=A0class are deprecated. As Oreilly book is based on Hadoop 2 (yarn) = I was surprised to see that they have used deprecated class.

I would like to know which method everyone uses?








--047d7b3a821ca4924404db14ec96--