From mapreduce-commits-return-3245-apmail-hadoop-mapreduce-commits-archive=hadoop.apache.org@hadoop.apache.org Mon Jan 16 19:40:26 2012 Return-Path: X-Original-To: apmail-hadoop-mapreduce-commits-archive@minotaur.apache.org Delivered-To: apmail-hadoop-mapreduce-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 9EE06B8B6 for ; Mon, 16 Jan 2012 19:40:26 +0000 (UTC) Received: (qmail 45255 invoked by uid 500); 16 Jan 2012 19:40:26 -0000 Delivered-To: apmail-hadoop-mapreduce-commits-archive@hadoop.apache.org Received: (qmail 45232 invoked by uid 500); 16 Jan 2012 19:40:25 -0000 Mailing-List: contact mapreduce-commits-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: mapreduce-dev@hadoop.apache.org Delivered-To: mailing list mapreduce-commits@hadoop.apache.org Received: (qmail 45224 invoked by uid 99); 16 Jan 2012 19:40:25 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 16 Jan 2012 19:40:25 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 16 Jan 2012 19:40:22 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 21C0F23888E7; Mon, 16 Jan 2012 19:40:01 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1232128 - in /hadoop/common/branches/branch-0.23/hadoop-mapreduce-project: CHANGES.txt hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/JobEndNotifier.java Date: Mon, 16 Jan 2012 19:40:00 -0000 To: mapreduce-commits@hadoop.apache.org From: mahadev@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120116194001.21C0F23888E7@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: mahadev Date: Mon Jan 16 19:40:00 2012 New Revision: 1232128 URL: http://svn.apache.org/viewvc?rev=1232128&view=rev Log: MAPREDUCE-3649. Job End notification gives an error on calling back. (Ravi Prakash via mahadev) - Merging r1232126 from trunk. Modified: hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/CHANGES.txt hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/JobEndNotifier.java Modified: hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/CHANGES.txt URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/CHANGES.txt?rev=1232128&r1=1232127&r2=1232128&view=diff ============================================================================== --- hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/CHANGES.txt (original) +++ hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/CHANGES.txt Mon Jan 16 19:40:00 2012 @@ -439,6 +439,9 @@ Release 0.23.1 - Unreleased MAPREDUCE-3664. Federation Documentation has incorrect configuration example. (Brandon Li via jitendra) + MAPREDUCE-3649. Job End notification gives an error on calling back. + (Ravi Prakash via mahadev) + Release 0.23.0 - 2011-11-01 INCOMPATIBLE CHANGES Modified: hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/JobEndNotifier.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/JobEndNotifier.java?rev=1232128&r1=1232127&r2=1232128&view=diff ============================================================================== --- hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/JobEndNotifier.java (original) +++ hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/JobEndNotifier.java Mon Jan 16 19:40:00 2012 @@ -19,12 +19,11 @@ package org.apache.hadoop.mapreduce.v2.app; import java.io.IOException; -import java.io.InputStream; +import java.net.HttpURLConnection; import java.net.InetSocketAddress; import java.net.MalformedURLException; -import java.net.URL; -import java.net.URLConnection; import java.net.Proxy; +import java.net.URL; import org.apache.hadoop.conf.Configurable; import org.apache.hadoop.conf.Configuration; @@ -40,7 +39,8 @@ import org.mortbay.log.Log; * User can specify number of retry attempts and a time interval at which to * attempt retries
  • * Cluster administrators can set final parameters to set maximum number of - * tries (0 would disable job end notification) and max time interval
  • + * tries (0 would disable job end notification) and max time interval and a + * proxy if needed
  • * The URL may contain sentinels which will be replaced by jobId and jobStatus * (eg. SUCCEEDED/KILLED/FAILED)
  • *

    @@ -59,8 +59,8 @@ public class JobEndNotifier implements C /** * Parse the URL that needs to be notified of the end of the job, along - * with the number of retries in case of failure and the amount of time to - * wait between retries + * with the number of retries in case of failure, the amount of time to + * wait between retries and proxy settings * @param conf the configuration */ public void setConf(Configuration conf) { @@ -119,15 +119,19 @@ public class JobEndNotifier implements C boolean success = false; try { Log.info("Job end notification trying " + urlToNotify); - URLConnection conn = urlToNotify.openConnection(proxyToUse); + HttpURLConnection conn = (HttpURLConnection) urlToNotify.openConnection(); conn.setConnectTimeout(5*1000); conn.setReadTimeout(5*1000); conn.setAllowUserInteraction(false); - InputStream is = conn.getInputStream(); - conn.getContent(); - is.close(); - success = true; - Log.info("Job end notification to " + urlToNotify + " succeeded"); + if(conn.getResponseCode() != HttpURLConnection.HTTP_OK) { + Log.warn("Job end notification to " + urlToNotify +" failed with code: " + + conn.getResponseCode() + " and message \"" + conn.getResponseMessage() + +"\""); + } + else { + success = true; + Log.info("Job end notification to " + urlToNotify + " succeeded"); + } } catch(IOException ioe) { Log.warn("Job end notification to " + urlToNotify + " failed", ioe); } @@ -135,8 +139,8 @@ public class JobEndNotifier implements C } /** - * Notify a server of the completion of a submitted job. The server must have - * configured MRConfig.JOB_END_NOTIFICATION_URLS + * Notify a server of the completion of a submitted job. The user must have + * configured MRJobConfig.MR_JOB_END_NOTIFICATION_URL * @param jobReport JobReport used to read JobId and JobStatus * @throws InterruptedException */