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


Java YarnConfiguration.setInt方法代碼示例

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


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

示例1: setup

import org.apache.hadoop.yarn.conf.YarnConfiguration; //導入方法依賴的package包/類
@Before
public void setup() {
  privilegedOperationExecutorMock = mock(PrivilegedOperationExecutor.class);
  cGroupsHandlerMock = mock(CGroupsHandler.class);
  trafficControllerMock = mock(TrafficController.class);
  conf = new YarnConfiguration();
  tmpPath = new StringBuffer(System.getProperty("test.build.data")).append
      ('/').append("hadoop.tmp.dir").toString();
  device = YarnConfiguration.DEFAULT_NM_NETWORK_RESOURCE_INTERFACE;
  containerIdMock = mock(ContainerId.class);
  containerMock = mock(Container.class);
  when(containerIdMock.toString()).thenReturn(TEST_CONTAINER_ID_STR);
  //mock returning a mock - an angel died somewhere.
  when(containerMock.getContainerId()).thenReturn(containerIdMock);

  conf.setInt(YarnConfiguration
      .NM_NETWORK_RESOURCE_OUTBOUND_BANDWIDTH_MBIT, ROOT_BANDWIDTH_MBIT);
  conf.setInt(YarnConfiguration
      .NM_NETWORK_RESOURCE_OUTBOUND_BANDWIDTH_YARN_MBIT, YARN_BANDWIDTH_MBIT);
  conf.set("hadoop.tmp.dir", tmpPath);
  //In these tests, we'll only use TrafficController with recovery disabled
  conf.setBoolean(YarnConfiguration.NM_RECOVERY_ENABLED, false);
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:24,代碼來源:TestTrafficControlBandwidthHandlerImpl.java

示例2: getRMStateStore

import org.apache.hadoop.yarn.conf.YarnConfiguration; //導入方法依賴的package包/類
@Override
public RMStateStore getRMStateStore() throws Exception {
  YarnConfiguration conf = new YarnConfiguration();
  conf.set(YarnConfiguration.FS_RM_STATE_STORE_URI,
      workingDirPathURI.toString());
  conf.set(YarnConfiguration.FS_RM_STATE_STORE_RETRY_POLICY_SPEC,
          "100,6000");
  conf.setInt(YarnConfiguration.FS_RM_STATE_STORE_NUM_RETRIES, 8);
  conf.setLong(YarnConfiguration.FS_RM_STATE_STORE_RETRY_INTERVAL_MS,
          900L);
  if (adminCheckEnable) {
    conf.setBoolean(
      YarnConfiguration.YARN_INTERMEDIATE_DATA_ENCRYPTION, true);
  }
  this.store = new TestFileSystemRMStore(conf);
  Assert.assertEquals(store.getNumRetries(), 8);
  Assert.assertEquals(store.getRetryInterval(), 900L);
  return store;
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:20,代碼來源:TestFSRMStateStore.java

示例3: setup

import org.apache.hadoop.yarn.conf.YarnConfiguration; //導入方法依賴的package包/類
@BeforeClass
public static void setup() throws Exception {
  YarnConfiguration conf = new YarnConfiguration();
  conf.setBoolean(YarnConfiguration.TIMELINE_SERVICE_ENABLED, true);
  conf.setBoolean(YarnConfiguration.RM_SYSTEM_METRICS_PUBLISHER_ENABLED, true);
  conf.setClass(YarnConfiguration.TIMELINE_SERVICE_STORE,
      MemoryTimelineStore.class, TimelineStore.class);
  conf.setClass(YarnConfiguration.TIMELINE_SERVICE_STATE_STORE_CLASS,
      MemoryTimelineStateStore.class, TimelineStateStore.class);
  conf.setInt(
      YarnConfiguration.RM_SYSTEM_METRICS_PUBLISHER_DISPATCHER_POOL_SIZE,
      2);

  timelineServer = new ApplicationHistoryServer();
  timelineServer.init(conf);
  timelineServer.start();
  store = timelineServer.getTimelineStore();

  metricsPublisher = new SystemMetricsPublisher();
  metricsPublisher.init(conf);
  metricsPublisher.start();
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:23,代碼來源:TestSystemMetricsPublisher.java

示例4: setup

import org.apache.hadoop.yarn.conf.YarnConfiguration; //導入方法依賴的package包/類
@Before
public void setup() throws IOException {
  failoverThread = null;
  keepRunning = true;
  conf = new YarnConfiguration();
  conf.setBoolean(YarnConfiguration.RM_HA_ENABLED, true);
  conf.setInt(YarnConfiguration.CLIENT_FAILOVER_MAX_ATTEMPTS, 5);
  conf.set(YarnConfiguration.RM_HA_IDS, RM1_NODE_ID + "," + RM2_NODE_ID);
  setRpcAddressForRM(RM1_NODE_ID, RM1_PORT_BASE);
  setRpcAddressForRM(RM2_NODE_ID, RM2_PORT_BASE);

  conf.setLong(YarnConfiguration.CLIENT_FAILOVER_SLEEPTIME_BASE_MS, 100L);

  conf.setBoolean(YarnConfiguration.YARN_MINICLUSTER_FIXED_PORTS, true);
  conf.setBoolean(YarnConfiguration.YARN_MINICLUSTER_USE_RPC, true);
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:17,代碼來源:ProtocolHATestBase.java

示例5: testNonMinZeroResourcesSettings

import org.apache.hadoop.yarn.conf.YarnConfiguration; //導入方法依賴的package包/類
@Test  
public void testNonMinZeroResourcesSettings() throws IOException {
  scheduler = new FairScheduler();
  YarnConfiguration conf = new YarnConfiguration();
  conf.setInt(YarnConfiguration.RM_SCHEDULER_MINIMUM_ALLOCATION_MB, 256);
  conf.setInt(YarnConfiguration.RM_SCHEDULER_MINIMUM_ALLOCATION_VCORES, 1);
  conf.setInt(YarnConfiguration.RM_SCHEDULER_MINIMUM_ALLOCATION_GCORES, 1);
  conf.setInt(
    FairSchedulerConfiguration.RM_SCHEDULER_INCREMENT_ALLOCATION_MB, 512);
  conf.setInt(
    FairSchedulerConfiguration.RM_SCHEDULER_INCREMENT_ALLOCATION_VCORES, 2);
  conf.setInt(
    FairSchedulerConfiguration.RM_SCHEDULER_INCREMENT_ALLOCATION_GCORES, 1);
  scheduler.init(conf);
  scheduler.reinitialize(conf, null);
  Assert.assertEquals(256, scheduler.getMinimumResourceCapability().getMemory());
  Assert.assertEquals(1, scheduler.getMinimumResourceCapability().getVirtualCores());
  Assert.assertEquals(1, scheduler.getMinimumResourceCapability().getGpuCores());
  Assert.assertEquals(512, scheduler.getIncrementResourceCapability().getMemory());
  Assert.assertEquals(2, scheduler.getIncrementResourceCapability().getVirtualCores());
  Assert.assertEquals(1, scheduler.getIncrementResourceCapability().getGpuCores());
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:23,代碼來源:TestFairScheduler.java

示例6: testMinZeroResourcesSettings

import org.apache.hadoop.yarn.conf.YarnConfiguration; //導入方法依賴的package包/類
@Test  
public void testMinZeroResourcesSettings() throws IOException {  
  scheduler = new FairScheduler();
  YarnConfiguration conf = new YarnConfiguration();
  conf.setInt(YarnConfiguration.RM_SCHEDULER_MINIMUM_ALLOCATION_MB, 0);
  conf.setInt(YarnConfiguration.RM_SCHEDULER_MINIMUM_ALLOCATION_VCORES, 0);
  conf.setInt(YarnConfiguration.RM_SCHEDULER_MINIMUM_ALLOCATION_GCORES, 0);
  conf.setInt(
    FairSchedulerConfiguration.RM_SCHEDULER_INCREMENT_ALLOCATION_MB, 512);
  conf.setInt(
    FairSchedulerConfiguration.RM_SCHEDULER_INCREMENT_ALLOCATION_VCORES, 2);
  conf.setInt(
    FairSchedulerConfiguration.RM_SCHEDULER_INCREMENT_ALLOCATION_GCORES, 1);
  scheduler.init(conf);
  scheduler.reinitialize(conf, null);
  Assert.assertEquals(0, scheduler.getMinimumResourceCapability().getMemory());
  Assert.assertEquals(0, scheduler.getMinimumResourceCapability().getVirtualCores());
  Assert.assertEquals(0, scheduler.getMinimumResourceCapability().getGpuCores());
  Assert.assertEquals(512, scheduler.getIncrementResourceCapability().getMemory());
  Assert.assertEquals(2, scheduler.getIncrementResourceCapability().getVirtualCores());
  Assert.assertEquals(1, scheduler.getIncrementResourceCapability().getGpuCores());
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:23,代碼來源:TestFairScheduler.java

示例7: setup

import org.apache.hadoop.yarn.conf.YarnConfiguration; //導入方法依賴的package包/類
@Before
public void setup() throws IOException {
  conf = new YarnConfiguration();
  conf.setBoolean(YarnConfiguration.RM_HA_ENABLED, true);
  conf.setBoolean(YarnConfiguration.AUTO_FAILOVER_ENABLED, true);
  conf.setBoolean(YarnConfiguration.AUTO_FAILOVER_EMBEDDED, true);
  conf.set(YarnConfiguration.RM_CLUSTER_ID, "yarn-test-cluster");
  conf.set(YarnConfiguration.RM_ZK_ADDRESS, hostPort);
  conf.setInt(YarnConfiguration.RM_ZK_TIMEOUT_MS, 2000);

  conf.set(YarnConfiguration.RM_HA_IDS, RM1_NODE_ID + "," + RM2_NODE_ID);
  conf.set(YarnConfiguration.RM_HA_ID, RM1_NODE_ID);
  setRpcAddressForRM(RM1_NODE_ID, RM1_PORT_BASE);
  setRpcAddressForRM(RM2_NODE_ID, RM2_PORT_BASE);

  conf.setLong(YarnConfiguration.CLIENT_FAILOVER_SLEEPTIME_BASE_MS, 100L);

  callbackCalled = new AtomicBoolean(false);
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:20,代碼來源:TestRMEmbeddedElector.java

示例8: getConfForCM

import org.apache.hadoop.yarn.conf.YarnConfiguration; //導入方法依賴的package包/類
private YarnConfiguration getConfForCM(boolean pMemEnabled,
    boolean vMemEnabled, int nmPmem, float vMemToPMemRatio) {
  YarnConfiguration conf = new YarnConfiguration();
  conf.setInt(YarnConfiguration.NM_PMEM_MB, nmPmem);
  conf.setBoolean(YarnConfiguration.NM_PMEM_CHECK_ENABLED, pMemEnabled);
  conf.setBoolean(YarnConfiguration.NM_VMEM_CHECK_ENABLED, vMemEnabled);
  conf.setFloat(YarnConfiguration.NM_VMEM_PMEM_RATIO, vMemToPMemRatio);
  return conf;
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:10,代碼來源:TestContainersMonitor.java

示例9: createNMConfig

import org.apache.hadoop.yarn.conf.YarnConfiguration; //導入方法依賴的package包/類
private YarnConfiguration createNMConfig() {
  YarnConfiguration conf = new YarnConfiguration();
  conf.setInt(YarnConfiguration.NM_PMEM_MB, 5*1024); // 5GB
  conf.set(YarnConfiguration.NM_ADDRESS, "127.0.0.1:12345");
  conf.set(YarnConfiguration.NM_LOCALIZER_ADDRESS, "127.0.0.1:12346");
  conf.set(YarnConfiguration.NM_LOG_DIRS, logsDir.getAbsolutePath());
  conf.set(YarnConfiguration.NM_REMOTE_APP_LOG_DIR, remoteLogsDir.getAbsolutePath());
  conf.set(YarnConfiguration.NM_LOCAL_DIRS, nmLocalDir.getAbsolutePath());
  conf.setLong(YarnConfiguration.NM_LOG_RETAIN_SECONDS, 1);
  return conf;
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:12,代碼來源:TestNodeManagerShutdown.java

示例10: testZKClientRetry

import org.apache.hadoop.yarn.conf.YarnConfiguration; //導入方法依賴的package包/類
@Test (timeout = 20000)
public void testZKClientRetry() throws Exception {
  TestZKClient zkClientTester = new TestZKClient();
  final String path = "/test";
  YarnConfiguration conf = new YarnConfiguration();
  conf.setInt(YarnConfiguration.RM_ZK_TIMEOUT_MS, ZK_TIMEOUT_MS);
  conf.setLong(YarnConfiguration.RM_ZK_RETRY_INTERVAL_MS, 100);
  final ZKRMStateStore store =
      (ZKRMStateStore) zkClientTester.getRMStateStore(conf);
  TestDispatcher dispatcher = new TestDispatcher();
  store.setRMDispatcher(dispatcher);
  final AtomicBoolean assertionFailedInThread = new AtomicBoolean(false);

  stopServer();
  Thread clientThread = new Thread() {
    @Override
    public void run() {
      try {
        store.getDataWithRetries(path, true);
      } catch (Exception e) {
        e.printStackTrace();
        assertionFailedInThread.set(true);
      }
    }
  };
  Thread.sleep(2000);
  startServer();
  clientThread.join();
  Assert.assertFalse(assertionFailedInThread.get());
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:31,代碼來源:TestZKRMStateStoreZKClientConnections.java

示例11: createNMConfig

import org.apache.hadoop.yarn.conf.YarnConfiguration; //導入方法依賴的package包/類
private YarnConfiguration createNMConfig() {
  YarnConfiguration conf = new YarnConfiguration();
  conf.setInt(YarnConfiguration.NM_PMEM_MB, 5 * 1024); // 5GB
  conf.set(YarnConfiguration.NM_ADDRESS, "127.0.0.1:12345");
  conf.set(YarnConfiguration.NM_LOCALIZER_ADDRESS, "127.0.0.1:12346");
  conf.set(YarnConfiguration.NM_LOG_DIRS, logsDir.getAbsolutePath());
  conf.set(YarnConfiguration.NM_LOCAL_DIRS, nmLocalDir.getAbsolutePath());
  conf.setLong(YarnConfiguration.NM_LOG_RETAIN_SECONDS, 1);
  return conf;
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:11,代碼來源:TestNodeManagerReboot.java

示例12: setup

import org.apache.hadoop.yarn.conf.YarnConfiguration; //導入方法依賴的package包/類
@BeforeClass
public static void setup() throws Exception {
  // start minicluster
  conf = new YarnConfiguration();
  conf.setLong(
    YarnConfiguration.RM_AMRM_TOKEN_MASTER_KEY_ROLLING_INTERVAL_SECS,
    rolling_interval_sec);
  conf.setLong(YarnConfiguration.RM_AM_EXPIRY_INTERVAL_MS, am_expire_ms);
  conf.setInt(YarnConfiguration.RM_NM_HEARTBEAT_INTERVAL_MS, 100);
  conf.setLong(YarnConfiguration.NM_LOG_RETAIN_SECONDS, 1);
  yarnCluster = new MiniYARNCluster(TestAMRMClient.class.getName(), nodeCount, 1, 1);
  yarnCluster.init(conf);
  yarnCluster.start();

  // start rm client
  yarnClient = YarnClient.createYarnClient();
  yarnClient.init(conf);
  yarnClient.start();

  // get node info
  nodeReports = yarnClient.getNodeReports(NodeState.RUNNING);
  
  priority = Priority.newInstance(1);
  priority2 = Priority.newInstance(2);
  capability = Resource.newInstance(1024, 1, 1);

  node = nodeReports.get(0).getNodeId().getHost();
  rack = nodeReports.get(0).getRackName();
  nodes = new String[]{ node };
  racks = new String[]{ rack };
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:32,代碼來源:TestAMRMClient.java

示例13: setup

import org.apache.hadoop.yarn.conf.YarnConfiguration; //導入方法依賴的package包/類
@Before
public void setup() throws UnknownHostException {
  Logger rootLogger = LogManager.getRootLogger();
  rootLogger.setLevel(Level.DEBUG);
  conf = new YarnConfiguration();
  UserGroupInformation.setConfiguration(conf);
  conf.setInt(YarnConfiguration.RM_AM_MAX_ATTEMPTS,
      YarnConfiguration.DEFAULT_RM_AM_MAX_ATTEMPTS);
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:10,代碼來源:TestContainerResourceUsage.java

示例14: testNonDefaultMinimumAllocation

import org.apache.hadoop.yarn.conf.YarnConfiguration; //導入方法依賴的package包/類
@Test
public void testNonDefaultMinimumAllocation() throws Exception {
  // Set custom min-alloc to test tweaking it
  int allocMB = 1536;
  YarnConfiguration conf = new YarnConfiguration(TestFifoScheduler.conf);
  conf.setInt(YarnConfiguration.RM_SCHEDULER_MINIMUM_ALLOCATION_MB, allocMB);
  conf.setInt(YarnConfiguration.RM_SCHEDULER_MAXIMUM_ALLOCATION_MB,
      allocMB * 10);
  // Test for something lesser than this.
  testMinimumAllocation(conf, allocMB / 2);
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:12,代碼來源:TestFifoScheduler.java

示例15: testZKAuths

import org.apache.hadoop.yarn.conf.YarnConfiguration; //導入方法依賴的package包/類
@Test
public void testZKAuths() throws Exception {
  TestZKClient zkClientTester = new TestZKClient();
  YarnConfiguration conf = new YarnConfiguration();
  conf.setInt(YarnConfiguration.RM_ZK_NUM_RETRIES, 1);
  conf.setInt(YarnConfiguration.RM_ZK_TIMEOUT_MS, ZK_TIMEOUT_MS);
  conf.set(YarnConfiguration.RM_ZK_ACL, TEST_ACL);
  conf.set(YarnConfiguration.RM_ZK_AUTH, TEST_AUTH_GOOD);

  zkClientTester.getRMStateStore(conf);
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:12,代碼來源:TestZKRMStateStoreZKClientConnections.java


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