Package org.apache.hadoop.mapreduce.test.system

Examples of org.apache.hadoop.mapreduce.test.system.TaskInfo


   * terminated based on timeout.
   */
  @Test
  public void testProcessTreeCleanupOfSuspendTask() throws
      Exception {
    TaskInfo taskInfo = null;
    TaskID tID = null;
    TTTaskInfo [] ttTaskinfo = null;
    String pid = null;
    TTProtocol ttIns = null;
    TTClient ttClientIns = null;
    int counter = 0;

    JobConf jobConf = new JobConf(conf);
    jobConf.setJobName("Message Display");
    jobConf.setJarByClass(GenerateTaskChildProcess.class);
    jobConf.setMapperClass(GenerateTaskChildProcess.StrDisplayMapper.class);
    jobConf.setNumMapTasks(1);
    jobConf.setNumReduceTasks(0);
    jobConf.setMaxMapAttempts(1);
    cleanup(outputDir, conf);
    FileInputFormat.setInputPaths(jobConf, inputDir);
    FileOutputFormat.setOutputPath(jobConf, outputDir);

    JTClient jtClient = cluster.getJTClient();
    JobClient client = jtClient.getClient();
    JTProtocol wovenClient = cluster.getJTClient().getProxy();
    RunningJob runJob = client.submitJob(jobConf);
    JobID id = runJob.getID();
    JobInfo jInfo = wovenClient.getJobInfo(id);
    Assert.assertNotNull("Job information is null",jInfo);

    Assert.assertTrue("Job has not been started for 1 min.",
  jtClient.isJobStarted(id));
    JobStatus[] jobStatus = client.getAllJobs();
    String userName = jobStatus[0].getUsername();

    TaskInfo[] taskInfos = wovenClient.getTaskInfo(id);
    for (TaskInfo taskinfo : taskInfos) {
      if (!taskinfo.isSetupOrCleanup()) {
        taskInfo = taskinfo;
        break;
      }
    }

    Assert.assertTrue("Task has not been started for 1 min.",
        jtClient.isTaskStarted(taskInfo));

    tID = TaskID.downgrade(taskInfo.getTaskID());
    TaskAttemptID tAttID = new TaskAttemptID(tID,0);
    FinishTaskControlAction action = new FinishTaskControlAction(tID);

    Collection<TTClient> ttClients = cluster.getTTClients();
    for (TTClient ttClient : ttClients) {
View Full Code Here


   * is suspended and resumed the task before the timeout.
   */
  @Test
  public void testProcessTreeCleanupOfSuspendAndResumeTask() throws
      Exception {
    TaskInfo taskInfo = null;
    TaskID tID = null;
    TTTaskInfo [] ttTaskinfo = null;
    String pid = null;
    TTProtocol ttIns = null;
    TTClient ttClientIns = null;
    int counter = 0;

    JobConf jobConf = new JobConf(conf);
    jobConf.setJobName("Message Display");
    jobConf.setJarByClass(GenerateTaskChildProcess.class);
    jobConf.setMapperClass(GenerateTaskChildProcess.StrDisplayMapper.class);
    jobConf.setNumMapTasks(1);
    jobConf.setNumReduceTasks(0);
    jobConf.setMaxMapAttempts(1);
    cleanup(outputDir, conf);
    FileInputFormat.setInputPaths(jobConf, inputDir);
    FileOutputFormat.setOutputPath(jobConf, outputDir);

    JTClient jtClient = cluster.getJTClient();
    JobClient client = jtClient.getClient();
    JTProtocol wovenClient = cluster.getJTClient().getProxy();
    RunningJob runJob = client.submitJob(jobConf);
    JobID id = runJob.getID();
    JobInfo jInfo = wovenClient.getJobInfo(id);
    Assert.assertNotNull("Job information is null",jInfo);

    Assert.assertTrue("Job has not been started for 1 min.",
        jtClient.isJobStarted(id));

    JobStatus[] jobStatus = client.getAllJobs();
    String userName = jobStatus[0].getUsername();

    TaskInfo[] taskInfos = wovenClient.getTaskInfo(id);
    for (TaskInfo taskinfo : taskInfos) {
      if (!taskinfo.isSetupOrCleanup()) {
        taskInfo = taskinfo;
        break;
      }
    }

    Assert.assertTrue("Task has not been started for 1 min.",
        jtClient.isTaskStarted(taskInfo));

    tID = TaskID.downgrade(taskInfo.getTaskID());
    TaskAttemptID tAttID = new TaskAttemptID(tID,0);
    FinishTaskControlAction action = new FinishTaskControlAction(tID);
   
    Collection<TTClient> ttClients = cluster.getTTClients();
    for (TTClient ttClient : ttClients) {
View Full Code Here

    }
  }
 
  private JobStatus verifyLostTaskTrackerJobStatus(String testName)
      throws IOException{
    TaskInfo taskInfo = null;
    TaskID tID = null;
    String[] taskTrackers = null;
    TaskInfo[] taskInfos = wovenClient.getTaskInfo(jID);
    for (TaskInfo taskinfo : taskInfos) {
      if (!taskinfo.isSetupOrCleanup()) {
        taskInfo = taskinfo;
        break;
      }
    }
    Assert.assertTrue("Task has not been started for 1 min.",
            jtClient.isTaskStarted(taskInfo));
    tID = TaskID.downgrade(taskInfo.getTaskID());
    TTClient ttClient = getTTClientIns(taskInfo);
    int counter = 0;
    while (counter < 30) {
      if (ttClient != null) {
        break;
      }else{
         taskInfo = wovenClient.getTaskInfo(taskInfo.getTaskID())
         ttClient = getTTClientIns(taskInfo);
      }
      counter ++;
    }
    Assert.assertNotNull("TaskTracker has not been found",ttClient);
    if (testName.equals("LTT1")) {
        ttClient.kill();
        waitForTTStop(ttClient);
        UtilsForTests.waitFor(20000);
        ttClient.start();
        waitForTTStart(ttClient);
    } else {
       int index = 0 ;
       while(index++ < 4 ) {
           ttClient.kill();
           waitForTTStop(ttClient);
           UtilsForTests.waitFor(40000);
           ttClient.start();
           waitForTTStart(ttClient);
           taskInfo = wovenClient.getTaskInfo(taskInfo.getTaskID());
           ttClient = getTTClientIns(taskInfo);
           counter = 0;
           while (counter < 30) {
             if (ttClient != null) {
               break;
             }else{
                taskInfo = wovenClient.getTaskInfo(taskInfo.getTaskID())
                ttClient = getTTClientIns(taskInfo);
             }
             counter ++;
           }
           Assert.assertNotNull("TaskTracker has not been found",ttClient);
           LOG.info("Task killed attempts:" +
               taskInfo.numKilledAttempts());
       }
       Assert.assertEquals("Task killed attempts are not matched ",
           4, taskInfo.numKilledAttempts());
    }
    LOG.info("Waiting till the job is completed...");
    while (!jInfo.getStatus().isJobComplete()) {
      UtilsForTests.waitFor(1000);
      jInfo = wovenClient.getJobInfo(jID);
View Full Code Here

    JobID jobId = getJobIdOfRunningStreamJob(runtimeArgs);   
    Assert.assertNotNull("Job ID not found for 1 min", jobId);
    Assert.assertTrue("Job has not been started for 1 min.",
        jtClient.isJobStarted(jobId));
   
    TaskInfo taskInfo = getTaskInfoOfRunningStreamJob(jobId);
    Assert.assertNotNull("TaskInfo is null",taskInfo);
    Assert.assertTrue("Task has not been started for 1 min.",
        jtClient.isTaskStarted(taskInfo));

    JobInfo jInfo = wovenClient.getJobInfo(jobId);
    RunningJob networkJob = client.getJob(jobId);
    TaskID tID = TaskID.downgrade(taskInfo.getTaskID());
    TaskAttemptID taskAttID = new TaskAttemptID(tID, 0);
    networkJob.killTask(taskAttID, false);

    int counter = 0;
    while (counter++ < 60) {
      if (taskInfo.getTaskStatus().length == 0) {
        UtilsForTests.waitFor(1000);
        taskInfo = wovenClient.getTaskInfo(taskInfo.getTaskID());
      } else if (taskInfo.getTaskStatus()[0].getRunState() ==
          TaskStatus.State.RUNNING) {
        UtilsForTests.waitFor(1000);
        taskInfo = wovenClient.getTaskInfo(taskInfo.getTaskID());
      } else if (taskInfo.getTaskStatus()[0].getRunState() ==
          TaskStatus.State.KILLED_UNCLEAN) {
        UtilsForTests.waitFor(1000);
        taskInfo = wovenClient.getTaskInfo(taskInfo.getTaskID());
      } else {
        break;
      }
    }
    Assert.assertTrue("Task has been killed before sigkill " +
        "sleep time of 3 secs.", counter > 3 && TaskStatus.State.KILLED ==
        taskInfo.getTaskStatus()[0].getRunState());

    LOG.info("Waiting till the job is completed...");
    while (!jInfo.getStatus().isJobComplete()) {
      UtilsForTests.waitFor(100);
      jInfo = wovenClient.getJobInfo(jobId);
View Full Code Here

    JobID jobId = getJobIdOfRunningStreamJob(runtimeArgs);
    Assert.assertNotNull("Job ID not found for 1 min", jobId);
    Assert.assertTrue("Job has not been started for 1 min.",
        jtClient.isJobStarted(jobId));

    TaskInfo taskInfo = getTaskInfoOfRunningStreamJob(jobId);
    Assert.assertNotNull("TaskInfo is null",taskInfo);
    Assert.assertTrue("Task has not been started for 1 min.",
        jtClient.isTaskStarted(taskInfo));
   
    JobInfo jInfo = wovenClient.getJobInfo(jobId);
    RunningJob networkJob = client.getJob(jobId);
    TaskID tID = TaskID.downgrade(taskInfo.getTaskID());
    TaskAttemptID taskAttID = new TaskAttemptID(tID, 0);
    networkJob.killTask(taskAttID, true);

    int counter = 0;
    while (counter++ < 60) {
      if (taskInfo.getTaskStatus().length == 0) {
        UtilsForTests.waitFor(1000);
        taskInfo = wovenClient.getTaskInfo(taskInfo.getTaskID());
      }else if (taskInfo.getTaskStatus()[0].getRunState() ==
          TaskStatus.State.RUNNING) {
        UtilsForTests.waitFor(1000);
        taskInfo = wovenClient.getTaskInfo(taskInfo.getTaskID());
      } else if (taskInfo.getTaskStatus()[0].getRunState() ==
          TaskStatus.State.FAILED_UNCLEAN) {
        UtilsForTests.waitFor(1000);
        taskInfo = wovenClient.getTaskInfo(taskInfo.getTaskID());
      } else {
        break;
      }
    }
    Assert.assertTrue("Task has not been Failed" , TaskStatus.State.FAILED ==
        taskInfo.getTaskStatus()[0].getRunState());

    LOG.info("Waiting till the job is completed...");
    while (!jInfo.getStatus().isJobComplete()) {
      UtilsForTests.waitFor(100);
      jInfo = wovenClient.getJobInfo(jobId);
View Full Code Here

        jInfo.getStatus().getRunState(), JobStatus.FAILED);
  }

  private TaskInfo getTaskInfoOfRunningStreamJob(JobID jobId)
      throws IOException {
    TaskInfo taskInfo = null;
    wovenClient = cluster.getJTClient().getProxy();
    JobInfo jInfo = wovenClient.getJobInfo(jobId);
    JobStatus jobStatus = jInfo.getStatus();
    // Make sure that map is running and start progress 10%.
    while (jobStatus.mapProgress() < 0.1f) {
View Full Code Here

   * @param none
   * @return void
   */
  public void testTaskTrackerInfoZeroMapsZeroReduces() throws Exception {
   
    TaskInfo taskInfo = null;

    String jobTrackerUserName = remoteJTClient.getDaemonUser();

    LOG.info("jobTrackerUserName is :" + jobTrackerUserName);

View Full Code Here

   * @param none
   * @return void
   */
  public void testTaskTrackerInfoTaskTrackerSuspend() throws Exception {
   
    TaskInfo taskInfo = null;

    String jobTrackerUserName = remoteJTClient.getDaemonUser();

    LOG.info("jobTrackerUserName is :" + jobTrackerUserName);

View Full Code Here

      jobId = getJobId(runtimeArgs, otherArgs);
    }
    Assert.assertNotNull("Job ID not found for 1 min", jobId);
    Assert.assertTrue("Job has not been started for 1 min.",
        cluster.getJTClient().isJobStarted(jobId));
    TaskInfo taskInfo = getTaskInfo(jobId, true);
    Assert.assertNotNull("TaskInfo is null",taskInfo);
    Assert.assertTrue("Task has not been started for 1 min.",
        cluster.getJTClient().isTaskStarted(taskInfo));
    JTProtocol wovenClient = cluster.getJTClient().getProxy();
    int counter = 0;
    TaskInfo tempTaskInfo;
    while (counter++ < 60) {
      if (taskInfo.getTaskStatus().length == 0) {
        UtilsForTests.waitFor(1000);
        tempTaskInfo = taskInfo;
        taskInfo = wovenClient.getTaskInfo(taskInfo.getTaskID());
View Full Code Here

      jobId = getJobId(runtimeArgs, otherArgs);
    }
    Assert.assertNotNull("Job ID not found for 1 min", jobId);
    Assert.assertTrue("Job has not been started for 1 min.",
        cluster.getJTClient().isJobStarted(jobId));
    TaskInfo taskInfo = getTaskInfo(jobId, false);
    Assert.assertNotNull("TaskInfo is null",taskInfo);
    Assert.assertTrue("Task has not been started for 1 min.",
        cluster.getJTClient().isTaskStarted(taskInfo));   
    JTProtocol wovenClient = cluster.getJTClient().getProxy();
    int counter = 0;
    TaskInfo tempTaskInfo;
    while (counter++ < 60) {
      if (taskInfo.getTaskStatus().length == 0) {
        UtilsForTests.waitFor(1000);
        tempTaskInfo = taskInfo;
        taskInfo = wovenClient.getTaskInfo(taskInfo.getTaskID());
View Full Code Here

TOP

Related Classes of org.apache.hadoop.mapreduce.test.system.TaskInfo

Copyright © 2018 www.massapicom. 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.