• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java RMAppRejectedEvent类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppRejectedEvent的典型用法代码示例。如果您正苦于以下问题:Java RMAppRejectedEvent类的具体用法?Java RMAppRejectedEvent怎么用?Java RMAppRejectedEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



RMAppRejectedEvent类属于org.apache.hadoop.yarn.server.resourcemanager.rmapp包,在下文中一共展示了RMAppRejectedEvent类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: handleDTRenewerAppSubmitEvent

import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppRejectedEvent; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private void handleDTRenewerAppSubmitEvent(
    DelegationTokenRenewerAppSubmitEvent event) {
  /*
   * For applications submitted with delegation tokens we are not submitting
   * the application to scheduler from RMAppManager. Instead we are doing
   * it from here. The primary goal is to make token renewal as a part of
   * application submission asynchronous so that client thread is not
   * blocked during app submission.
   */
  try {
    // Setup tokens for renewal
    DelegationTokenRenewer.this.handleAppSubmitEvent(event);
    rmContext.getDispatcher().getEventHandler()
        .handle(new RMAppEvent(event.getApplicationId(), RMAppEventType.START));
  } catch (Throwable t) {
    LOG.warn(
        "Unable to add the application to the delegation token renewer.",
        t);
    // Sending APP_REJECTED is fine, since we assume that the
    // RMApp is in NEW state and thus we havne't yet informed the
    // Scheduler about the existence of the application
    rmContext.getDispatcher().getEventHandler().handle(
        new RMAppRejectedEvent(event.getApplicationId(), t.getMessage()));
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:27,代码来源:DelegationTokenRenewer.java


示例2: testAppAttemptSubmittedToFailedState

import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppRejectedEvent; //导入依赖的package包/类
/**
 * {@link RMAppAttemptState#SUBMITTED} -> {@link RMAppAttemptState#FAILED}
 */
private void testAppAttemptSubmittedToFailedState(String diagnostics) {
  sendAttemptUpdateSavedEvent(applicationAttempt);
  assertEquals(RMAppAttemptState.FAILED, 
      applicationAttempt.getAppAttemptState());
  assertEquals(diagnostics, applicationAttempt.getDiagnostics());
  assertEquals(0,applicationAttempt.getJustFinishedContainers().size());
  assertNull(applicationAttempt.getMasterContainer());
  assertEquals(0.0, (double)applicationAttempt.getProgress(), 0.0001);
  assertEquals(0, application.getRanNodes().size());
  assertNull(applicationAttempt.getFinalApplicationStatus());
  
  // Check events
  verify(masterService).
      unregisterAttempt(applicationAttempt.getAppAttemptId());
  
  // this works for unmanaged and managed AM's because this is actually doing
  // verify(application).handle(anyObject());
  verify(application).handle(any(RMAppRejectedEvent.class));
  verifyTokenCount(applicationAttempt.getAppAttemptId(), 1);
  verifyApplicationAttemptFinished(RMAppAttemptState.FAILED);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:25,代码来源:TestRMAppAttemptTransitions.java


示例3: transition

import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppRejectedEvent; //导入依赖的package包/类
@Override
public void transition(RMAppAttemptImpl appAttempt,
    RMAppAttemptEvent event) {

  RMAppAttemptRejectedEvent rejectedEvent = (RMAppAttemptRejectedEvent) event;

  // Tell the AMS. Unregister from the ApplicationMasterService
  appAttempt.masterService
      .unregisterAttempt(appAttempt.applicationAttemptId);
  
  // Save the diagnostic message
  String message = rejectedEvent.getMessage();
  appAttempt.setDiagnostics(message);

  // Send the rejection event to app
  appAttempt.eventHandler.handle(
      new RMAppRejectedEvent(
          rejectedEvent.getApplicationAttemptId().getApplicationId(),
          message)
      );
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:22,代码来源:RMAppAttemptImpl.java


示例4: testAppAttemptSubmittedToFailedState

import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppRejectedEvent; //导入依赖的package包/类
/**
 * {@link RMAppAttemptState#SUBMITTED} -> {@link RMAppAttemptState#FAILED}
 */
private void testAppAttemptSubmittedToFailedState(String diagnostics) {
  assertEquals(RMAppAttemptState.FAILED, 
      applicationAttempt.getAppAttemptState());
  assertEquals(diagnostics, applicationAttempt.getDiagnostics());
  assertEquals(0,applicationAttempt.getJustFinishedContainers().size());
  assertNull(applicationAttempt.getMasterContainer());
  assertEquals(0.0, (double)applicationAttempt.getProgress(), 0.0001);
  assertEquals(0, applicationAttempt.getRanNodes().size());
  assertNull(applicationAttempt.getFinalApplicationStatus());
  
  // Check events
  verify(masterService).
      unregisterAttempt(applicationAttempt.getAppAttemptId());
  
  // this works for unmanaged and managed AM's because this is actually doing
  // verify(application).handle(anyObject());
  verify(application).handle(any(RMAppRejectedEvent.class));
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:22,代码来源:TestRMAppAttemptTransitions.java


示例5: transition

import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppRejectedEvent; //导入依赖的package包/类
@Override
public void transition(RMAppAttemptImpl appAttempt,
    RMAppAttemptEvent event) {

  RMAppAttemptRejectedEvent rejectedEvent = (RMAppAttemptRejectedEvent) event;

  // Tell the AMS. Unregister from the ApplicationMasterService
  appAttempt.masterService
      .unregisterAttempt(appAttempt.applicationAttemptId);
  
  // Save the diagnostic message
  String message = rejectedEvent.getMessage();
  appAttempt.setDiagnostics(message);

  // Send the rejection event to app
  appAttempt.eventHandler.handle(
      new RMAppRejectedEvent(
          rejectedEvent.getApplicationAttemptId().getApplicationId(),
          message)
      );

  appAttempt.removeCredentials(appAttempt);
}
 
开发者ID:chendave,项目名称:hadoop-TCP,代码行数:24,代码来源:RMAppAttemptImpl.java


示例6: testAppAttemptSubmittedToFailedState

import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppRejectedEvent; //导入依赖的package包/类
/**
 * {@link RMAppAttemptState#SUBMITTED} -> {@link RMAppAttemptState#FAILED}
 */
private void testAppAttemptSubmittedToFailedState(String diagnostics) {
  assertEquals(RMAppAttemptState.FAILED, 
      applicationAttempt.getAppAttemptState());
  assertEquals(diagnostics, applicationAttempt.getDiagnostics());
  assertEquals(0,applicationAttempt.getJustFinishedContainers().size());
  assertNull(applicationAttempt.getMasterContainer());
  assertEquals(0.0, (double)applicationAttempt.getProgress(), 0.0001);
  assertEquals(0, applicationAttempt.getRanNodes().size());
  assertNull(applicationAttempt.getFinalApplicationStatus());
  
  // Check events
  verify(masterService).
      unregisterAttempt(applicationAttempt.getAppAttemptId());
  
  // this works for unmanaged and managed AM's because this is actually doing
  // verify(application).handle(anyObject());
  verify(application).handle(any(RMAppRejectedEvent.class));
  verifyTokenCount(applicationAttempt.getAppAttemptId(), 1);
}
 
开发者ID:chendave,项目名称:hadoop-TCP,代码行数:23,代码来源:TestRMAppAttemptTransitions.java


示例7: testAppAttemptSubmittedToFailedState

import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppRejectedEvent; //导入依赖的package包/类
/**
 * {@link RMAppAttemptState#SUBMITTED} -> {@link RMAppAttemptState#FAILED}
 */
private void testAppAttemptSubmittedToFailedState(String diagnostics) {
  sendAttemptUpdateSavedEvent(applicationAttempt);
  assertEquals(RMAppAttemptState.FAILED, 
      applicationAttempt.getAppAttemptState());
  assertEquals(diagnostics, applicationAttempt.getDiagnostics());
  assertEquals(0,applicationAttempt.getJustFinishedContainers().size());
  assertNull(applicationAttempt.getMasterContainer());
  assertEquals(0.0, (double)applicationAttempt.getProgress(), 0.0001);
  assertEquals(0, applicationAttempt.getRanNodes().size());
  assertNull(applicationAttempt.getFinalApplicationStatus());
  
  // Check events
  verify(masterService).
      unregisterAttempt(applicationAttempt.getAppAttemptId());
  
  // this works for unmanaged and managed AM's because this is actually doing
  // verify(application).handle(anyObject());
  verify(application).handle(any(RMAppRejectedEvent.class));
  verifyTokenCount(applicationAttempt.getAppAttemptId(), 1);
  verifyApplicationAttemptFinished(RMAppAttemptState.FAILED);
}
 
开发者ID:Seagate,项目名称:hadoop-on-lustre2,代码行数:25,代码来源:TestRMAppAttemptTransitions.java


示例8: assignToQueue

import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppRejectedEvent; //导入依赖的package包/类
/**
 * Helper method that attempts to assign the app to a queue. The method is
 * responsible to call the appropriate event-handler if the app is rejected.
 */
@VisibleForTesting
FSLeafQueue assignToQueue(RMApp rmApp, String queueName, String user) {
  FSLeafQueue queue = null;
  String appRejectMsg = null;

  try {
    QueuePlacementPolicy placementPolicy = allocConf.getPlacementPolicy();
    queueName = placementPolicy.assignAppToQueue(queueName, user);
    if (queueName == null) {
      appRejectMsg = "Application rejected by queue placement policy";
    } else {
      queue = queueMgr.getLeafQueue(queueName, true);
      if (queue == null) {
        appRejectMsg = queueName + " is not a leaf queue";
      }
    }
  } catch (IOException ioe) {
    appRejectMsg = "Error assigning app to queue " + queueName;
  }

  if (appRejectMsg != null && rmApp != null) {
    LOG.error(appRejectMsg);
    rmContext.getDispatcher().getEventHandler().handle(
        new RMAppRejectedEvent(rmApp.getApplicationId(), appRejectMsg));
    return null;
  }

  if (rmApp != null) {
    rmApp.setQueue(queue.getName());
  } else {
    LOG.error("Couldn't find RM app to set queue name on");
  }
  return queue;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:39,代码来源:FairScheduler.java


示例9: assignToQueue

import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppRejectedEvent; //导入依赖的package包/类
/**
 * Helper method that attempts to assign the app to a queue. The method is
 * responsible to call the appropriate event-handler if the app is rejected.
 */
@VisibleForTesting
FSLeafQueue assignToQueue(RMApp rmApp, String queueName, String user) {
  FSLeafQueue queue = null;
  String appRejectMsg = null;

  try {
    QueuePlacementPolicy placementPolicy = allocConf.getPlacementPolicy();
    queueName = placementPolicy.assignAppToQueue(queueName, user);
    if (queueName == null) {
      appRejectMsg = "Application rejected by queue placement policy";
    } else {
      queue = queueMgr.getLeafQueue(queueName, true);
      if (queue == null) {
        appRejectMsg = queueName + " is not a leaf queue";
      }
    }
  } catch (InvalidQueueNameException qne) {
    appRejectMsg = qne.getMessage();
  } catch (IOException ioe) {
    appRejectMsg = "Error assigning app to queue " + queueName;
  }

  if (appRejectMsg != null && rmApp != null) {
    LOG.error(appRejectMsg);
    rmContext.getDispatcher().getEventHandler().handle(
        new RMAppRejectedEvent(rmApp.getApplicationId(), appRejectMsg));
    return null;
  }

  if (rmApp != null) {
    rmApp.setQueue(queue.getName());
  } else {
    LOG.error("Couldn't find RM app to set queue name on");
  }
  return queue;
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:41,代码来源:FairScheduler.java


示例10: recoverApplication

import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppRejectedEvent; //导入依赖的package包/类
@SuppressWarnings("unchecked")
protected void
    recoverApplication(ApplicationState appState, RMState rmState)
        throws Exception {
  ApplicationSubmissionContext appContext =
      appState.getApplicationSubmissionContext();
  ApplicationId appId = appState.getAppId();

  // create and recover app.
  RMAppImpl application =
      createAndPopulateNewRMApp(appContext, appState.getSubmitTime(),
        appState.getUser());
  application.recover(rmState);
  if (isApplicationInFinalState(appState.getState())) {
    // We are synchronously moving the application into final state so that
    // momentarily client will not see this application in NEW state. Also
    // for finished applications we will avoid renewing tokens.
    application.handle(new RMAppEvent(appId, RMAppEventType.RECOVER));
    return;
  }

  if (UserGroupInformation.isSecurityEnabled()) {
    Credentials credentials = null;
    try {
      credentials = parseCredentials(appContext);
      // synchronously renew delegation token on recovery.
      rmContext.getDelegationTokenRenewer().addApplicationSync(appId,
        credentials, appContext.getCancelTokensWhenComplete());
      application.handle(new RMAppEvent(appId, RMAppEventType.RECOVER));
    } catch (Exception e) {
      LOG.warn("Unable to parse and renew delegation tokens.", e);
      this.rmContext.getDispatcher().getEventHandler()
        .handle(new RMAppRejectedEvent(appId, e.getMessage()));
      throw e;
    }
  } else {
    application.handle(new RMAppEvent(appId, RMAppEventType.RECOVER));
  }
}
 
开发者ID:Seagate,项目名称:hadoop-on-lustre2,代码行数:40,代码来源:RMAppManager.java


示例11: submitApplication

import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppRejectedEvent; //导入依赖的package包/类
@SuppressWarnings("unchecked")
protected void submitApplication(
    ApplicationSubmissionContext submissionContext, long submitTime,
    boolean isRecovered, String user) throws YarnException {
  ApplicationId applicationId = submissionContext.getApplicationId();

  // 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 = BuilderUtils.newResourceRequest(
        RMAppAttemptImpl.AM_CONTAINER_PRIORITY, ResourceRequest.ANY,
        submissionContext.getResource(), 1);
    try {
      SchedulerUtils.validateResourceRequest(amReq,
          scheduler.getMaximumResourceCapability());
    } catch (InvalidResourceRequestException e) {
      LOG.warn("RM app submission failed in validating AM resource request"
          + " for application " + applicationId, e);
      throw e;
    }
  }

  // Create RMApp
  RMApp application =
      new RMAppImpl(applicationId, rmContext, this.conf,
          submissionContext.getApplicationName(), user,
          submissionContext.getQueue(),
          submissionContext, this.scheduler, this.masterService,
          submitTime, submissionContext.getApplicationType());

  // Concurrent app submissions with same applicationId will fail here
  // Concurrent app submissions with different applicationIds will not
  // influence each other
  if (rmContext.getRMApps().putIfAbsent(applicationId, application) !=
      null) {
    String message = "Application with id " + applicationId
        + " is already present! Cannot add a duplicate!";
    LOG.warn(message);
    throw RPCUtil.getRemoteException(message);
  }

  // Inform the ACLs Manager
  this.applicationACLsManager.addApplication(applicationId,
      submissionContext.getAMContainerSpec().getApplicationACLs());

  try {
    // Setup tokens for renewal
    if (UserGroupInformation.isSecurityEnabled()) {
      this.rmContext.getDelegationTokenRenewer().addApplication(
          applicationId,parseCredentials(submissionContext),
          submissionContext.getCancelTokensWhenComplete()
          );
    }
  } catch (IOException ie) {
    LOG.warn(
        "Unable to add the application to the delegation token renewer.",
        ie);
    // Sending APP_REJECTED is fine, since we assume that the
    // RMApp is in NEW state and thus we havne't yet informed the
    // Scheduler about the existence of the application
    this.rmContext.getDispatcher().getEventHandler().handle(
        new RMAppRejectedEvent(applicationId, ie.getMessage()));
    throw RPCUtil.getRemoteException(ie);
  }

  // All done, start the RMApp
  this.rmContext.getDispatcher().getEventHandler().handle(
      new RMAppEvent(applicationId, isRecovered ? RMAppEventType.RECOVER:
          RMAppEventType.START));
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:75,代码来源:RMAppManager.java


示例12: addApplication

import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppRejectedEvent; //导入依赖的package包/类
/**
 * Add a new application to the scheduler, with a given id, queue name, and
 * user. This will accept a new app even if the user or queue is above
 * configured limits, but the app will not be marked as runnable.
 */
protected synchronized void addApplication(ApplicationId applicationId,
    String queueName, String user) {
  if (queueName == null || queueName.isEmpty()) {
    String message = "Reject application " + applicationId +
            " submitted by user " + user + " with an empty queue name.";
    LOG.info(message);
    rmContext.getDispatcher().getEventHandler()
        .handle(new RMAppRejectedEvent(applicationId, message));
    return;
  }

  RMApp rmApp = rmContext.getRMApps().get(applicationId);
  FSLeafQueue queue = assignToQueue(rmApp, queueName, user);
  if (queue == null) {
    return;
  }

  // Enforce ACLs
  UserGroupInformation userUgi = UserGroupInformation.createRemoteUser(user);

  if (!queue.hasAccess(QueueACL.SUBMIT_APPLICATIONS, userUgi)
      && !queue.hasAccess(QueueACL.ADMINISTER_QUEUE, userUgi)) {
    String msg = "User " + userUgi.getUserName() +
            " cannot submit applications to queue " + queue.getName();
    LOG.info(msg);
    rmContext.getDispatcher().getEventHandler()
        .handle(new RMAppRejectedEvent(applicationId, msg));
    return;
  }

  SchedulerApplication application =
      new SchedulerApplication(queue, user);
  applications.put(applicationId, application);
  queue.getMetrics().submitApp(user);

  LOG.info("Accepted application " + applicationId + " from user: " + user
      + ", in queue: " + queueName + ", currently num of applications: "
      + applications.size());
  rmContext.getDispatcher().getEventHandler()
      .handle(new RMAppEvent(applicationId, RMAppEventType.APP_ACCEPTED));
}
 
开发者ID:Seagate,项目名称:hadoop-on-lustre2,代码行数:47,代码来源:FairScheduler.java



注:本文中的org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppRejectedEvent类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java EncodingAlgorithmIndexes类代码示例发布时间:2022-05-23
下一篇:
Java RequestDataValueProcessor类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap