當前位置: 首頁>>代碼示例>>Java>>正文


Java ApplicationSubmissionContext.getUnmanagedAM方法代碼示例

本文整理匯總了Java中org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext.getUnmanagedAM方法的典型用法代碼示例。如果您正苦於以下問題:Java ApplicationSubmissionContext.getUnmanagedAM方法的具體用法?Java ApplicationSubmissionContext.getUnmanagedAM怎麽用?Java ApplicationSubmissionContext.getUnmanagedAM使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext的用法示例。


在下文中一共展示了ApplicationSubmissionContext.getUnmanagedAM方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: SchedulerApplicationAttempt

import org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext; //導入方法依賴的package包/類
public SchedulerApplicationAttempt(ApplicationAttemptId applicationAttemptId, 
    String user, Queue queue, ActiveUsersManager activeUsersManager,
    RMContext rmContext) {
  Preconditions.checkNotNull(rmContext, "RMContext should not be null");
  this.rmContext = rmContext;
  this.appSchedulingInfo = 
      new AppSchedulingInfo(applicationAttemptId, user, queue,  
          activeUsersManager, rmContext.getEpoch());
  this.queue = queue;
  this.pendingRelease = new HashSet<ContainerId>();
  this.attemptId = applicationAttemptId;
  if (rmContext.getRMApps() != null &&
      rmContext.getRMApps()
          .containsKey(applicationAttemptId.getApplicationId())) {
    ApplicationSubmissionContext appSubmissionContext =
        rmContext.getRMApps().get(applicationAttemptId.getApplicationId())
            .getApplicationSubmissionContext();
    if (appSubmissionContext != null) {
      unmanagedAM = appSubmissionContext.getUnmanagedAM();
      this.logAggregationContext =
          appSubmissionContext.getLogAggregationContext();
    }
  }
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:25,代碼來源:SchedulerApplicationAttempt.java

示例2: testCreateAppFinished

import org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext; //導入方法依賴的package包/類
protected RMApp testCreateAppFinished(
    ApplicationSubmissionContext submissionContext,
    String diagnostics) throws IOException {
  // unmanaged AMs don't use the FINISHING state
  RMApp application = null;
  if (submissionContext != null && submissionContext.getUnmanagedAM()) {
    application = testCreateAppRunning(submissionContext);
  } else {
    application = testCreateAppFinishing(submissionContext);
  }
  // RUNNING/FINISHING => FINISHED event RMAppEventType.ATTEMPT_FINISHED
  RMAppEvent finishedEvent = new RMAppFinishedAttemptEvent(
      application.getApplicationId(), diagnostics);
  application.handle(finishedEvent);
  assertAppState(RMAppState.FINISHED, application);
  assertTimesAtFinish(application);
  // finished without a proper unregister implies failed
  assertFinalAppStatus(FinalApplicationStatus.FAILED, application);
  Assert.assertTrue("Finished app missing diagnostics",
      application.getDiagnostics().indexOf(diagnostics) != -1);
  return application;
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:23,代碼來源:TestRMAppTransitions.java

示例3: SchedulerApplicationAttempt

import org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext; //導入方法依賴的package包/類
public SchedulerApplicationAttempt(ApplicationAttemptId applicationAttemptId, 
    String user, Queue queue, ActiveUsersManager activeUsersManager,
    RMContext rmContext) {
  Preconditions.checkNotNull(rmContext, "RMContext should not be null");
  this.rmContext = rmContext;
  this.appSchedulingInfo = 
      new AppSchedulingInfo(applicationAttemptId, user, queue,  
          activeUsersManager, rmContext.getEpoch(), attemptResourceUsage);
  this.queue = queue;
  this.pendingRelease = new HashSet<ContainerId>();
  this.attemptId = applicationAttemptId;
  if (rmContext.getRMApps() != null &&
      rmContext.getRMApps()
          .containsKey(applicationAttemptId.getApplicationId())) {
    RMApp rmApp = rmContext.getRMApps().get(applicationAttemptId.getApplicationId());
    ApplicationSubmissionContext appSubmissionContext =
        rmApp
            .getApplicationSubmissionContext();
    appAttempt = rmApp.getCurrentAppAttempt();
    if (appSubmissionContext != null) {
      unmanagedAM = appSubmissionContext.getUnmanagedAM();
      this.logAggregationContext =
          appSubmissionContext.getLogAggregationContext();
    }
  }
}
 
開發者ID:aliyun-beta,項目名稱:aliyun-oss-hadoop-fs,代碼行數:27,代碼來源:SchedulerApplicationAttempt.java

示例4: testCreateAppFinished

import org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext; //導入方法依賴的package包/類
protected RMApp testCreateAppFinished(
    ApplicationSubmissionContext submissionContext,
    String diagnostics) throws IOException {
  // unmanaged AMs don't use the FINISHING state
  RMApp application = null;
  if (submissionContext != null && submissionContext.getUnmanagedAM()) {
    application = testCreateAppRunning(submissionContext);
  } else {
    application = testCreateAppFinishing(submissionContext);
  }
  // RUNNING/FINISHING => FINISHED event RMAppEventType.ATTEMPT_FINISHED
  RMAppEvent finishedEvent = new RMAppEvent(application.getApplicationId(),
      RMAppEventType.ATTEMPT_FINISHED, diagnostics);
  application.handle(finishedEvent);
  assertAppState(RMAppState.FINISHED, application);
  assertTimesAtFinish(application);
  // finished without a proper unregister implies failed
  assertFinalAppStatus(FinalApplicationStatus.FAILED, application);
  Assert.assertTrue("Finished app missing diagnostics",
      application.getDiagnostics().indexOf(diagnostics) != -1);
  return application;
}
 
開發者ID:aliyun-beta,項目名稱:aliyun-oss-hadoop-fs,代碼行數:23,代碼來源:TestRMAppTransitions.java

示例5: transition

import org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext; //導入方法依賴的package包/類
@Override
public RMAppAttemptState transition(RMAppAttemptImpl appAttempt,
    RMAppAttemptEvent event) {
  ApplicationSubmissionContext subCtx = appAttempt.submissionContext;
  if (!subCtx.getUnmanagedAM()) {
    // Need reset #containers before create new attempt, because this request
    // will be passed to scheduler, and scheduler will deduct the number after
    // AM container allocated
    
    // Currently, following fields are all hard code,
    // TODO: change these fields when we want to support
    // priority/resource-name/relax-locality specification for AM containers
    // allocation.
    appAttempt.amReq.setNumContainers(1);
    appAttempt.amReq.setPriority(AM_CONTAINER_PRIORITY);
    appAttempt.amReq.setResourceName(ResourceRequest.ANY);
    appAttempt.amReq.setRelaxLocality(true);
    
    // AM resource has been checked when submission
    Allocation amContainerAllocation =
        appAttempt.scheduler.allocate(appAttempt.applicationAttemptId,
            Collections.singletonList(appAttempt.amReq),
            EMPTY_CONTAINER_RELEASE_LIST, null, null);
    if (amContainerAllocation != null
        && amContainerAllocation.getContainers() != null) {
      assert (amContainerAllocation.getContainers().size() == 0);
    }
    return RMAppAttemptState.SCHEDULED;
  } else {
    // save state and then go to LAUNCHED state
    appAttempt.storeAttempt();
    return RMAppAttemptState.LAUNCHED_UNMANAGED_SAVING;
  }
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:35,代碼來源:RMAppAttemptImpl.java

示例6: validateAndCreateResourceRequest

import org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext; //導入方法依賴的package包/類
private ResourceRequest validateAndCreateResourceRequest(
    ApplicationSubmissionContext submissionContext, boolean isRecovery)
    throws InvalidResourceRequestException {
  // Validation of the ApplicationSubmissionContext needs to be completed
  // here. Only those fields that are dependent on RM's configuration are
  // checked here as they have to be validated whether they are part of new
  // submission or just being recovered.

  // Check whether AM resource requirements are within required limits
  if (!submissionContext.getUnmanagedAM()) {
    ResourceRequest amReq = submissionContext.getAMContainerResourceRequest();
    if (amReq == null) {
      amReq = BuilderUtils
          .newResourceRequest(RMAppAttemptImpl.AM_CONTAINER_PRIORITY,
              ResourceRequest.ANY, submissionContext.getResource(), 1);
    }

    // set label expression for AM container
    if (null == amReq.getNodeLabelExpression()) {
      amReq.setNodeLabelExpression(submissionContext
          .getNodeLabelExpression());
    }

    try {
      SchedulerUtils.normalizeAndValidateRequest(amReq,
          scheduler.getMaximumResourceCapability(),
          submissionContext.getQueue(), scheduler, isRecovery, rmContext);
    } catch (InvalidResourceRequestException e) {
      LOG.warn("RM app submission failed in validating AM resource request"
          + " for application " + submissionContext.getApplicationId(), e);
      throw e;
    }

    SchedulerUtils.normalizeRequest(amReq, scheduler.getResourceCalculator(),
        scheduler.getClusterResource(),
        scheduler.getMinimumResourceCapability(),
        scheduler.getMaximumResourceCapability(),
        scheduler.getMinimumResourceCapability());
    return amReq;
  }
  
  return null;
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:44,代碼來源:RMAppManager.java

示例7: transition

import org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext; //導入方法依賴的package包/類
@Override
public RMAppAttemptState transition(RMAppAttemptImpl appAttempt,
    RMAppAttemptEvent event) {
  ApplicationSubmissionContext subCtx = appAttempt.submissionContext;
  if (!subCtx.getUnmanagedAM()) {
    // Need reset #containers before create new attempt, because this request
    // will be passed to scheduler, and scheduler will deduct the number after
    // AM container allocated
    
    // Currently, following fields are all hard code,
    // TODO: change these fields when we want to support
    // priority/resource-name/relax-locality specification for AM containers
    // allocation.
    appAttempt.amReq.setNumContainers(1);
    appAttempt.amReq.setPriority(AM_CONTAINER_PRIORITY);
    appAttempt.amReq.setResourceName(ResourceRequest.ANY);
    appAttempt.amReq.setRelaxLocality(true);

    appAttempt.getAMBlacklist().refreshNodeHostCount(
        appAttempt.scheduler.getNumClusterNodes());

    BlacklistUpdates amBlacklist = appAttempt.getAMBlacklist()
        .getBlacklistUpdates();
    if (LOG.isDebugEnabled()) {
      LOG.debug("Using blacklist for AM: additions(" +
          amBlacklist.getAdditions() + ") and removals(" +
          amBlacklist.getRemovals() + ")");
    }
    // AM resource has been checked when submission
    Allocation amContainerAllocation =
        appAttempt.scheduler.allocate(
            appAttempt.applicationAttemptId,
            Collections.singletonList(appAttempt.amReq),
            EMPTY_CONTAINER_RELEASE_LIST,
            amBlacklist.getAdditions(),
            amBlacklist.getRemovals(), null, null);
    if (amContainerAllocation != null
        && amContainerAllocation.getContainers() != null) {
      assert (amContainerAllocation.getContainers().size() == 0);
    }
    return RMAppAttemptState.SCHEDULED;
  } else {
    // save state and then go to LAUNCHED state
    appAttempt.storeAttempt();
    return RMAppAttemptState.LAUNCHED_UNMANAGED_SAVING;
  }
}
 
開發者ID:aliyun-beta,項目名稱:aliyun-oss-hadoop-fs,代碼行數:48,代碼來源:RMAppAttemptImpl.java


注:本文中的org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext.getUnmanagedAM方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。