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

Examples of org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer.LocalResourceRequest


    ResourcesRequestedMatcher(Map<String, LocalResource> allResources,
        EnumSet<LocalResourceVisibility> vis) throws URISyntaxException {
      for (Entry<String, LocalResource> e : allResources.entrySet()) {
        if (vis.contains(e.getValue().getVisibility())) {
          resources.add(new LocalResourceRequest(e.getValue()));
        }
      }
    }
View Full Code Here


          continue;
        }
        if (checkLocalizingState) {
          assertEquals(ContainerState.LOCALIZING, c.getContainerState());
        }
        LocalResourceRequest req = new LocalResourceRequest(rsrc.getValue());
        Path p = new Path(cache, rsrc.getKey());
        localPaths.put(p, Arrays.asList(rsrc.getKey()));
        // rsrc copied to p
        c.handle(new ContainerResourceLocalizedEvent(c.getContainerID(),
                 req, p));
View Full Code Here

    }
   
    public void failLocalizeSpecificResource(String rsrcKey)
        throws URISyntaxException {
      LocalResource rsrc = localResources.get(rsrcKey);
      LocalResourceRequest req = new LocalResourceRequest(rsrc);
      Exception e = new Exception("Fake localization error");
      c.handle(new ContainerResourceFailedEvent(c.getContainerID(), req, e));
      drainDispatcherEvents();
    }
View Full Code Here

      for (Entry<String, LocalResource> rsrc : localResources.entrySet()) {
        if (counter >= failRsrcCount) {
          break;
        }
        ++counter;
        LocalResourceRequest req = new LocalResourceRequest(rsrc.getValue());
        Exception e = new Exception("Fake localization error");
        c.handle(new ContainerResourceFailedEvent(c.getContainerID(),
                 req, e));
      }
      drainDispatcherEvents();    
View Full Code Here

      Map<String,LocalResource> cntrRsrc = ctxt.getLocalResources();
      if (!cntrRsrc.isEmpty()) {
        try {
          for (Map.Entry<String,LocalResource> rsrc : cntrRsrc.entrySet()) {
            try {
              LocalResourceRequest req =
                  new LocalResourceRequest(rsrc.getValue());
              List<String> links = container.pendingResources.get(req);
              if (links == null) {
                links = new ArrayList<String>();
                container.pendingResources.put(req, links);
              }
              links.add(rsrc.getKey());
              switch (rsrc.getValue().getVisibility()) {
              case PUBLIC:
                container.publicRsrcs.add(req);
                break;
              case PRIVATE:
                container.privateRsrcs.add(req);
                break;
              case APPLICATION:
                container.appRsrcs.add(req);
                break;
              }
            } catch (URISyntaxException e) {
              LOG.info("Got exception parsing " + rsrc.getKey()
                  + " and value " + rsrc.getValue());
              throw e;
            }
          }
        } catch (URISyntaxException e) {
          // malformed resource; abort container launch
          LOG.warn("Failed to parse resource-request", e);
          container.cleanup();
          container.metrics.endInitingContainer();
          return ContainerState.LOCALIZATION_FAILED;
        }
        Map<LocalResourceVisibility, Collection<LocalResourceRequest>> req =
            new HashMap<LocalResourceVisibility,
                        Collection<LocalResourceRequest>>();
        if (!container.publicRsrcs.isEmpty()) {
          req.put(LocalResourceVisibility.PUBLIC, container.publicRsrcs);
        }
        if (!container.privateRsrcs.isEmpty()) {
          req.put(LocalResourceVisibility.PRIVATE, container.privateRsrcs);
        }
        if (!container.appRsrcs.isEmpty()) {
          req.put(LocalResourceVisibility.APPLICATION, container.appRsrcs);
        }
       
        container.dispatcher.getEventHandler().handle(
              new ContainerLocalizationRequestEvent(container, req));
        return ContainerState.LOCALIZING;
View Full Code Here

    long basetime = r.nextLong() >>> 2;
    org.apache.hadoop.yarn.api.records.LocalResource yA = getYarnResource(
        new Path("http://yak.org:80/foobar"), -1, basetime, FILE, PUBLIC, null);
    org.apache.hadoop.yarn.api.records.LocalResource yB = getYarnResource(
        new Path("http://yak.org:80/foobar"), -1, basetime, FILE, PUBLIC, null);
    final LocalResourceRequest a = new LocalResourceRequest(yA);
    LocalResourceRequest b = new LocalResourceRequest(yA);
    checkEqual(a, b);
    b = new LocalResourceRequest(yB);
    checkEqual(a, b);

    // ignore visibility
    yB = getYarnResource(
        new Path("http://yak.org:80/foobar"), -1, basetime, FILE, PRIVATE, null);
    b = new LocalResourceRequest(yB);
    checkEqual(a, b);

    // ignore size
    yB = getYarnResource(
        new Path("http://yak.org:80/foobar"), 0, basetime, FILE, PRIVATE, null);
    b = new LocalResourceRequest(yB);
    checkEqual(a, b);

    // note path
    yB = getYarnResource(
        new Path("hdfs://dingo.org:80/foobar"), 0, basetime, ARCHIVE, PUBLIC, null);
    b = new LocalResourceRequest(yB);
    checkNotEqual(a, b);

    // note type
    yB = getYarnResource(
        new Path("http://yak.org:80/foobar"), 0, basetime, ARCHIVE, PUBLIC, null);
    b = new LocalResourceRequest(yB);
    checkNotEqual(a, b);

    // note timestamp
    yB = getYarnResource(
        new Path("http://yak.org:80/foobar"), 0, basetime + 1, FILE, PUBLIC, null);
    b = new LocalResourceRequest(yB);
    checkNotEqual(a, b);

    // note pattern
    yB = getYarnResource(
        new Path("http://yak.org:80/foobar"), 0, basetime + 1, FILE, PUBLIC, "^/foo/.*");
    b = new LocalResourceRequest(yB);
    checkNotEqual(a, b);
  }
View Full Code Here

    r.setSeed(seed);
    System.out.println("SEED: " + seed);
    long basetime = r.nextLong() >>> 2;
    org.apache.hadoop.yarn.api.records.LocalResource yA = getYarnResource(
        new Path("http://yak.org:80/foobar"), -1, basetime, FILE, PUBLIC, "^/foo/.*");
    final LocalResourceRequest a = new LocalResourceRequest(yA);

    // Path primary
    org.apache.hadoop.yarn.api.records.LocalResource yB = getYarnResource(
        new Path("http://yak.org:80/foobaz"), -1, basetime, FILE, PUBLIC, "^/foo/.*");
    LocalResourceRequest b = new LocalResourceRequest(yB);
    assertTrue(0 > a.compareTo(b));

    // timestamp secondary
    yB = getYarnResource(
        new Path("http://yak.org:80/foobar"), -1, basetime + 1, FILE, PUBLIC, "^/foo/.*");
    b = new LocalResourceRequest(yB);
    assertTrue(0 > a.compareTo(b));

    // type tertiary
    yB = getYarnResource(
        new Path("http://yak.org:80/foobar"), -1, basetime, ARCHIVE, PUBLIC, "^/foo/.*");
    b = new LocalResourceRequest(yB);
    assertTrue(0 != a.compareTo(b)); // don't care about order, just ne
   
    // path 4th
    yB = getYarnResource(
        new Path("http://yak.org:80/foobar"), -1, basetime, ARCHIVE, PUBLIC, "^/food/.*");
    b = new LocalResourceRequest(yB);
    assertTrue(0 != a.compareTo(b)); // don't care about order, just ne
   
    yB = getYarnResource(
        new Path("http://yak.org:80/foobar"), -1, basetime, ARCHIVE, PUBLIC, null);
    b = new LocalResourceRequest(yB);
    assertTrue(0 != a.compareTo(b)); // don't care about order, just ne
  }
View Full Code Here

    ResourcesReleasedMatcher(Map<String, LocalResource> allResources,
        EnumSet<LocalResourceVisibility> vis) throws URISyntaxException {
      for (Entry<String, LocalResource> e : allResources.entrySet()) {
        if (vis.contains(e.getValue().getVisibility())) {
          resources.add(new LocalResourceRequest(e.getValue()));
        }
      }
    }
View Full Code Here

    ResourcesRequestedMatcher(Map<String, LocalResource> allResources,
        EnumSet<LocalResourceVisibility> vis) throws URISyntaxException {
      for (Entry<String, LocalResource> e : allResources.entrySet()) {
        if (vis.contains(e.getValue().getVisibility())) {
          resources.add(new LocalResourceRequest(e.getValue()));
        }
      }
    }
View Full Code Here

          continue;
        }
        if (checkLocalizingState) {
          assertEquals(ContainerState.LOCALIZING, c.getContainerState());
        }
        LocalResourceRequest req = new LocalResourceRequest(rsrc.getValue());
        Path p = new Path(cache, rsrc.getKey());
        localPaths.put(p, Arrays.asList(rsrc.getKey()));
        // rsrc copied to p
        c.handle(new ContainerResourceLocalizedEvent(c.getContainerId(),
                 req, p));
View Full Code Here

TOP

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

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.