コード例 #1
0
 static {
   try {
     propertyParser = new PropertyParser(ConfigVars.DEFAULT_PROPS_FILE);
     propertyParser.parsePropsFile();
   } catch (IOException e) {
     LOG.error(
         "Unable to load property file: "
             + propertyParser.getProperty(ConfigVars.DEFAULT_PROPS_FILE));
   }
 }
コード例 #2
0
 @Test
 public void testWithHdfsDefaultFs() {
   MRLocalCluster mrLocalCluster =
       new MRLocalCluster.Builder()
           .setNumNodeManagers(
               Integer.parseInt(propertyParser.getProperty(ConfigVars.YARN_NUM_NODE_MANAGERS_KEY)))
           .setJobHistoryAddress(propertyParser.getProperty(ConfigVars.MR_JOB_HISTORY_ADDRESS_KEY))
           .setResourceManagerAddress(
               propertyParser.getProperty(ConfigVars.YARN_RESOURCE_MANAGER_ADDRESS_KEY))
           .setResourceManagerHostname(
               propertyParser.getProperty(ConfigVars.YARN_RESOURCE_MANAGER_HOSTNAME_KEY))
           .setResourceManagerSchedulerAddress(
               propertyParser.getProperty(ConfigVars.YARN_RESOURCE_MANAGER_SCHEDULER_ADDRESS_KEY))
           .setResourceManagerResourceTrackerAddress(
               propertyParser.getProperty(
                   ConfigVars.YARN_RESOURCE_MANAGER_RESOURCE_TRACKER_ADDRESS_KEY))
           .setResourceManagerWebappAddress(
               propertyParser.getProperty(ConfigVars.YARN_RESOURCE_MANAGER_WEBAPP_ADDRESS_KEY))
           .setUseInJvmContainerExecutor(
               Boolean.parseBoolean(
                   propertyParser.getProperty(ConfigVars.YARN_USE_IN_JVM_CONTAINER_EXECUTOR_KEY)))
           .setHdfsDefaultFs("hdfs://localhost:8020/")
           .setConfig(new Configuration())
           .build();
   assertEquals("hdfs://localhost:8020/", mrLocalCluster.getHdfsDefaultFs());
 }
コード例 #3
0
 @Test
 public void testUseInJvmContainerExecutor() {
   assertEquals(
       Boolean.parseBoolean(
           propertyParser.getProperty(ConfigVars.YARN_USE_IN_JVM_CONTAINER_EXECUTOR_KEY)),
       mrLocalCluster.getUseInJvmContainerExecutor());
 }
コード例 #4
0
 @BeforeClass
 public static void setUp() throws IOException {
   mrLocalCluster =
       new MRLocalCluster.Builder()
           .setNumNodeManagers(
               Integer.parseInt(propertyParser.getProperty(ConfigVars.YARN_NUM_NODE_MANAGERS_KEY)))
           .setJobHistoryAddress(propertyParser.getProperty(ConfigVars.MR_JOB_HISTORY_ADDRESS_KEY))
           .setResourceManagerAddress(
               propertyParser.getProperty(ConfigVars.YARN_RESOURCE_MANAGER_ADDRESS_KEY))
           .setResourceManagerHostname(
               propertyParser.getProperty(ConfigVars.YARN_RESOURCE_MANAGER_HOSTNAME_KEY))
           .setResourceManagerSchedulerAddress(
               propertyParser.getProperty(ConfigVars.YARN_RESOURCE_MANAGER_SCHEDULER_ADDRESS_KEY))
           .setResourceManagerResourceTrackerAddress(
               propertyParser.getProperty(
                   ConfigVars.YARN_RESOURCE_MANAGER_RESOURCE_TRACKER_ADDRESS_KEY))
           .setResourceManagerWebappAddress(
               propertyParser.getProperty(ConfigVars.YARN_RESOURCE_MANAGER_WEBAPP_ADDRESS_KEY))
           .setUseInJvmContainerExecutor(
               Boolean.parseBoolean(
                   propertyParser.getProperty(ConfigVars.YARN_USE_IN_JVM_CONTAINER_EXECUTOR_KEY)))
           .setConfig(new Configuration())
           .build();
 }
コード例 #5
0
 @Test
 public void testMissingConf() {
   exception.expect(IllegalArgumentException.class);
   MRLocalCluster mrLocalCluster =
       new MRLocalCluster.Builder()
           .setNumNodeManagers(
               Integer.parseInt(propertyParser.getProperty(ConfigVars.YARN_NUM_NODE_MANAGERS_KEY)))
           .setJobHistoryAddress(propertyParser.getProperty(ConfigVars.MR_JOB_HISTORY_ADDRESS_KEY))
           .setResourceManagerAddress(
               propertyParser.getProperty(ConfigVars.YARN_RESOURCE_MANAGER_ADDRESS_KEY))
           .setResourceManagerHostname(
               propertyParser.getProperty(ConfigVars.YARN_RESOURCE_MANAGER_HOSTNAME_KEY))
           .setResourceManagerSchedulerAddress(
               propertyParser.getProperty(ConfigVars.YARN_RESOURCE_MANAGER_SCHEDULER_ADDRESS_KEY))
           .setResourceManagerResourceTrackerAddress(
               propertyParser.getProperty(
                   ConfigVars.YARN_RESOURCE_MANAGER_RESOURCE_TRACKER_ADDRESS_KEY))
           .setResourceManagerWebappAddress(
               propertyParser.getProperty(ConfigVars.YARN_RESOURCE_MANAGER_WEBAPP_ADDRESS_KEY))
           .setUseInJvmContainerExecutor(
               Boolean.parseBoolean(
                   propertyParser.getProperty(ConfigVars.YARN_USE_IN_JVM_CONTAINER_EXECUTOR_KEY)))
           .build();
 }
コード例 #6
0
 @Test
 public void testWithInJvmContainerExecutor() throws Exception {
   MRLocalCluster mrLocalCluster =
       new MRLocalCluster.Builder()
           .setNumNodeManagers(
               Integer.parseInt(propertyParser.getProperty(ConfigVars.YARN_NUM_NODE_MANAGERS_KEY)))
           .setJobHistoryAddress(propertyParser.getProperty(ConfigVars.MR_JOB_HISTORY_ADDRESS_KEY))
           .setResourceManagerAddress(
               propertyParser.getProperty(ConfigVars.YARN_RESOURCE_MANAGER_ADDRESS_KEY))
           .setResourceManagerHostname(
               propertyParser.getProperty(ConfigVars.YARN_RESOURCE_MANAGER_HOSTNAME_KEY))
           .setResourceManagerSchedulerAddress(
               propertyParser.getProperty(ConfigVars.YARN_RESOURCE_MANAGER_SCHEDULER_ADDRESS_KEY))
           .setResourceManagerResourceTrackerAddress(
               propertyParser.getProperty(
                   ConfigVars.YARN_RESOURCE_MANAGER_RESOURCE_TRACKER_ADDRESS_KEY))
           .setResourceManagerWebappAddress(
               propertyParser.getProperty(ConfigVars.YARN_RESOURCE_MANAGER_WEBAPP_ADDRESS_KEY))
           .setUseInJvmContainerExecutor(true)
           .setConfig(new Configuration())
           .build();
   mrLocalCluster.configure();
   assertEquals(true, mrLocalCluster.getUseInJvmContainerExecutor());
 }
コード例 #7
0
 @Test
 public void testNumNodeManagers() {
   assertEquals(
       Integer.parseInt(propertyParser.getProperty(ConfigVars.YARN_NUM_NODE_MANAGERS_KEY)),
       (int) mrLocalCluster.getNumNodeManagers());
 }
コード例 #8
0
 @Test
 public void testResourceManagerWebAppAddress() {
   assertEquals(
       propertyParser.getProperty(ConfigVars.YARN_RESOURCE_MANAGER_WEBAPP_ADDRESS_KEY),
       mrLocalCluster.getResourceManagerWebappAddress());
 }
コード例 #9
0
 @Test
 public void testResourceManagerResourceTrackerAddress() {
   assertEquals(
       propertyParser.getProperty(ConfigVars.YARN_RESOURCE_MANAGER_RESOURCE_TRACKER_ADDRESS_KEY),
       mrLocalCluster.getResourceManagerResourceTrackerAddress());
 }
コード例 #10
0
 @Test
 public void testResourceManagerSchedulerAddress() {
   assertEquals(
       propertyParser.getProperty(ConfigVars.YARN_RESOURCE_MANAGER_SCHEDULER_ADDRESS_KEY),
       mrLocalCluster.getResourceManagerSchedulerAddress());
 }
コード例 #11
0
 @Test
 public void testResourceManagerHostname() {
   assertEquals(
       propertyParser.getProperty(ConfigVars.YARN_RESOURCE_MANAGER_HOSTNAME_KEY),
       mrLocalCluster.getResourceManagerHostname());
 }
コード例 #12
0
 @Test
 public void testJobHistoryAddress() {
   assertEquals(
       propertyParser.getProperty(ConfigVars.MR_JOB_HISTORY_ADDRESS_KEY),
       mrLocalCluster.getJobHistoryAddress());
 }