Package org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer.event

Examples of org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer.event.ResourceRecoveredEvent


      Assert.assertNull(tracker.getLocalizedResource(lr1));
      final long localizedId1 = 52;
      Path hierarchicalPath1 = new Path(localDir,
          Long.toString(localizedId1));
      Path localizedPath1 = new Path(hierarchicalPath1, "resource.jar");
      tracker.handle(new ResourceRecoveredEvent(lr1, localizedPath1, 120));
      dispatcher.await();
      Assert.assertNotNull(tracker.getLocalizedResource(lr1));

      // verify new paths reflect recovery of previous resources
      LocalResourceRequest lr2 = createLocalResourceRequest(user, 2, 2,
View Full Code Here


      Assert.assertNull(tracker.getLocalizedResource(lr1));
      final long localizedId1 = 52;
      Path hierarchicalPath1 = new Path(localDirRoot + "/4/2",
          Long.toString(localizedId1));
      Path localizedPath1 = new Path(hierarchicalPath1, "resource.jar");
      tracker.handle(new ResourceRecoveredEvent(lr1, localizedPath1, 120));
      dispatcher.await();
      Assert.assertNotNull(tracker.getLocalizedResource(lr1));
      LocalCacheDirectoryManager dirMgrRoot =
          tracker.getDirectoryManager(localDirRoot);
      Assert.assertEquals(0, dirMgrRoot.getDirectory("").getCount());
      Assert.assertEquals(1, dirMgrRoot.getDirectory("4/2").getCount());

      LocalResourceRequest lr2 = createLocalResourceRequest(user, 2, 2,
          LocalResourceVisibility.PUBLIC);
      Assert.assertNull(tracker.getLocalizedResource(lr2));
      final long localizedId2 = localizedId1 + 1;
      Path hierarchicalPath2 = new Path(localDirRoot + "/4/2",
          Long.toString(localizedId2));
      Path localizedPath2 = new Path(hierarchicalPath2, "resource.jar");
      tracker.handle(new ResourceRecoveredEvent(lr2, localizedPath2, 120));
      dispatcher.await();
      Assert.assertNotNull(tracker.getLocalizedResource(lr2));
      Assert.assertEquals(0, dirMgrRoot.getDirectory("").getCount());
      Assert.assertEquals(2, dirMgrRoot.getDirectory("4/2").getCount());

      LocalResourceRequest lr3 = createLocalResourceRequest(user, 3, 3,
          LocalResourceVisibility.PUBLIC);
      Assert.assertNull(tracker.getLocalizedResource(lr3));
      final long localizedId3 = 128;
      Path hierarchicalPath3 = new Path(localDirRoot + "/4/3",
          Long.toString(localizedId3));
      Path localizedPath3 = new Path(hierarchicalPath3, "resource.jar");
      tracker.handle(new ResourceRecoveredEvent(lr3, localizedPath3, 120));
      dispatcher.await();
      Assert.assertNotNull(tracker.getLocalizedResource(lr3));
      Assert.assertEquals(0, dirMgrRoot.getDirectory("").getCount());
      Assert.assertEquals(2, dirMgrRoot.getDirectory("4/2").getCount());
      Assert.assertEquals(1, dirMgrRoot.getDirectory("4/3").getCount());

      LocalResourceRequest lr4 = createLocalResourceRequest(user, 4, 4,
          LocalResourceVisibility.PUBLIC);
      Assert.assertNull(tracker.getLocalizedResource(lr4));
      final long localizedId4 = 256;
      Path hierarchicalPath4 = new Path(localDirRoot + "/4",
          Long.toString(localizedId4));
      Path localizedPath4 = new Path(hierarchicalPath4, "resource.jar");
      tracker.handle(new ResourceRecoveredEvent(lr4, localizedPath4, 120));
      dispatcher.await();
      Assert.assertNotNull(tracker.getLocalizedResource(lr4));
      Assert.assertEquals(0, dirMgrRoot.getDirectory("").getCount());
      Assert.assertEquals(1, dirMgrRoot.getDirectory("4").getCount());
      Assert.assertEquals(2, dirMgrRoot.getDirectory("4/2").getCount());
View Full Code Here

    for (LocalizedResourceProto proto : state.getLocalizedResources()) {
      LocalResource rsrc = new LocalResourcePBImpl(proto.getResource());
      LocalResourceRequest req = new LocalResourceRequest(rsrc);
      LOG.info("Recovering localized resource " + req + " at "
          + proto.getLocalPath());
      tracker.handle(new ResourceRecoveredEvent(req,
          new Path(proto.getLocalPath()), proto.getSize()));
    }

    for (Map.Entry<LocalResourceProto, Path> entry :
         state.getInProgressResources().entrySet()) {
      LocalResource rsrc = new LocalResourcePBImpl(entry.getKey());
      LocalResourceRequest req = new LocalResourceRequest(rsrc);
      Path localPath = entry.getValue();
      tracker.handle(new ResourceRecoveredEvent(req, localPath, 0));

      // delete any in-progress localizations, containers will request again
      LOG.info("Deleting in-progress localization for " + req + " at "
          + localPath);
      tracker.remove(tracker.getLocalizedResource(req), delService);
View Full Code Here

  }

  private static class RecoveredTransition extends ResourceTransition {
    @Override
    public void transition(LocalizedResource rsrc, ResourceEvent event) {
      ResourceRecoveredEvent recoveredEvent = (ResourceRecoveredEvent) event;
      rsrc.localPath = recoveredEvent.getLocalPath();
      rsrc.size = recoveredEvent.getSize();
    }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer.event.ResourceRecoveredEvent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.