diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/localizer/ResourceLocalizationService.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/localizer/ResourceLocalizationService.java index 12251a2eb3a..142387e8da7 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/localizer/ResourceLocalizationService.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/localizer/ResourceLocalizationService.java @@ -972,11 +972,17 @@ public class ResourceLocalizationService extends CompositeService .getDU(new File(local.toUri())))); assoc.getResource().unlock(); } catch (ExecutionException e) { - LOG.info("Failed to download resource " + assoc.getResource(), - e.getCause()); - LocalResourceRequest req = assoc.getResource().getRequest(); - publicRsrc.handle(new ResourceFailedLocalizationEvent(req, - e.getMessage())); + String user = assoc.getContext().getUser(); + ApplicationId applicationId = assoc.getContext().getContainerId().getApplicationAttemptId().getApplicationId(); + LocalResourcesTracker tracker = + getLocalResourcesTracker(LocalResourceVisibility.APPLICATION, user, applicationId); + final String diagnostics = "Failed to download resource " + + assoc.getResource() + " " + e.getCause(); + tracker.handle(new ResourceFailedLocalizationEvent( + assoc.getResource().getRequest(), diagnostics)); + publicRsrc.handle(new ResourceFailedLocalizationEvent( + assoc.getResource().getRequest(), diagnostics)); + LOG.error(diagnostics); assoc.getResource().unlock(); } catch (CancellationException e) { // ignore; shutting down diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/localizer/TestResourceLocalizationService.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/localizer/TestResourceLocalizationService.java index 4d03f152bbd..2b9148e5c16 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/localizer/TestResourceLocalizationService.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/localizer/TestResourceLocalizationService.java @@ -2398,6 +2398,9 @@ public class TestResourceLocalizationService { // Waiting for resource to change into FAILED state. Assert.assertTrue(waitForResourceState(lr, spyService, req, LocalResourceVisibility.PUBLIC, user, null, ResourceState.FAILED, 5000)); + Assert.assertTrue(waitForResourceState(lr, spyService, req, + LocalResourceVisibility.APPLICATION, user, appId, ResourceState.FAILED, 5000)); + // releasing lock as a part of download failed process. lr.unlock(); // removing pending download request.