当前位置: 首页>>代码示例>>Java>>正文


Java RMAppEvent类代码示例

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


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

示例1: handleDTRenewerAppSubmitEvent

import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppEvent; //导入依赖的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: addApplication

import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppEvent; //导入依赖的package包/类
@VisibleForTesting
public synchronized void addApplication(ApplicationId applicationId,
    String queue, String user, boolean isAppRecovering) {
  SchedulerApplication<FiCaSchedulerApp> application =
      new SchedulerApplication<FiCaSchedulerApp>(DEFAULT_QUEUE, user);
  applications.put(applicationId, application);
  metrics.submitApp(user);
  LOG.info("Accepted application " + applicationId + " from user: " + user
      + ", currently num of applications: " + applications.size());
  if (isAppRecovering) {
    if (LOG.isDebugEnabled()) {
      LOG.debug(applicationId + " is recovering. Skip notifying APP_ACCEPTED");
    }
  } else {
    rmContext.getDispatcher().getEventHandler()
      .handle(new RMAppEvent(applicationId, RMAppEventType.APP_ACCEPTED));
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:19,代码来源:FifoScheduler.java

示例3: killAllAppsInQueue

import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppEvent; //导入依赖的package包/类
@Override
public synchronized void killAllAppsInQueue(String queueName)
    throws YarnException {
  // check if queue is a valid
  List<ApplicationAttemptId> apps = getAppsInQueue(queueName);
  if (apps == null) {
    String errMsg = "The specified Queue: " + queueName + " doesn't exist";
    LOG.warn(errMsg);
    throw new YarnException(errMsg);
  }
  // generate kill events for each pending/running app
  for (ApplicationAttemptId app : apps) {
    this.rmContext
        .getDispatcher()
        .getEventHandler()
        .handle(new RMAppEvent(app.getApplicationId(), RMAppEventType.KILL));
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:19,代码来源:AbstractYarnScheduler.java

示例4: transition

import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppEvent; //导入依赖的package包/类
@Override
public void transition(RMStateStore store, RMStateStoreEvent event) {
  if (!(event instanceof RMStateStoreAppEvent)) {
    // should never happen
    LOG.error("Illegal event type: " + event.getClass());
    return;
  }
  ApplicationStateData appState =
      ((RMStateStoreAppEvent) event).getAppState();
  ApplicationId appId =
      appState.getApplicationSubmissionContext().getApplicationId();
  LOG.info("Storing info for app: " + appId);
  try {
    store.storeApplicationStateInternal(appId, appState);
    store.notifyApplication(new RMAppEvent(appId,
           RMAppEventType.APP_NEW_SAVED));
  } catch (Exception e) {
    LOG.error("Error storing app: " + appId, e);
    store.notifyStoreOperationFailed(e);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:22,代码来源:RMStateStore.java

示例5: killAllAppsInQueue

import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppEvent; //导入依赖的package包/类
@Override
public synchronized void killAllAppsInQueue(String queueName)
    throws YarnException {
  // check if queue is a valid
  List<ApplicationAttemptId> apps = getAppsInQueue(queueName);
  if (apps == null) {
    String errMsg = "The specified Queue: " + queueName + " doesn't exist";
    LOG.warn(errMsg);
    throw new YarnException(errMsg);
  }
  // generate kill events for each pending/running app
  for (ApplicationAttemptId app : apps) {
    this.rmContext
        .getDispatcher()
        .getEventHandler()
        .handle(new RMAppEvent(app.getApplicationId(), RMAppEventType.KILL,
        "Application killed due to expiry of reservation queue " +
        queueName + "."));
  }
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:21,代码来源:AbstractYarnScheduler.java

示例6: transition

import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppEvent; //导入依赖的package包/类
@Override
public RMStateStoreState transition(RMStateStore store,
    RMStateStoreEvent event) {
  if (!(event instanceof RMStateStoreAppEvent)) {
    // should never happen
    LOG.error("Illegal event type: " + event.getClass());
    return RMStateStoreState.ACTIVE;
  }
  boolean isFenced = false;
  ApplicationStateData appState =
      ((RMStateStoreAppEvent) event).getAppState();
  ApplicationId appId =
      appState.getApplicationSubmissionContext().getApplicationId();
  LOG.info("Storing info for app: " + appId);
  try {
    store.storeApplicationStateInternal(appId, appState);
    store.notifyApplication(new RMAppEvent(appId,
           RMAppEventType.APP_NEW_SAVED));
  } catch (Exception e) {
    LOG.error("Error storing app: " + appId, e);
    isFenced = store.notifyStoreOperationFailedInternal(e);
  }
  return finalState(isFenced);
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:25,代码来源:RMStateStore.java

示例7: transition

import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppEvent; //导入依赖的package包/类
@Override
public void transition(RMStateStore store, RMStateStoreEvent event) {
  if (!(event instanceof RMStateStoreAppEvent)) {
    // should never happen
    LOG.error("Illegal event type: " + event.getClass());
    return;
  }
  ApplicationState appState = ((RMStateStoreAppEvent) event).getAppState();
  ApplicationId appId = appState.getAppId();
  ApplicationStateData appStateData = ApplicationStateData
      .newInstance(appState);
  LOG.info("Storing info for app: " + appId);
  try {
    store.storeApplicationStateInternal(appId, appStateData);
    store.notifyApplication(new RMAppEvent(appId,
           RMAppEventType.APP_NEW_SAVED));
  } catch (Exception e) {
    LOG.error("Error storing app: " + appId, e);
    store.notifyStoreOperationFailed(e);
  }
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:22,代码来源:RMStateStore.java

示例8: transition

import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppEvent; //导入依赖的package包/类
@Override
public void transition(RMAppAttemptImpl appAttempt,
                        RMAppAttemptEvent event) {
  appAttempt.checkAttemptStoreError(event);
  // Send the acceptance to the app
  // Ideally this should have been done when the scheduler accepted the app.
  // But its here because until the attempt is saved the client should not
  // launch the unmanaged AM. Client waits for the app status to be accepted
  // before doing so. So we have to delay the accepted state until we have 
  // completed storing the attempt
  appAttempt.eventHandler.handle(new RMAppEvent(event
      .getApplicationAttemptId().getApplicationId(),
      RMAppEventType.APP_ACCEPTED));
  
  super.transition(appAttempt, event);
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:17,代码来源:RMAppAttemptImpl.java

示例9: testMultipleAppAttempts

import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppEvent; //导入依赖的package包/类
@Test
public void testMultipleAppAttempts() throws JSONException, Exception {
  rm.start();
  MockNM amNodeManager = rm.registerNode("127.0.0.1:1234", 2048);
  RMApp app1 = rm.submitApp(1024, "testwordcount", "user1");
  amNodeManager.nodeHeartbeat(true);
  int maxAppAttempts = rm.getConfig().getInt(
      YarnConfiguration.RM_AM_MAX_ATTEMPTS,
      YarnConfiguration.DEFAULT_RM_AM_MAX_ATTEMPTS);
  assertTrue(maxAppAttempts > 1);
  int retriesLeft = maxAppAttempts;
  while (--retriesLeft > 0) {
    RMAppEvent event =
        new RMAppFailedAttemptEvent(app1.getApplicationId(),
            RMAppEventType.ATTEMPT_FAILED, "");
    app1.handle(event);
    rm.waitForState(app1.getApplicationId(), RMAppState.ACCEPTED);
    amNodeManager.nodeHeartbeat(true);
  }
  assertEquals("incorrect number of attempts", maxAppAttempts,
      app1.getAppAttempts().values().size());
  testAppAttemptsHelper(app1.getApplicationId().toString(), app1,
      MediaType.APPLICATION_JSON);
  rm.stop();
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:26,代码来源:TestRMWebServicesApps.java

示例10: transition

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

  RMAppAttemptRegistrationEvent registrationEvent
      = (RMAppAttemptRegistrationEvent) event;
  appAttempt.host = registrationEvent.getHost();
  appAttempt.rpcPort = registrationEvent.getRpcport();
  appAttempt.originalTrackingUrl =
      sanitizeTrackingUrl(registrationEvent.getTrackingurl());
  appAttempt.proxiedTrackingUrl = 
    appAttempt.generateProxyUriWithScheme(appAttempt.originalTrackingUrl);

  // Let the app know
  appAttempt.eventHandler.handle(new RMAppEvent(appAttempt
      .getAppAttemptId().getApplicationId(),
      RMAppEventType.ATTEMPT_REGISTERED));

  // TODO:FIXME: Note for future. Unfortunately we only do a state-store
  // write at AM launch time, so we don't save the AM's tracking URL anywhere
  // as that would mean an extra state-store write. For now, we hope that in
  // work-preserving restart, AMs are forced to reregister.

  appAttempt.rmContext.getRMApplicationHistoryWriter()
      .applicationAttemptStarted(appAttempt);
}
 
开发者ID:Seagate,项目名称:hadoop-on-lustre2,代码行数:27,代码来源:RMAppAttemptImpl.java

示例11: transition

import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppEvent; //导入依赖的package包/类
@Override
public void transition(RMAppAttemptImpl appAttempt,
    RMAppAttemptEvent event) {
  long delay = System.currentTimeMillis() - appAttempt.launchAMEndTime;
  ClusterMetrics.getMetrics().addAMRegisterDelay(delay);
  RMAppAttemptRegistrationEvent registrationEvent
      = (RMAppAttemptRegistrationEvent) event;
  appAttempt.host = registrationEvent.getHost();
  appAttempt.rpcPort = registrationEvent.getRpcport();
  appAttempt.originalTrackingUrl =
      sanitizeTrackingUrl(registrationEvent.getTrackingurl());

  // Let the app know
  appAttempt.eventHandler.handle(new RMAppEvent(appAttempt
      .getAppAttemptId().getApplicationId(),
      RMAppEventType.ATTEMPT_REGISTERED));

  // TODO:FIXME: Note for future. Unfortunately we only do a state-store
  // write at AM launch time, so we don't save the AM's tracking URL anywhere
  // as that would mean an extra state-store write. For now, we hope that in
  // work-preserving restart, AMs are forced to reregister.

  appAttempt.rmContext.getRMApplicationHistoryWriter()
      .applicationAttemptStarted(appAttempt);
  appAttempt.rmContext.getSystemMetricsPublisher()
      .appAttemptRegistered(appAttempt, System.currentTimeMillis());
}
 
开发者ID:naver,项目名称:hadoop,代码行数:28,代码来源:RMAppAttemptImpl.java

示例12: handle

import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppEvent; //导入依赖的package包/类
@Override
public void handle(RMAppEvent event) {
  ApplicationId appID = event.getApplicationId();
  RMApp rmApp = this.rmContext.getRMApps().get(appID);
  if (rmApp != null) {
    try {
      rmApp.handle(event);
    } catch (Throwable t) {
      LOG.error("Error in handling event type " + event.getType()
          + " for application " + appID, t);
    }
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:14,代码来源:ResourceManager.java

示例13: notifyApplication

import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppEvent; //导入依赖的package包/类
@SuppressWarnings("unchecked")
/**
 * This method is called to notify the application that
 * new application is stored or updated in state store
 * @param event App event containing the app id and event type
 */
private void notifyApplication(RMAppEvent event) {
  rmDispatcher.getEventHandler().handle(event);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:10,代码来源:RMStateStore.java

示例14: testAppRejectionWithCancelledDelegationToken

import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppEvent; //导入依赖的package包/类
@Test(timeout=60000)
public void testAppRejectionWithCancelledDelegationToken() throws Exception {
  MyFS dfs = (MyFS)FileSystem.get(conf);
  LOG.info("dfs="+(Object)dfs.hashCode() + ";conf="+conf.hashCode());

  MyToken token = dfs.getDelegationToken("user1");
  token.cancelToken();

  Credentials ts = new Credentials();
  ts.addToken(token.getKind(), token);
  
  // register the tokens for renewal
  ApplicationId appId =  BuilderUtils.newApplicationId(0, 0);
  delegationTokenRenewer.addApplicationAsync(appId, ts, true, "user");
  int waitCnt = 20;
  while (waitCnt-- >0) {
    if (!eventQueue.isEmpty()) {
      Event evt = eventQueue.take();
      if (evt.getType() == RMAppEventType.APP_REJECTED) {
        Assert.assertTrue(
            ((RMAppEvent) evt).getApplicationId().equals(appId));
        return;
      }
    } else {
      Thread.sleep(500);
    }
  }
  fail("App submission with a cancelled token should have failed");
}
 
开发者ID:naver,项目名称:hadoop,代码行数:30,代码来源:TestDelegationTokenRenewer.java

示例15: handle

import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppEvent; //导入依赖的package包/类
@Override
public void handle(RMAppEvent event) {
  assertEquals(application.getApplicationId(), event.getApplicationId());
  if (event instanceof RMAppFailedAttemptEvent) {
    transferStateFromPreviousAttempt =
        ((RMAppFailedAttemptEvent) event)
          .getTransferStateFromPreviousAttempt();
  }
  try {
    application.handle(event);
  } catch (Throwable t) {
    LOG.error("Error in handling event type " + event.getType()
        + " for application " + application.getApplicationId(), t);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:16,代码来源:TestRMAppAttemptTransitions.java


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