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

Java RMStateStore类代码示例

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

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



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

示例1: recoverAppAttemptCredentials

import org.apache.hadoop.yarn.server.resourcemanager.recovery.RMStateStore; //导入依赖的package包/类
private void recoverAppAttemptCredentials(Credentials appAttemptTokens,
    RMAppAttemptState state) {
  if (appAttemptTokens == null || state == RMAppAttemptState.FAILED
      || state == RMAppAttemptState.FINISHED
      || state == RMAppAttemptState.KILLED) {
    return;
  }

  if (UserGroupInformation.isSecurityEnabled()) {
    byte[] clientTokenMasterKeyBytes = appAttemptTokens.getSecretKey(
        RMStateStore.AM_CLIENT_TOKEN_MASTER_KEY_NAME);
    if (clientTokenMasterKeyBytes != null) {
      clientTokenMasterKey = rmContext.getClientToAMTokenSecretManager()
          .registerMasterKey(applicationAttemptId, clientTokenMasterKeyBytes);
    }
  }

  setAMRMToken(rmContext.getAMRMTokenSecretManager().createAndGetAMRMToken(
      applicationAttemptId));
}
 
开发者ID:naver,项目名称:hadoop,代码行数:21,代码来源:RMAppAttemptImpl.java


示例2: serviceStop

import org.apache.hadoop.yarn.server.resourcemanager.recovery.RMStateStore; //导入依赖的package包/类
@Override
protected void serviceStop() throws Exception {

  DefaultMetricsSystem.shutdown();

  if (rmContext != null) {
    RMStateStore store = rmContext.getStateStore();
    try {
      store.close();
    } catch (Exception e) {
      LOG.error("Error closing store.", e);
    }
  }

  super.serviceStop();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:17,代码来源:ResourceManager.java


示例3: serviceStop

import org.apache.hadoop.yarn.server.resourcemanager.recovery.RMStateStore; //导入依赖的package包/类
@Override
protected void serviceStop() throws Exception {

  super.serviceStop();

  DefaultMetricsSystem.shutdown();
  if (rmContext != null) {
    RMStateStore store = rmContext.getStateStore();
    try {
      if (null != store) {
        store.close();
      }
    } catch (Exception e) {
      LOG.error("Error closing store.", e);
    }
  }

}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:19,代码来源:ResourceManager.java


示例4: recoverAppAttemptCredentials

import org.apache.hadoop.yarn.server.resourcemanager.recovery.RMStateStore; //导入依赖的package包/类
private void recoverAppAttemptCredentials(Credentials appAttemptTokens,
    RMAppAttemptState state) {
  if (appAttemptTokens == null || state == RMAppAttemptState.FAILED
      || state == RMAppAttemptState.FINISHED
      || state == RMAppAttemptState.KILLED) {
    return;
  }

  if (UserGroupInformation.isSecurityEnabled()) {
    byte[] clientTokenMasterKeyBytes = appAttemptTokens.getSecretKey(
        RMStateStore.AM_CLIENT_TOKEN_MASTER_KEY_NAME);
    if (clientTokenMasterKeyBytes != null) {
      clientTokenMasterKey = rmContext.getClientToAMTokenSecretManager()
          .registerMasterKey(applicationAttemptId, clientTokenMasterKeyBytes);
    }
  }

  this.amrmToken =
      rmContext.getAMRMTokenSecretManager().createAndGetAMRMToken(
        applicationAttemptId);
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:22,代码来源:RMAppAttemptImpl.java


示例5: serviceStart

import org.apache.hadoop.yarn.server.resourcemanager.recovery.RMStateStore; //导入依赖的package包/类
@Override
protected void serviceStart() throws Exception {
  RMStateStore rmStore = rmContext.getStateStore();
  // The state store needs to start irrespective of recoveryEnabled as apps
  // need events to move to further states.
  rmStore.start();

  if(recoveryEnabled) {
    try {
      rmStore.checkVersion();
      if (rmContext.isWorkPreservingRecoveryEnabled()) {
        rmContext.setEpoch(rmStore.getAndIncrementEpoch());
      }
      RMState state = rmStore.loadState();
      recover(state);
    } catch (Exception e) {
      // the Exception from loadState() needs to be handled for
      // HA and we need to give up master status if we got fenced
      LOG.error("Failed to load/recover state", e);
      throw e;
    }
  }

  super.serviceStart();
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:26,代码来源:ResourceManager.java


示例6: recoverAppAttemptTokens

import org.apache.hadoop.yarn.server.resourcemanager.recovery.RMStateStore; //导入依赖的package包/类
private void recoverAppAttemptTokens(Credentials appAttemptTokens) {
  if (appAttemptTokens == null) {
    return;
  }
  if (UserGroupInformation.isSecurityEnabled()) {

    ClientToAMTokenSelector clientToAMTokenSelector =
        new ClientToAMTokenSelector();
    this.clientToAMToken =
        clientToAMTokenSelector.selectToken(new Text(),
          appAttemptTokens.getAllTokens());
  }

  // Only one AMRMToken is stored per-attempt, so this should be fine. Can't
  // use TokenSelector as service may change - think fail-over.
  this.amrmToken =
      (Token<AMRMTokenIdentifier>) appAttemptTokens
        .getToken(RMStateStore.AM_RM_TOKEN_SERVICE);

  // For now, no need to populate tokens back to AMRMTokenSecretManager,
  // because running attempts are rebooted. Later in work-preserve restart,
  // we'll create NEW->RUNNING transition in which the restored tokens will be
  // added to the secret manager
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:25,代码来源:RMAppAttemptImpl.java


示例7: transition

import org.apache.hadoop.yarn.server.resourcemanager.recovery.RMStateStore; //导入依赖的package包/类
@Override
public void transition(RMAppAttemptImpl appAttempt,
                                                 RMAppAttemptEvent event) {
  // Acquire the AM container from the scheduler.
  Allocation amContainerAllocation = appAttempt.scheduler.allocate(
      appAttempt.applicationAttemptId, EMPTY_CONTAINER_REQUEST_LIST,
      EMPTY_CONTAINER_RELEASE_LIST, null, null);

  // Set the masterContainer
  appAttempt.setMasterContainer(amContainerAllocation.getContainers().get(
                                                                       0));
  appAttempt.getSubmissionContext().setResource(
      appAttempt.getMasterContainer().getResource());
  RMStateStore store = appAttempt.rmContext.getStateStore();
  appAttempt.storeAttempt(store);
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:17,代码来源:RMAppAttemptImpl.java


示例8: finishApplication

import org.apache.hadoop.yarn.server.resourcemanager.recovery.RMStateStore; //导入依赖的package包/类
protected synchronized void finishApplication(ApplicationId applicationId) {
  if (applicationId == null) {
    LOG.error("RMAppManager received completed appId of null, skipping");
  } else {
    // Inform the DelegationTokenRenewer
    if (UserGroupInformation.isSecurityEnabled()) {
      rmContext.getDelegationTokenRenewer().applicationFinished(applicationId);
    }
    
    completedApps.add(applicationId);  
    writeAuditLog(applicationId);
    
    // application completely done. Remove from state
    RMStateStore store = rmContext.getStateStore();
    store.removeApplication(rmContext.getRMApps().get(applicationId));
  }
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:18,代码来源:RMAppManager.java


示例9: RMContextImpl

import org.apache.hadoop.yarn.server.resourcemanager.recovery.RMStateStore; //导入依赖的package包/类
public RMContextImpl(Dispatcher rmDispatcher,
    RMStateStore store,
    ContainerAllocationExpirer containerAllocationExpirer,
    AMLivelinessMonitor amLivelinessMonitor,
    AMLivelinessMonitor amFinishingMonitor,
    DelegationTokenRenewer tokenRenewer,
    AMRMTokenSecretManager amRMTokenSecretManager,
    RMContainerTokenSecretManager containerTokenSecretManager,
    NMTokenSecretManagerInRM nmTokenSecretManager,
    ClientToAMTokenSecretManagerInRM clientToAMTokenSecretManager) {
  this.rmDispatcher = rmDispatcher;
  this.stateStore = store;
  this.containerAllocationExpirer = containerAllocationExpirer;
  this.amLivelinessMonitor = amLivelinessMonitor;
  this.amFinishingMonitor = amFinishingMonitor;
  this.tokenRenewer = tokenRenewer;
  this.amRMTokenSecretManager = amRMTokenSecretManager;
  this.containerTokenSecretManager = containerTokenSecretManager;
  this.nmTokenSecretManager = nmTokenSecretManager;
  this.clientToAMTokenSecretManager = clientToAMTokenSecretManager;
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:22,代码来源:RMContextImpl.java


示例10: serviceStop

import org.apache.hadoop.yarn.server.resourcemanager.recovery.RMStateStore; //导入依赖的package包/类
@Override
protected void serviceStop() throws Exception {

  super.serviceStop();

  if (pauseMonitor != null) {
    pauseMonitor.stop();
  }

  DefaultMetricsSystem.shutdown();
  if (rmContext != null) {
    RMStateStore store = rmContext.getStateStore();
    try {
      if (null != store) {
        store.close();
      }
    } catch (Exception e) {
      LOG.error("Error closing store.", e);
    }
  }

}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:23,代码来源:ResourceManager.java


示例11: recoverAppAttemptCredentials

import org.apache.hadoop.yarn.server.resourcemanager.recovery.RMStateStore; //导入依赖的package包/类
private void recoverAppAttemptCredentials(Credentials appAttemptTokens)
    throws IOException {
  if (appAttemptTokens == null) {
    return;
  }

  if (UserGroupInformation.isSecurityEnabled()) {
    byte[] clientTokenMasterKeyBytes = appAttemptTokens.getSecretKey(
        RMStateStore.AM_CLIENT_TOKEN_MASTER_KEY_NAME);
    clientTokenMasterKey = rmContext.getClientToAMTokenSecretManager()
        .registerMasterKey(applicationAttemptId, clientTokenMasterKeyBytes);
  }

  // Only one AMRMToken is stored per-attempt, so this should be fine. Can't
  // use TokenSelector as service may change - think fail-over.
  this.amrmToken =
      (Token<AMRMTokenIdentifier>) appAttemptTokens
        .getToken(RMStateStore.AM_RM_TOKEN_SERVICE);
  rmContext.getAMRMTokenSecretManager().addPersistedPassword(this.amrmToken);
}
 
开发者ID:chendave,项目名称:hadoop-TCP,代码行数:21,代码来源:RMAppAttemptImpl.java


示例12: RMContextImpl

import org.apache.hadoop.yarn.server.resourcemanager.recovery.RMStateStore; //导入依赖的package包/类
public RMContextImpl(Dispatcher rmDispatcher,
    RMStateStore store,
    ContainerAllocationExpirer containerAllocationExpirer,
    AMLivelinessMonitor amLivelinessMonitor,
    AMLivelinessMonitor amFinishingMonitor,
    DelegationTokenRenewer delegationTokenRenewer,
    AMRMTokenSecretManager amRMTokenSecretManager,
    RMContainerTokenSecretManager containerTokenSecretManager,
    NMTokenSecretManagerInRM nmTokenSecretManager,
    ClientToAMTokenSecretManagerInRM clientToAMTokenSecretManager) {
  this.rmDispatcher = rmDispatcher;
  this.stateStore = store;
  this.containerAllocationExpirer = containerAllocationExpirer;
  this.amLivelinessMonitor = amLivelinessMonitor;
  this.amFinishingMonitor = amFinishingMonitor;
  this.delegationTokenRenewer = delegationTokenRenewer;
  this.amRMTokenSecretManager = amRMTokenSecretManager;
  this.containerTokenSecretManager = containerTokenSecretManager;
  this.nmTokenSecretManager = nmTokenSecretManager;
  this.clientToAMTokenSecretManager = clientToAMTokenSecretManager;
}
 
开发者ID:chendave,项目名称:hadoop-TCP,代码行数:22,代码来源:RMContextImpl.java


示例13: serviceStart

import org.apache.hadoop.yarn.server.resourcemanager.recovery.RMStateStore; //导入依赖的package包/类
@Override
protected void serviceStart() throws Exception {
  RMStateStore rmStore = rmContext.getStateStore();
  // The state store needs to start irrespective of recoveryEnabled as apps
  // need events to move to further states.
  rmStore.start();

  if(recoveryEnabled) {
    try {
      rmStore.checkVersion();
      RMState state = rmStore.loadState();
      recover(state);
    } catch (Exception e) {
      // the Exception from loadState() needs to be handled for
      // HA and we need to give up master status if we got fenced
      LOG.error("Failed to load/recover state", e);
      throw e;
    }
  }

  super.serviceStart();
}
 
开发者ID:Seagate,项目名称:hadoop-on-lustre2,代码行数:23,代码来源:ResourceManager.java


示例14: mockRMContext

import org.apache.hadoop.yarn.server.resourcemanager.recovery.RMStateStore; //导入依赖的package包/类
public static RMContext mockRMContext(int n, long time) {
  final List<RMApp> apps = newRMApps(n, time, RMAppState.FINISHED);
  final ConcurrentMap<ApplicationId, RMApp> map = Maps.newConcurrentMap();
  for (RMApp app : apps) {
    map.put(app.getApplicationId(), app);
  }
  Dispatcher rmDispatcher = new AsyncDispatcher();
  ContainerAllocationExpirer containerAllocationExpirer = new ContainerAllocationExpirer(
      rmDispatcher);
  AMLivelinessMonitor amLivelinessMonitor = new AMLivelinessMonitor(
      rmDispatcher);
  AMLivelinessMonitor amFinishingMonitor = new AMLivelinessMonitor(
      rmDispatcher);
  RMApplicationHistoryWriter writer = mock(RMApplicationHistoryWriter.class);
  RMContext context = new RMContextImpl(rmDispatcher,
      containerAllocationExpirer, amLivelinessMonitor, amFinishingMonitor,
      null, null, null, null, null, writer) {
    @Override
    public ConcurrentMap<ApplicationId, RMApp> getRMApps() {
      return map;
    }
  };
  ((RMContextImpl)context).setStateStore(mock(RMStateStore.class));
  return context;
}
 
开发者ID:Seagate,项目名称:hadoop-on-lustre2,代码行数:26,代码来源:TestAppManager.java


示例15: serviceStart

import org.apache.hadoop.yarn.server.resourcemanager.recovery.RMStateStore; //导入依赖的package包/类
@Override
protected void serviceStart() throws Exception {
  RMStateStore rmStore = rmContext.getStateStore();
  // The state store needs to start irrespective of recoveryEnabled as apps
  // need events to move to further states.
  rmStore.start();

  if(recoveryEnabled) {
    try {
      LOG.info("Recovery started");
      rmStore.checkVersion();
      if (rmContext.isWorkPreservingRecoveryEnabled()) {
        rmContext.setEpoch(rmStore.getAndIncrementEpoch());
      }
      RMState state = rmStore.loadState();
      recover(state);
      LOG.info("Recovery ended");
    } catch (Exception e) {
      // the Exception from loadState() needs to be handled for
      // HA and we need to give up master status if we got fenced
      LOG.error("Failed to load/recover state", e);
      throw e;
    }
  }

  super.serviceStart();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:28,代码来源:ResourceManager.java


示例16: deleteRMStateStore

import org.apache.hadoop.yarn.server.resourcemanager.recovery.RMStateStore; //导入依赖的package包/类
/**
 * Deletes the RMStateStore
 *
 * @param conf
 * @throws Exception
 */
private static void deleteRMStateStore(Configuration conf) throws Exception {
  RMStateStore rmStore = RMStateStoreFactory.getStore(conf);
  rmStore.init(conf);
  rmStore.start();
  try {
    LOG.info("Deleting ResourceManager state store...");
    rmStore.deleteStore();
    LOG.info("State store deleted");
  } finally {
    rmStore.stop();
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:19,代码来源:ResourceManager.java


示例17: mockRMContext

import org.apache.hadoop.yarn.server.resourcemanager.recovery.RMStateStore; //导入依赖的package包/类
public RMContext mockRMContext(int n, long time) {
  final List<RMApp> apps = newRMApps(n, time, RMAppState.FINISHED);
  final ConcurrentMap<ApplicationId, RMApp> map = Maps.newConcurrentMap();
  for (RMApp app : apps) {
    map.put(app.getApplicationId(), app);
  }
  Dispatcher rmDispatcher = new AsyncDispatcher();
  ContainerAllocationExpirer containerAllocationExpirer = new ContainerAllocationExpirer(
      rmDispatcher);
  AMLivelinessMonitor amLivelinessMonitor = new AMLivelinessMonitor(
      rmDispatcher);
  AMLivelinessMonitor amFinishingMonitor = new AMLivelinessMonitor(
      rmDispatcher);
  RMApplicationHistoryWriter writer = mock(RMApplicationHistoryWriter.class);
  RMContext context = new RMContextImpl(rmDispatcher,
      containerAllocationExpirer, amLivelinessMonitor, amFinishingMonitor,
      null, null, null, null, null, writer) {
    @Override
    public ConcurrentMap<ApplicationId, RMApp> getRMApps() {
      return map;
    }
  };
  ((RMContextImpl)context).setStateStore(mock(RMStateStore.class));
  metricsPublisher = mock(SystemMetricsPublisher.class);
  ((RMContextImpl)context).setSystemMetricsPublisher(metricsPublisher);
  return context;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:28,代码来源:TestAppManager.java


示例18: MockRM

import org.apache.hadoop.yarn.server.resourcemanager.recovery.RMStateStore; //导入依赖的package包/类
public MockRM(Configuration conf, RMStateStore store,
    boolean useNullRMNodeLabelsManager) {
  super();
  this.useNullRMNodeLabelsManager = useNullRMNodeLabelsManager;
  init(conf instanceof YarnConfiguration ? conf : new YarnConfiguration(conf));
  if(store != null) {
    setRMStateStore(store);
  }
  Logger rootLogger = LogManager.getRootLogger();
  rootLogger.setLevel(Level.DEBUG);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:12,代码来源:MockRM.java


示例19: removeApplication

import org.apache.hadoop.yarn.server.resourcemanager.recovery.RMStateStore; //导入依赖的package包/类
private static void removeApplication(Configuration conf, String applicationId)
    throws Exception {
  RMStateStore rmStore = RMStateStoreFactory.getStore(conf);
  rmStore.init(conf);
  rmStore.start();
  try {
    ApplicationId removeAppId = ConverterUtils.toApplicationId(applicationId);
    LOG.info("Deleting application " + removeAppId + " from state store");
    rmStore.removeApplication(removeAppId);
    LOG.info("Application is deleted from state store");
  } finally {
    rmStore.stop();
  }
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:15,代码来源:ResourceManager.java


示例20: mockRMContext

import org.apache.hadoop.yarn.server.resourcemanager.recovery.RMStateStore; //导入依赖的package包/类
public RMContext mockRMContext(int n, long time) {
  final List<RMApp> apps = newRMApps(n, time, RMAppState.FINISHED);
  final ConcurrentMap<ApplicationId, RMApp> map = Maps.newConcurrentMap();
  for (RMApp app : apps) {
    map.put(app.getApplicationId(), app);
  }
  Dispatcher rmDispatcher = new AsyncDispatcher();
  ContainerAllocationExpirer containerAllocationExpirer = new ContainerAllocationExpirer(
      rmDispatcher);
  AMLivelinessMonitor amLivelinessMonitor = new AMLivelinessMonitor(
      rmDispatcher);
  AMLivelinessMonitor amFinishingMonitor = new AMLivelinessMonitor(
      rmDispatcher);
  RMApplicationHistoryWriter writer = mock(RMApplicationHistoryWriter.class);
  RMContext context = new RMContextImpl(rmDispatcher,
      containerAllocationExpirer, amLivelinessMonitor, amFinishingMonitor,
      null, null, null, null, null) {
    @Override
    public ConcurrentMap<ApplicationId, RMApp> getRMApps() {
      return map;
    }
  };
  ((RMContextImpl)context).setStateStore(mock(RMStateStore.class));
  metricsPublisher = mock(SystemMetricsPublisher.class);
  context.setSystemMetricsPublisher(metricsPublisher);
  context.setRMApplicationHistoryWriter(writer);
  return context;
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:29,代码来源:TestAppManager.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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