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 5E58EF91D for ; Wed, 24 Apr 2013 13:52:29 +0000 (UTC) Received: (qmail 37186 invoked by uid 500); 24 Apr 2013 13:52:24 -0000 Delivered-To: apmail-hadoop-mapreduce-user-archive@hadoop.apache.org Received: (qmail 36453 invoked by uid 500); 24 Apr 2013 13:52:21 -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 36424 invoked by uid 99); 24 Apr 2013 13:52:20 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 24 Apr 2013 13:52:20 +0000 X-ASF-Spam-Status: No, hits=2.5 required=5.0 tests=FREEMAIL_ENVFROM_END_DIGIT,HTML_MESSAGE,MIME_QP_LONG_LINE,RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of yypvsxf19870706@gmail.com designates 209.85.192.170 as permitted sender) Received: from [209.85.192.170] (HELO mail-pd0-f170.google.com) (209.85.192.170) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 24 Apr 2013 13:52:12 +0000 Received: by mail-pd0-f170.google.com with SMTP id 10so1145238pdi.1 for ; Wed, 24 Apr 2013 06:51:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:subject:references:from:content-type:x-mailer :in-reply-to:message-id:date:to:content-transfer-encoding :mime-version; bh=Y6N2U3bmIJcM7ihbGiA1Qh5XE/SZFWVKeFIzuBRCk04=; b=SpaZDJnqzCclRTJUBjO2+ibvlzBNJ7tXu4mzMl8YiT3vFXZ7C3MVXVB+tHvSZ51ldJ utvDF8j7Qsv/R7dWb1w77g9v9ezfTK1qXz0Xh/tvcSi0867MofPaEYFT7e2qZE5l1vZ6 YnmPgxTh17aU5bYQLFMYzsRvDVmRLtfRwVhk9aSRkvy1mRwsmiEUVdOt7cbqYDvQplJH yLz+MBnDlR8u0ASlZO/PvGNopY6I6Q/ePrPvyefzFvrSgN8UA1xBxvnVNG53rzszTniF jdXepYcIHcMWnWqx+8S/nEiWLq/Ni0PwyICI001aplUeqob5WhTRAjkUrwkg+NMZT1jS X2vw== X-Received: by 10.66.19.201 with SMTP id h9mr19378612pae.188.1366811511672; Wed, 24 Apr 2013 06:51:51 -0700 (PDT) Received: from [10.11.79.152] ([122.96.47.69]) by mx.google.com with ESMTPSA id be7sm3719211pad.20.2013.04.24.06.51.47 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 24 Apr 2013 06:51:50 -0700 (PDT) Subject: Re: Multiple ways to write Hadoop program driver - Which one to choose? References: From: yypvsxf19870706 Content-Type: multipart/alternative; boundary=Apple-Mail-A1F36269-6EE6-4737-AE25-26AC48787D7F X-Mailer: iPhone Mail (10B146) In-Reply-To: Message-Id: <07D57D94-4DBA-43DB-9720-4BE5968A347A@gmail.com> Date: Wed, 24 Apr 2013 21:50:11 +0800 To: "user@hadoop.apache.org" Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (1.0) X-Virus-Checked: Checked by ClamAV on apache.org --Apple-Mail-A1F36269-6EE6-4737-AE25-26AC48787D7F Content-Type: text/plain; charset=GB2312 Content-Transfer-Encoding: quoted-printable Hi sheikhar The deprecated job constructor is actually deprecated according to the jo= b source code .=20 There is another constructor witch is not deprecated ,you can find in the= hint raised by eclipse . =20 =B7=A2=D7=D4=CE=D2=B5=C4 iPhone =D4=DA 2013-4-24=A3=AC13:53=A3=ACChandrashekhar Kotekar =D0=B4=B5=C0=A3=BA > Hi, >=20 >=20 > I have observed that there are multiple ways to write driver method of Had= oop program. >=20 > Following method is given in Hadoop Tutorial by Yahoo >=20 >=20 > public void run(String inputPath, String outputPath) throws Exception { > JobConf conf =3D new JobConf(WordCount.class); > conf.setJobName("wordcount"); >=20 > // the keys are words (strings) > conf.setOutputKeyClass(Text.class); > // the values are counts (ints) > conf.setOutputValueClass(IntWritable.class); >=20 > conf.setMapperClass(MapClass.class); > conf.setReducerClass(Reduce.class); >=20 > FileInputFormat.addInputPath(conf, new Path(inputPath)); > FileOutputFormat.setOutputPath(conf, new Path(outputPath)); >=20 > JobClient.runJob(conf); > } > and this method is given in Hadoop The Definitive Guide 2012 book by Oreil= ly. >=20 >=20 > public static void main(String[] args) throws Exception { > if (args.length !=3D 2) { > System.err.println("Usage: MaxTemperature ")= ; > 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 Jo= b class are deprecated. As Oreilly book is based on Hadoop 2 (yarn) I was su= rprised to see that they have used deprecated class. >=20 > I would like to know which method everyone uses? >=20 >=20 >=20 >=20 >=20 >=20 >=20 >=20 > Regards, > Chandrash3khar K0tekar > Mobile - 8884631122 >=20 --Apple-Mail-A1F36269-6EE6-4737-AE25-26AC48787D7F Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
Hi sheikhar

&= nbsp;  The deprecated job constructor is actually deprecated according t= o the job source code . 
   There is another constr= uctor witch is not deprecated ,you can find in the hint raised by eclipse .<= /div>

  




=E5=8F=91=E8=87=AA=E6=88=91=E7=9A=84 iPhone
<= br>=E5=9C=A8 2013-4-24=EF=BC=8C13:53=EF=BC=8CChandrashekhar Kotekar <shekhar.kotekar@gmail.com> =E5= =86=99=E9=81=93=EF=BC=9A

Hi,


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

Following method is given in Hadoop Tutorial by Yahoo

 public v=
oid 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 Hadoop The Def= initive Guide 2012 book by Oreilly.

public st=
atic void main(String[] args) throws Exception {
  if (args.length !=3D 2) {
    System.err.println("Usage: MaxTemperature <input path> <output p=
ath>");
    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 = ;Job class are deprecated. As Oreil= ly book is based on Hadoop 2 (yarn) I was surprised to see that they have us= ed deprecated class.

I would like to know which method everyone uses?







<= div>

= --Apple-Mail-A1F36269-6EE6-4737-AE25-26AC48787D7F--