Examples of MRAdmin


Examples of org.apache.hadoop.mapred.tools.MRAdmin

    public MRCmdExecutor(String jobtracker) {
      this.jobtracker = jobtracker;
    }
    @Override
    protected void execute(final String cmd) throws Exception{
      MRAdmin mradmin = new MRAdmin();
      String[] args = getCommandAsArgs(cmd, "JOBTRACKER", jobtracker);
      ToolRunner.run(mradmin, args);
    }
View Full Code Here

Examples of org.apache.hadoop.mapred.tools.MRAdmin

    }
  }
 
  @Test
  public void testGroupMappingRefresh() throws Exception {
    MRAdmin admin = new MRAdmin(config);
    String [] args = new String[] { "-refreshUserToGroupsMappings" };
   
    Groups groups = Groups.getUserToGroupsMappingService(config);
    String user = UserGroupInformation.getLoginUser().getShortUserName();
    System.out.println("first attempt:");
    List<String> g1 = groups.getGroups(user);
    String [] str_groups = new String [g1.size()];
    g1.toArray(str_groups);
    System.out.println(Arrays.toString(str_groups));
   
    System.out.println("second attempt, should be same:");
    List<String> g2 = groups.getGroups(user);
    g2.toArray(str_groups);
    System.out.println(Arrays.toString(str_groups));
    for(int i=0; i<g2.size(); i++) {
      assertEquals("Should be same group ", g1.get(i), g2.get(i));
    }
    // run refresh command
    admin.run(args);
   
    System.out.println("third attempt(after refresh command), should be different:");
    List<String> g3 = groups.getGroups(user);
    g3.toArray(str_groups);
    System.out.println(Arrays.toString(str_groups));
View Full Code Here

Examples of org.apache.hadoop.mapred.tools.MRAdmin

    // add additional resource with the new value
    // so the server side will pick it up
    String rsrc = "testRefreshSuperUserGroupsConfiguration_rsrc.xml";
    addNewConfigResource(rsrc, userKeyGroups, "gr2", userKeyHosts, "127.0.0.1")
   
    MRAdmin admin = new MRAdmin(config);
    String [] args = new String[]{"-refreshSuperUserGroupsConfiguration"};
    admin.run(args);
   
    try {
      ProxyUsers.authorize(ugi2, "127.0.0.1", config);
      fail("second auth for " + ugi2.getShortUserName() + " should've failed ");
    } catch (AuthorizationException e) {
View Full Code Here

Examples of org.apache.hadoop.mapred.tools.MRAdmin

    }
  }
 
  @Test
  public void testGroupMappingRefresh() throws Exception {
    MRAdmin admin = new MRAdmin(config);
    String [] args = new String[] { "-refreshUserToGroupsMappings" };
   
    Groups groups = Groups.getUserToGroupsMappingService(config);
    String user = UserGroupInformation.getLoginUser().getShortUserName();
    System.out.println("first attempt:");
    List<String> g1 = groups.getGroups(user);
    String [] str_groups = new String [g1.size()];
    g1.toArray(str_groups);
    System.out.println(Arrays.toString(str_groups));
   
    System.out.println("second attempt, should be same:");
    List<String> g2 = groups.getGroups(user);
    g2.toArray(str_groups);
    System.out.println(Arrays.toString(str_groups));
    for(int i=0; i<g2.size(); i++) {
      assertEquals("Should be same group ", g1.get(i), g2.get(i));
    }
    // run refresh command
    admin.run(args);
   
    System.out.println("third attempt(after refresh command), should be different:");
    List<String> g3 = groups.getGroups(user);
    g3.toArray(str_groups);
    System.out.println(Arrays.toString(str_groups));
View Full Code Here

Examples of org.apache.hadoop.mapred.tools.MRAdmin

    // add additional resource with the new value
    // so the server side will pick it up
    String rsrc = "testRefreshSuperUserGroupsConfiguration_rsrc.xml";
    addNewConfigResource(rsrc, userKeyGroups, "gr2", userKeyHosts, "127.0.0.1")

    MRAdmin admin = new MRAdmin(config);
    String [] args = new String[]{"-refreshSuperUserGroupsConfiguration"};
    admin.run(args);

    try {
      ProxyUsers.authorize(ugi2, "127.0.0.1", config);
      fail("second auth for " + ugi2.getShortUserName() + " should've failed ");
    } catch (AuthorizationException e) {
View Full Code Here

Examples of org.apache.hadoop.mapred.tools.MRAdmin

    PrintStream origErr = System.err;
   
    System.setOut(new PrintStream(bao));
    System.setErr(new PrintStream(bao));
   
    MRAdmin mradmin = new MRAdmin();
    String[] args = getCommandAsArgs(cmd, "JOBTRACKER", jobtracker);
    cmdExecuted = cmd;
  
    try {
      ToolRunner.run(mradmin, args);
View Full Code Here

Examples of org.apache.hadoop.mapred.tools.MRAdmin

     
      // Start the mini mr cluster
      mr = new MiniMRCluster(1, "file:///", 1, null, null, conf);

      // Invoke MRAdmin commands
      MRAdmin mrAdmin = new MRAdmin(mr.createJobConf());
      assertEquals(0, mrAdmin.run(new String[] { "-refreshQueues" }));
      assertEquals(0, mrAdmin.run(new String[] { "-refreshNodes" }));
    } finally {
      if (mr != null) {
        mr.shutdown();
      }
    }
View Full Code Here

Examples of org.apache.hadoop.mapred.tools.MRAdmin

     
      // Start the mini mr cluster
      mr = new MiniMRCluster(1, "file:///", 1, null, null, conf);

      // Invoke MRAdmin commands
      MRAdmin mrAdmin = new MRAdmin(mr.createJobConf());
      assertEquals(0, mrAdmin.run(new String[] { "-refreshQueues" }));
      assertEquals(0, mrAdmin.run(new String[] { "-refreshNodes" }));
    } finally {
      if (mr != null) {
        mr.shutdown();
      }
    }
View Full Code Here

Examples of org.apache.hadoop.mapred.tools.MRAdmin

    // test for refresh
    deleteQueuesConfigFile();
    Document doc = createDocument();
    refreshDocument(doc);
    writeToFile(doc, QUEUES_CONFIG_FILE_PATH);
    MRAdmin admin = new MRAdmin(miniMRCluster.createJobConf());
    admin.run(new String[] { "-refreshQueues" });
    try {
      submitSleepJob(10, 10, 100, 100, false, "u1,g1", "p1"
          + NAME_SEPARATOR + "p11", conf);
      fail("user u1 is not in the submit jobs' list");
    } catch (Exception e) {
    }
    deleteQueuesConfigFile();
    doc = createDocument();
    createSimpleDocumentWithAcls(doc);
    writeToFile(doc, QUEUES_CONFIG_FILE_PATH);
    admin.run(new String[] { "-refreshQueues" });
  }
View Full Code Here

Examples of org.apache.hadoop.mapred.tools.MRAdmin

    }
  }
 
  @Test
  public void testGroupMappingRefresh() throws Exception {
    MRAdmin admin = new MRAdmin(config);
    String [] args = new String[] { "-refreshUserToGroupsMappings" };
   
    Groups groups = Groups.getUserToGroupsMappingService(config);
    String user = UserGroupInformation.getLoginUser().getShortUserName();
    System.out.println("first attempt:");
    List<String> g1 = groups.getGroups(user);
    String [] str_groups = new String [g1.size()];
    g1.toArray(str_groups);
    System.out.println(Arrays.toString(str_groups));
   
    System.out.println("second attempt, should be same:");
    List<String> g2 = groups.getGroups(user);
    g2.toArray(str_groups);
    System.out.println(Arrays.toString(str_groups));
    for(int i=0; i<g2.size(); i++) {
      assertEquals("Should be same group ", g1.get(i), g2.get(i));
    }
    // run refresh command
    admin.run(args);
   
    System.out.println("third attempt(after refresh command), should be different:");
    List<String> g3 = groups.getGroups(user);
    g3.toArray(str_groups);
    System.out.println(Arrays.toString(str_groups));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.