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


Java ResourceManager.init方法代码示例

本文整理汇总了Java中org.apache.hadoop.yarn.server.resourcemanager.ResourceManager.init方法的典型用法代码示例。如果您正苦于以下问题:Java ResourceManager.init方法的具体用法?Java ResourceManager.init怎么用?Java ResourceManager.init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.yarn.server.resourcemanager.ResourceManager的用法示例。


在下文中一共展示了ResourceManager.init方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setUp

import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager; //导入方法依赖的package包/类
@Before
public void setUp() throws IOException {
  scheduler = new FairScheduler();
  
  Configuration conf = new YarnConfiguration();
  conf.setClass(YarnConfiguration.RM_SCHEDULER, FairScheduler.class,
      ResourceScheduler.class);
  conf.set("yarn.scheduler.fair.event-log-enabled", "true");

  // All tests assume only one assignment per node update
  conf.set(FairSchedulerConfiguration.ASSIGN_MULTIPLE, "false");
  resourceManager = new ResourceManager();
  resourceManager.init(conf);
  ((AsyncDispatcher)resourceManager.getRMContext().getDispatcher()).start();
  scheduler.init(conf);
  scheduler.start();
  scheduler.reinitialize(conf, resourceManager.getRMContext());
}
 
开发者ID:naver,项目名称:hadoop,代码行数:19,代码来源:TestFairSchedulerEventLog.java

示例2: setUp

import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager; //导入方法依赖的package包/类
@Before
public void setUp() throws IOException {
  scheduler = new FairScheduler();
  conf = createConfiguration();
  resourceManager = new ResourceManager();
  resourceManager.init(conf);

  // TODO: This test should really be using MockRM. For now starting stuff
  // that is needed at a bare minimum.
  ((AsyncDispatcher)resourceManager.getRMContext().getDispatcher()).start();
  resourceManager.getRMContext().getStateStore().start();

  // to initialize the master key
  resourceManager.getRMContext().getContainerTokenSecretManager().rollMasterKey();

  scheduler.setRMContext(resourceManager.getRMContext());
}
 
开发者ID:naver,项目名称:hadoop,代码行数:18,代码来源:TestFairScheduler.java

示例3: setUp

import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
  resourceManager = new ResourceManager() {
    @Override
    protected RMNodeLabelsManager createNodeLabelManager() {
      RMNodeLabelsManager mgr = new NullRMNodeLabelsManager();
      mgr.init(getConfig());
      return mgr;
    }
  };
  CapacitySchedulerConfiguration csConf 
     = new CapacitySchedulerConfiguration();
  setupQueueConfiguration(csConf);
  YarnConfiguration conf = new YarnConfiguration(csConf);
  conf.setClass(YarnConfiguration.RM_SCHEDULER, 
      CapacityScheduler.class, ResourceScheduler.class);
  resourceManager.init(conf);
  resourceManager.getRMContext().getContainerTokenSecretManager().rollMasterKey();
  resourceManager.getRMContext().getNMTokenSecretManager().rollMasterKey();
  ((AsyncDispatcher)resourceManager.getRMContext().getDispatcher()).start();
  mockContext = mock(RMContext.class);
  when(mockContext.getConfigurationProvider()).thenReturn(
      new LocalConfigurationProvider());
}
 
开发者ID:naver,项目名称:hadoop,代码行数:25,代码来源:TestCapacityScheduler.java

示例4: setup

import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager; //导入方法依赖的package包/类
public void setup() {
  resourceManager = new ResourceManager() {
    @Override
    protected RMNodeLabelsManager createNodeLabelManager() {
      RMNodeLabelsManager mgr = new NullRMNodeLabelsManager();
      mgr.init(getConfig());
      return mgr;
    }
  };

  YarnConfiguration conf = new YarnConfiguration();
  conf.setClass(YarnConfiguration.RM_SCHEDULER, CapacityScheduler.class,
    ResourceScheduler.class);
  resourceManager.init(conf);
  resourceManager.getRMContext().getContainerTokenSecretManager()
    .rollMasterKey();
  resourceManager.getRMContext().getNMTokenSecretManager().rollMasterKey();
  ((AsyncDispatcher) resourceManager.getRMContext().getDispatcher()).start();
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:20,代码来源:TestSchedulerHealth.java

示例5: startRM

import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager; //导入方法依赖的package包/类
private void startRM() throws IOException, ClassNotFoundException {
  Configuration rmConf = new YarnConfiguration();
  String schedulerClass = rmConf.get(YarnConfiguration.RM_SCHEDULER);

  // For CapacityScheduler we use a sub-classing instead of wrapping
  // to allow scheduler-specific invocations from monitors to work
  // this can be used for other schedulers as well if we care to
  // exercise/track behaviors that are not common to the scheduler api
  if(Class.forName(schedulerClass) == CapacityScheduler.class) {
    rmConf.set(YarnConfiguration.RM_SCHEDULER,
        SLSCapacityScheduler.class.getName());
  } else {
    rmConf.set(YarnConfiguration.RM_SCHEDULER,
            ResourceSchedulerWrapper.class.getName());
    rmConf.set(SLSConfiguration.RM_SCHEDULER, schedulerClass);
  }

  rmConf.set(SLSConfiguration.METRICS_OUTPUT_DIR, metricsOutputDir);
  rm = new ResourceManager();
  rm.init(rmConf);
  rm.start();
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:23,代码来源:SLSRunner.java

示例6: setUp

import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
  resourceManager = new ResourceManager();
  Configuration conf = new Configuration();
  conf.setClass(YarnConfiguration.RM_SCHEDULER, 
      FifoScheduler.class, ResourceScheduler.class);
  resourceManager.init(conf);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:9,代码来源:TestFifoScheduler.java

示例7: testRMStarts

import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager; //导入方法依赖的package包/类
@Test(timeout = 10000)
public void testRMStarts() {
  Configuration conf = new YarnConfiguration();
  conf.setBoolean(YarnConfiguration.RM_SCHEDULER_ENABLE_MONITORS, true);
  conf.set(YarnConfiguration.RM_SCHEDULER_MONITOR_POLICIES,
      ProportionalCapacityPreemptionPolicy.class.getCanonicalName());

  ResourceManager rm = new ResourceManager();
  try {
    rm.init(conf);
  } catch (Exception e) {
    fail("ResourceManager does not start when " +
        YarnConfiguration.RM_SCHEDULER_ENABLE_MONITORS + " is set to true");
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:16,代码来源:TestSchedulingMonitor.java

示例8: testClientStop

import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager; //导入方法依赖的package包/类
@Test
public void testClientStop() {
  Configuration conf = new Configuration();
  ResourceManager rm = new ResourceManager();
  rm.init(conf);
  rm.start();

  YarnClient client = YarnClient.createYarnClient();
  client.init(conf);
  client.start();
  client.stop();
  rm.stop();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:14,代码来源:TestYarnClient.java

示例9: setUpResourceManager

import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager; //导入方法依赖的package包/类
@BeforeClass
public static void setUpResourceManager() throws IOException, InterruptedException {
  conf = new YarnConfiguration();
  resourceManager = new ResourceManager() {
    @Override
    protected void doSecureLogin() throws IOException {
    };
  };
  resourceManager.init(conf);
  new Thread() {
    public void run() {
      resourceManager.start();
    };
  }.start();
  int waitCount = 0;
  while (resourceManager.getServiceState() == STATE.INITED
      && waitCount++ < 10) {
    LOG.info("Waiting for RM to start...");
    Thread.sleep(1000);
  }
  if (resourceManager.getServiceState() != STATE.STARTED) {
    throw new IOException(
        "ResourceManager failed to start. Final state is "
            + resourceManager.getServiceState());
  }
  LOG.info("ResourceManager RMAdmin address: " +
      conf.get(YarnConfiguration.RM_ADMIN_ADDRESS));
}
 
开发者ID:naver,项目名称:hadoop,代码行数:29,代码来源:TestGetGroups.java

示例10: setUpResourceManager

import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager; //导入方法依赖的package包/类
/**
 * Start resource manager server
 */

@BeforeClass
public static void setUpResourceManager() throws IOException,
        InterruptedException {
  Configuration.addDefaultResource("config-with-security.xml");
  Configuration configuration = new YarnConfiguration();
  resourceManager = new ResourceManager() {
    @Override
    protected void doSecureLogin() throws IOException {
    }
  };
  resourceManager.init(configuration);
  new Thread() {
    public void run() {
      resourceManager.start();
    }
  }.start();
  int waitCount = 0;
  while (resourceManager.getServiceState() == STATE.INITED
          && waitCount++ < 10) {
    LOG.info("Waiting for RM to start...");
    Thread.sleep(1000);
  }
  if (resourceManager.getServiceState() != STATE.STARTED) {
    throw new IOException("ResourceManager failed to start. Final state is "
            + resourceManager.getServiceState());
  }
  LOG.info("ResourceManager RMAdmin address: "
          + configuration.get(YarnConfiguration.RM_ADMIN_ADDRESS));

  client = new ResourceManagerAdministrationProtocolPBClientImpl(1L,
          getProtocolAddress(configuration), configuration);

}
 
开发者ID:naver,项目名称:hadoop,代码行数:38,代码来源:TestResourceManagerAdministrationProtocolPBClientImpl.java

示例11: startRM

import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager; //导入方法依赖的package包/类
private void startRM() throws IOException, ClassNotFoundException {
  Configuration rmConf = new YarnConfiguration();
  String schedulerClass = rmConf.get(YarnConfiguration.RM_SCHEDULER);
  rmConf.set(SLSConfiguration.RM_SCHEDULER, schedulerClass);
  rmConf.set(YarnConfiguration.RM_SCHEDULER,
          ResourceSchedulerWrapper.class.getName());
  rmConf.set(SLSConfiguration.METRICS_OUTPUT_DIR, metricsOutputDir);
  rm = new ResourceManager();
  rm.init(rmConf);
  rm.start();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:12,代码来源:SLSRunner.java

示例12: setup

import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager; //导入方法依赖的package包/类
@Before
public void setup() {
  conf = new YarnConfiguration();
  conf.set(YarnConfiguration.RM_SCHEDULER,
      "org.apache.hadoop.yarn.sls.scheduler.ResourceSchedulerWrapper");
  conf.set(SLSConfiguration.RM_SCHEDULER,
      "org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FairScheduler");
  conf.setBoolean(SLSConfiguration.METRICS_SWITCH, false);
  rm = new ResourceManager();
  rm.init(conf);
  rm.start();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:13,代码来源:TestNMSimulator.java

示例13: testRMStarts

import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager; //导入方法依赖的package包/类
@Test(timeout = 10000)
public void testRMStarts() {
  Configuration conf = new YarnConfiguration();
  conf.setBoolean(YarnConfiguration.RM_SCHEDULER_ENABLE_MONITORS, true);
  conf.set(YarnConfiguration.RM_SCHEDULER_MONITOR_POLICIES,
      ProportionalCapacityPreemptionPolicy.class.getCanonicalName());

  ResourceManager rm = new MockRM();
  try {
    rm.init(conf);
  } catch (Exception e) {
    fail("ResourceManager does not start when " +
        YarnConfiguration.RM_SCHEDULER_ENABLE_MONITORS + " is set to true");
  }
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:16,代码来源:TestSchedulingMonitor.java

示例14: testMoveAppViolateQueueState

import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager; //导入方法依赖的package包/类
@Test(expected = YarnException.class)
public void testMoveAppViolateQueueState() throws Exception {
  resourceManager = new ResourceManager() {
     @Override
      protected RMNodeLabelsManager createNodeLabelManager() {
        RMNodeLabelsManager mgr = new NullRMNodeLabelsManager();
        mgr.init(getConfig());
        return mgr;
      }
  };
  CapacitySchedulerConfiguration csConf =
      new CapacitySchedulerConfiguration();
  setupQueueConfiguration(csConf);
  StringBuilder qState = new StringBuilder();
  qState.append(CapacitySchedulerConfiguration.PREFIX).append(B)
      .append(CapacitySchedulerConfiguration.DOT)
      .append(CapacitySchedulerConfiguration.STATE);
  csConf.set(qState.toString(), QueueState.STOPPED.name());
  YarnConfiguration conf = new YarnConfiguration(csConf);
  conf.setClass(YarnConfiguration.RM_SCHEDULER, CapacityScheduler.class,
      ResourceScheduler.class);
  resourceManager.init(conf);
  resourceManager.getRMContext().getContainerTokenSecretManager()
      .rollMasterKey();
  resourceManager.getRMContext().getNMTokenSecretManager().rollMasterKey();
  ((AsyncDispatcher) resourceManager.getRMContext().getDispatcher()).start();
  mockContext = mock(RMContext.class);
  when(mockContext.getConfigurationProvider()).thenReturn(
      new LocalConfigurationProvider());

  ResourceScheduler scheduler = resourceManager.getResourceScheduler();

  // Register node1
  String host_0 = "host_0";
  NodeManager nm_0 =
      registerNode(host_0, 1234, 2345, NetworkTopology.DEFAULT_RACK,
          Resources.createResource(6 * GB, 1));

  // ResourceRequest priorities
  Priority priority_0 =
      org.apache.hadoop.yarn.server.resourcemanager.resource.Priority
          .create(0);
  Priority priority_1 =
      org.apache.hadoop.yarn.server.resourcemanager.resource.Priority
          .create(1);

  // Submit application_0
  Application application_0 =
      new Application("user_0", "a1", resourceManager);
  application_0.submit(); // app + app attempt event sent to scheduler

  application_0.addNodeManager(host_0, 1234, nm_0);

  Resource capability_0_0 = Resources.createResource(3 * GB, 1);
  application_0.addResourceRequestSpec(priority_1, capability_0_0);

  Resource capability_0_1 = Resources.createResource(2 * GB, 1);
  application_0.addResourceRequestSpec(priority_0, capability_0_1);

  Task task_0_0 =
      new Task(application_0, priority_1, new String[] { host_0 });
  application_0.addTask(task_0_0);

  // Send resource requests to the scheduler
  application_0.schedule(); // allocate

  // task_0_0 allocated
  nodeUpdate(nm_0);

  // Get allocations from the scheduler
  application_0.schedule(); // task_0_0
  checkApplicationResourceUsage(3 * GB, application_0);

  checkNodeResourceUsage(3 * GB, nm_0);
  // b2 queue contains 3GB consumption app,
  // add another 3GB will hit max capacity limit on queue b
  scheduler.moveApplication(application_0.getApplicationId(), "b1");

}
 
开发者ID:naver,项目名称:hadoop,代码行数:80,代码来源:TestCapacityScheduler.java

示例15: testFencing

import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void testFencing() throws Exception {
  StateChangeRequestInfo req = new StateChangeRequestInfo(
      HAServiceProtocol.RequestSource.REQUEST_BY_USER);

  Configuration conf1 = createHARMConf("rm1,rm2", "rm1", 1234);
  conf1.setBoolean(YarnConfiguration.AUTO_FAILOVER_ENABLED, false);
  ResourceManager rm1 = new ResourceManager();
  rm1.init(conf1);
  rm1.start();
  rm1.getRMContext().getRMAdminService().transitionToActive(req);
  assertEquals("RM with ZKStore didn't start",
      Service.STATE.STARTED, rm1.getServiceState());
  assertEquals("RM should be Active",
      HAServiceProtocol.HAServiceState.ACTIVE,
      rm1.getRMContext().getRMAdminService().getServiceStatus().getState());

  Configuration conf2 = createHARMConf("rm1,rm2", "rm2", 5678);
  conf2.setBoolean(YarnConfiguration.AUTO_FAILOVER_ENABLED, false);
  ResourceManager rm2 = new ResourceManager();
  rm2.init(conf2);
  rm2.start();
  rm2.getRMContext().getRMAdminService().transitionToActive(req);
  assertEquals("RM with ZKStore didn't start",
      Service.STATE.STARTED, rm2.getServiceState());
  assertEquals("RM should be Active",
      HAServiceProtocol.HAServiceState.ACTIVE,
      rm2.getRMContext().getRMAdminService().getServiceStatus().getState());

  for (int i = 0; i < ZK_TIMEOUT_MS / 50; i++) {
    if (HAServiceProtocol.HAServiceState.ACTIVE ==
        rm1.getRMContext().getRMAdminService().getServiceStatus().getState()) {
      Thread.sleep(100);
    }
  }
  assertEquals("RM should have been fenced",
      HAServiceProtocol.HAServiceState.STANDBY,
      rm1.getRMContext().getRMAdminService().getServiceStatus().getState());
  assertEquals("RM should be Active",
      HAServiceProtocol.HAServiceState.ACTIVE,
      rm2.getRMContext().getRMAdminService().getServiceStatus().getState());
}
 
开发者ID:naver,项目名称:hadoop,代码行数:44,代码来源:TestZKRMStateStore.java


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