Package org.apache.hadoop.corona

Examples of org.apache.hadoop.corona.ResourceGrant


    ResourceTracker resourceTracker = jt.getResourceTracker();
    SessionDriver sessionDriver = jt.getSessionDriver();
    List<ResourceGrant> excludeGrants = new ArrayList<ResourceGrant>();
    for (int i = 0; i < maxJTAttempts; i++) {
      try {
        ResourceGrant jtGrant = waitForJTGrant(resourceTracker, sessionDriver,
            excludeGrants);
        boolean success = startRemoteJT(jobConf, jtGrant);
        if (success) {
          return;
        } else {
          excludeGrants.add(jtGrant);
          resourceTracker.releaseResource(jtGrant.getId());
          List<ResourceRequest> released =
            resourceTracker.getResourcesToRelease();
          sessionDriver.releaseResources(released);
        }
      } catch (InterruptedException e) {
View Full Code Here


    assertEquals(0, rt.getWantedResources().size());
   
    List<ResourceGrant> grants = new ArrayList<ResourceGrant>();
   
    for (int i = 1; i <= 4; i++) {
      ResourceGrant grant =
        new ResourceGrant(i, TstUtils.getNodeHost(i-1),
            TstUtils.getNodeAddress(i-1), ClusterManager.clock.getTime(),
            wanted.get(i - 1).getType());
      grant.setAppInfo("192.168.0.1:1234"); // some random app info.
      grants.add(grant);
    }
   
    rt.addNewGrants(grants);
   
View Full Code Here

    assertEquals(4, wanted.size());
    assertEquals(0, rt.getWantedResources().size());
   
    List<ResourceGrant> grants = new ArrayList<ResourceGrant>();
    for (int i = 0; i < 4; i++) {
      ResourceGrant grant =
        new ResourceGrant(i+1, TstUtils.getNodeHost(i),
            TstUtils.getNodeAddress(i), ClusterManager.clock.getTime(),
            wanted.get(i).getType());
      grant.setAppInfo("192.168.0.1:1234"); // some random app info.
      grants.add(grant);
    }
    // Grant the initial need.
    rt.addNewGrants(grants);
View Full Code Here

      while (grantIter.hasNext() && processed < maxBatchSize) {
        processed++;
        Integer grantId = grantIter.next();
        grantIter.remove();
        Integer requestId = grantId;
        ResourceGrant grant = grantedResources.get(grantId);
        if (processor.processAvailableResource(grant)) {
          if (LOG.isDebugEnabled()) {
            LOG.info("processed available resource with requestId: " +
              requestId);
          }
View Full Code Here

  private void failTask(TaskAttemptID taskId, String reason,
      boolean isFailed) {
    TaskInProgress tip = taskLookupTable.getTIP(taskId);
    Integer grantId = taskLookupTable.getGrantIdForTask(taskId);
    ResourceGrant grant = resourceTracker.getGrant(grantId);
    synchronized (lockObject) {
      if (!tip.isAttemptRunning(taskId)) {
        /*
         * This attempt is not running so we should not be killing/failing it
         * The reason we might try to fail the task that is not running is if it
         * has finished and was preempted at the same time.
         */
        return;
      }
    }
    assert grant != null : "Task " + taskId +
      " is running but has no associated resource";
    String trackerName = grant.getNodeName();
    TaskTrackerStatus trackerStatus =
      getTaskTrackerStatus(trackerName);

    TaskStatus.Phase phase =
      tip.isMapTask() ? TaskStatus.Phase.MAP : TaskStatus.Phase.STARTING;
View Full Code Here

        // but the speculation is no longer needed
        resourceTracker.releaseResource(grant);
        return;
      }
      if (abandonHost) {
        ResourceGrant resource = resourceTracker.getGrant(grant);
        String hostToExlcude = resource.getAddress().getHost();
        taskToContextMap.get(tip).excludedHosts.add(hostToExlcude);
        excludedHosts = taskToContextMap.get(tip).excludedHosts;
      }
      ResourceRequest newReq = resourceTracker.releaseAndRequestResource(grant,
          excludedHosts);
View Full Code Here

    // The TIP that this grant was issued for originally
    // if tip is not equal to assignedTip then the grant was borrowed
    TaskInProgress assignedTip = requestToTipMap.get(grantId);
    taskLookupTable.removeTaskEntry(taskid);

    ResourceGrant grant = resourceTracker.getGrant(grantId);
    String trackerName = null;
    if (grant != null) {
      trackerName = grant.nodeName;
    }
    if (trackerName != null) {
View Full Code Here

   */
  public void expiredLaunchingTask(TaskAttemptID taskId) {
    synchronized (lockObject) {
      Integer grantId = taskLookupTable.getGrantIdForTask(taskId);
      if (grantId != null) {
        ResourceGrant grant = resourceTracker.getGrant(grantId);
        if (grant != null) {
          trackerStats.recordTimeout(grant.getNodeName());
        }
      }
      failTask(taskId, "Error launching task", false);
    }
  }
View Full Code Here

   */
  public void expiredRunningTask(TaskAttemptID taskId) {
    synchronized (lockObject) {
      Integer grantId = taskLookupTable.getGrantIdForTask(taskId);
      if (grantId != null) {
        ResourceGrant grant = resourceTracker.getGrant(grantId);
        if (grant != null) {
          trackerStats.recordTimeout(grant.getNodeName());
        }
      }
      failTask(taskId, "Timeout running task", false);
    }
  }
View Full Code Here

        Integer runningGrant = taskLookupTable.getGrantIdForTask(tid);
        if (runningGrant == null) {
          // This task attempt is no longer running
          continue;
        }
        ResourceGrant resource = resourceTracker.getGrant(runningGrant);
        String tidHost = resource.getAddress().getHost();
        excludedHosts.add(tidHost);
      }
      req.setExcludeHosts(new ArrayList<String>(excludedHosts));
      List<String> newHosts = new ArrayList<String>();
      if (req.getHosts() != null) {
View Full Code Here

TOP

Related Classes of org.apache.hadoop.corona.ResourceGrant

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.