Return-Path: X-Original-To: apmail-hadoop-common-commits-archive@www.apache.org Delivered-To: apmail-hadoop-common-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 6162711170 for ; Fri, 19 Sep 2014 20:21:50 +0000 (UTC) Received: (qmail 26927 invoked by uid 500); 19 Sep 2014 20:21:50 -0000 Delivered-To: apmail-hadoop-common-commits-archive@hadoop.apache.org Received: (qmail 26858 invoked by uid 500); 19 Sep 2014 20:21:50 -0000 Mailing-List: contact common-commits-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: common-dev@hadoop.apache.org Delivered-To: mailing list common-commits@hadoop.apache.org Received: (qmail 26849 invoked by uid 99); 19 Sep 2014 20:21:50 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 19 Sep 2014 20:21:50 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id B1DF9A1E586; Fri, 19 Sep 2014 20:21:49 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: jlowe@apache.org To: common-commits@hadoop.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: git commit: MAPREDUCE-6091. YARNRunner.getJobStatus() fails with ApplicationNotFoundException if the job rolled off the RM view. Contributed by Sangjin Lee (cherry picked from commit 951847ba94442b8d928435decfbea9ea20882912) Date: Fri, 19 Sep 2014 20:21:49 +0000 (UTC) Repository: hadoop Updated Branches: refs/heads/branch-2 5f6129feb -> bdb864e5e MAPREDUCE-6091. YARNRunner.getJobStatus() fails with ApplicationNotFoundException if the job rolled off the RM view. Contributed by Sangjin Lee (cherry picked from commit 951847ba94442b8d928435decfbea9ea20882912) Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/bdb864e5 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/bdb864e5 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/bdb864e5 Branch: refs/heads/branch-2 Commit: bdb864e5e183b47d7cb14bcc0b5fc23312dbb5f9 Parents: 5f6129f Author: Jason Lowe Authored: Fri Sep 19 20:15:54 2014 +0000 Committer: Jason Lowe Committed: Fri Sep 19 20:17:44 2014 +0000 ---------------------------------------------------------------------- hadoop-mapreduce-project/CHANGES.txt | 4 ++++ .../org/apache/hadoop/mapred/ClientServiceDelegate.java | 3 +++ .../org/apache/hadoop/mapred/TestClientServiceDelegate.java | 8 +++++--- .../org/apache/hadoop/mapreduce/v2/TestNonExistentJob.java | 9 ++------- 4 files changed, 14 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/bdb864e5/hadoop-mapreduce-project/CHANGES.txt ---------------------------------------------------------------------- diff --git a/hadoop-mapreduce-project/CHANGES.txt b/hadoop-mapreduce-project/CHANGES.txt index 0e6a6cd..7d1768f 100644 --- a/hadoop-mapreduce-project/CHANGES.txt +++ b/hadoop-mapreduce-project/CHANGES.txt @@ -139,6 +139,10 @@ Release 2.6.0 - UNRELEASED MAPREDUCE-6086. mapreduce.job.credentials.binary should allow all URIs. (Zhihai Xu via kasha) + MAPREDUCE-6091. YARNRunner.getJobStatus() fails with + ApplicationNotFoundException if the job rolled off the RM view (Sangjin + Lee via jlowe) + Release 2.5.1 - 2014-09-05 INCOMPATIBLE CHANGES http://git-wip-us.apache.org/repos/asf/hadoop/blob/bdb864e5/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/main/java/org/apache/hadoop/mapred/ClientServiceDelegate.java ---------------------------------------------------------------------- diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/main/java/org/apache/hadoop/mapred/ClientServiceDelegate.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/main/java/org/apache/hadoop/mapred/ClientServiceDelegate.java index c3eee2c..686fa0c 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/main/java/org/apache/hadoop/mapred/ClientServiceDelegate.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/main/java/org/apache/hadoop/mapred/ClientServiceDelegate.java @@ -69,6 +69,7 @@ import org.apache.hadoop.yarn.api.records.ApplicationId; import org.apache.hadoop.yarn.api.records.ApplicationReport; import org.apache.hadoop.yarn.api.records.NodeId; import org.apache.hadoop.yarn.api.records.YarnApplicationState; +import org.apache.hadoop.yarn.exceptions.ApplicationNotFoundException; import org.apache.hadoop.yarn.exceptions.YarnException; import org.apache.hadoop.yarn.exceptions.YarnRuntimeException; import org.apache.hadoop.yarn.factories.RecordFactory; @@ -150,6 +151,8 @@ public class ClientServiceDelegate { ApplicationReport application = null; try { application = rm.getApplicationReport(appId); + } catch (ApplicationNotFoundException e) { + application = null; } catch (YarnException e2) { throw new IOException(e2); } http://git-wip-us.apache.org/repos/asf/hadoop/blob/bdb864e5/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapred/TestClientServiceDelegate.java ---------------------------------------------------------------------- diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapred/TestClientServiceDelegate.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapred/TestClientServiceDelegate.java index 5639e5d..7d6b2f3 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapred/TestClientServiceDelegate.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapred/TestClientServiceDelegate.java @@ -31,8 +31,6 @@ import java.net.InetSocketAddress; import java.util.Arrays; import java.util.Collection; -import org.junit.Assert; - import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.mapreduce.JobID; import org.apache.hadoop.mapreduce.JobStatus; @@ -56,8 +54,10 @@ import org.apache.hadoop.yarn.api.records.ApplicationReport; import org.apache.hadoop.yarn.api.records.FinalApplicationStatus; import org.apache.hadoop.yarn.api.records.YarnApplicationState; import org.apache.hadoop.yarn.conf.YarnConfiguration; +import org.apache.hadoop.yarn.exceptions.ApplicationNotFoundException; import org.apache.hadoop.yarn.exceptions.YarnException; import org.apache.hadoop.yarn.util.Records; +import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -488,7 +488,9 @@ public class TestClientServiceDelegate { private ResourceMgrDelegate getRMDelegate() throws IOException { ResourceMgrDelegate rm = mock(ResourceMgrDelegate.class); try { - when(rm.getApplicationReport(jobId.getAppId())).thenReturn(null); + ApplicationId appId = jobId.getAppId(); + when(rm.getApplicationReport(appId)). + thenThrow(new ApplicationNotFoundException(appId + " not found")); } catch (YarnException e) { throw new IOException(e); } http://git-wip-us.apache.org/repos/asf/hadoop/blob/bdb864e5/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapreduce/v2/TestNonExistentJob.java ---------------------------------------------------------------------- diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapreduce/v2/TestNonExistentJob.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapreduce/v2/TestNonExistentJob.java index d4f5f84..b6947f3 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapreduce/v2/TestNonExistentJob.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapreduce/v2/TestNonExistentJob.java @@ -90,13 +90,8 @@ public class TestNonExistentJob extends TestCase { } public void testGetInvalidJob() throws Exception { - try { - RunningJob runJob = new JobClient(getJobConf()).getJob(JobID.forName("job_0_0")); - fail("Exception is expected to thrown ahead!"); - } catch (Exception e) { - assertTrue(e instanceof IOException); - assertTrue(e.getMessage().contains("ApplicationNotFoundException")); - } + RunningJob runJob = new JobClient(getJobConf()).getJob(JobID.forName("job_0_0")); + assertNull(runJob); } }