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


Java ContainerLaunchContext.getCommands方法代碼示例

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


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

示例1: testAMProfiler

import org.apache.hadoop.yarn.api.records.ContainerLaunchContext; //導入方法依賴的package包/類
@Test(timeout=20000)
public void testAMProfiler() throws Exception {
  JobConf jobConf = new JobConf();

  jobConf.setBoolean(MRJobConfig.MR_AM_PROFILE, true);

  YARNRunner yarnRunner = new YARNRunner(jobConf);

  ApplicationSubmissionContext submissionContext =
      buildSubmitContext(yarnRunner, jobConf);

  ContainerLaunchContext containerSpec = submissionContext.getAMContainerSpec();
  List<String> commands = containerSpec.getCommands();

  for(String command : commands) {
    if (command != null) {
      if (command.contains(PROFILE_PARAMS)) {
        return;
      }
    }
  }
  throw new IllegalStateException("Profiler opts not found!");
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:24,代碼來源:TestYARNRunner.java

示例2: testAMAdminCommandOpts

import org.apache.hadoop.yarn.api.records.ContainerLaunchContext; //導入方法依賴的package包/類
@Test(timeout=20000)
public void testAMAdminCommandOpts() throws Exception {
  JobConf jobConf = new JobConf();
  
  jobConf.set(MRJobConfig.MR_AM_ADMIN_COMMAND_OPTS, "-Djava.net.preferIPv4Stack=true");
  jobConf.set(MRJobConfig.MR_AM_COMMAND_OPTS, "-Xmx1024m");
  
  YARNRunner yarnRunner = new YARNRunner(jobConf);
  
  ApplicationSubmissionContext submissionContext =
      buildSubmitContext(yarnRunner, jobConf);
  
  ContainerLaunchContext containerSpec = submissionContext.getAMContainerSpec();
  List<String> commands = containerSpec.getCommands();
  
  int index = 0;
  int adminIndex = 0;
  int adminPos = -1;
  int userIndex = 0;
  int userPos = -1;
  
  for(String command : commands) {
    if(command != null) {
      assertFalse("Profiler should be disabled by default",
          command.contains(PROFILE_PARAMS));
      adminPos = command.indexOf("-Djava.net.preferIPv4Stack=true");
      if(adminPos >= 0)
        adminIndex = index;
      
      userPos = command.indexOf("-Xmx1024m");
      if(userPos >= 0)
        userIndex = index;
    }
    
    index++;
  }
  
  // Check both admin java opts and user java opts are in the commands
  assertTrue("AM admin command opts not in the commands.", adminPos > 0);
  assertTrue("AM user command opts not in the commands.", userPos > 0);
  
  // Check the admin java opts is before user java opts in the commands
  if(adminIndex == userIndex) {
    assertTrue("AM admin command opts is after user command opts.", adminPos < userPos);
  } else {
    assertTrue("AM admin command opts is after user command opts.", adminIndex < userIndex);
  }
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:49,代碼來源:TestYARNRunner.java

示例3: testAMAdminCommandOpts

import org.apache.hadoop.yarn.api.records.ContainerLaunchContext; //導入方法依賴的package包/類
@Test(timeout=20000)
public void testAMAdminCommandOpts() throws Exception {
  JobConf jobConf = new JobConf();
  
  jobConf.set(MRJobConfig.MR_AM_ADMIN_COMMAND_OPTS, "-Djava.net.preferIPv4Stack=true");
  jobConf.set(MRJobConfig.MR_AM_COMMAND_OPTS, "-Xmx1024m");
  
  YARNRunner yarnRunner = new YARNRunner(jobConf);
  
  ApplicationSubmissionContext submissionContext =
      buildSubmitContext(yarnRunner, jobConf);
  
  ContainerLaunchContext containerSpec = submissionContext.getAMContainerSpec();
  List<String> commands = containerSpec.getCommands();
  
  int index = 0;
  int adminIndex = 0;
  int adminPos = -1;
  int userIndex = 0;
  int userPos = -1;
  int tmpDirPos = -1;

  for(String command : commands) {
    if(command != null) {
      assertFalse("Profiler should be disabled by default",
          command.contains(PROFILE_PARAMS));
      adminPos = command.indexOf("-Djava.net.preferIPv4Stack=true");
      if(adminPos >= 0)
        adminIndex = index;
      
      userPos = command.indexOf("-Xmx1024m");
      if(userPos >= 0)
        userIndex = index;

      tmpDirPos = command.indexOf("-Djava.io.tmpdir=");
    }
    
    index++;
  }

  // Check java.io.tmpdir opts are set in the commands
  assertTrue("java.io.tmpdir is not set for AM", tmpDirPos > 0);

  // Check both admin java opts and user java opts are in the commands
  assertTrue("AM admin command opts not in the commands.", adminPos > 0);
  assertTrue("AM user command opts not in the commands.", userPos > 0);
  
  // Check the admin java opts is before user java opts in the commands
  if(adminIndex == userIndex) {
    assertTrue("AM admin command opts is after user command opts.", adminPos < userPos);
  } else {
    assertTrue("AM admin command opts is after user command opts.", adminIndex < userIndex);
  }
}
 
開發者ID:aliyun-beta,項目名稱:aliyun-oss-hadoop-fs,代碼行數:55,代碼來源:TestYARNRunner.java


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