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

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


    Assert.assertTrue(MAX_MAP_TASK_ATTEMPTS > 0);

    TTClient tClient = null;
    TTClient[] ttClients = null;

    JobInfo jInfo = remoteJTClient.getJobInfo(rJob.getID());

    //Assert if jobInfo is null
    Assert.assertNotNull(jInfo.getStatus().getRunState());

    //Wait for the job to start running.
    while (jInfo.getStatus().getRunState() != JobStatus.RUNNING) {
      try {
        Thread.sleep(10000);
      } catch (InterruptedException e) {};
      jInfo = remoteJTClient.getJobInfo(rJob.getID());
    }

    //Temporarily store the jobid to use it later for comparision.
    JobID jobidStore = rJob.getID();
    jobidStore = JobID.downgrade(jobidStore);
    LOG.info("job id is :" + jobidStore.toString());

    TaskInfo[] taskInfos = null;

    //After making sure that the job is running,
    //the test execution has to make sure that
    //at least one task has started running before continuing.
    boolean runningCount = false;
    int count = 0;
    do {
      taskInfos = cluster.getJTClient().getProxy()
        .getTaskInfo(rJob.getID());
      runningCount = false;
      for (TaskInfo taskInfo : taskInfos) {
        TaskStatus[] taskStatuses = taskInfo.getTaskStatus();
        if (taskStatuses.length > 0){
          LOG.info("taskStatuses[0].getRunState() is :" +
            taskStatuses[0].getRunState());
          if (taskStatuses[0].getRunState() == TaskStatus.State.RUNNING){
            runningCount = true;
            break;
          } else {
            LOG.info("Sleeping 5 seconds");
            Thread.sleep(5000);
          }
        }
      }
      count++;
      //If the count goes beyond a point, then break; This is to avoid
      //infinite loop under unforeseen circumstances. Testcase will anyway
      //fail later.
      if (count > 10) {
        Assert.fail("Since the sleep count has reached beyond a point" +
          "failing at this point");
      }
    } while (!runningCount);

    //This whole module is about getting the task Attempt id
    //of one task and killing it MAX_MAP_TASK_ATTEMPTS times,
    //whenever it re-attempts to run.
    String taskIdKilled = null;
    for (int i = 0 ; i<MAX_MAP_TASK_ATTEMPTS; i++) {
      taskInfos = cluster.getJTClient().getProxy()
          .getTaskInfo(rJob.getID());

      for (TaskInfo taskInfo : taskInfos) {
        TaskAttemptID taskAttemptID;
        if (!taskInfo.isSetupOrCleanup()) {
          //This is the task which is going to be killed continously in
          //all its task attempts.The first task is getting picked up.
          TaskID taskid = TaskID.downgrade(taskInfo.getTaskID());
          LOG.info("taskid is :" + taskid);
          if (i==0) {
            taskIdKilled = taskid.toString();
            taskAttemptID = new TaskAttemptID(taskid, i);
            LOG.info("taskAttemptid going to be killed is : " + taskAttemptID);
            rJob.killTask(taskAttemptID,true);
            checkTaskCompletionEvent(taskAttemptID, jInfo);
            break;
          } else {
            if (taskIdKilled.equals(taskid.toString())) {
              taskAttemptID = new TaskAttemptID(taskid, i);
              //Make sure that task is midway and then kill
              UtilsForTests.waitFor(20000);
              LOG.info("taskAttemptid going to be killed is : " +
                  taskAttemptID);
              rJob.killTask(taskAttemptID,true);
              checkTaskCompletionEvent(taskAttemptID,jInfo);
              break;
            }
          }
        }
      }
    }
    //Making sure that the job is complete.
    while (jInfo != null && !jInfo.getStatus().isJobComplete()) {
      Thread.sleep(10000);
      jInfo = remoteJTClient.getJobInfo(rJob.getID());
    }

    //Making sure that the correct jobstatus is got from all the jobs
View Full Code Here


    int succeededTasksLastDayBeforeJob = statisticsCollectionHandler.
        getLastDaySucceededTasks();

    RunningJob rJob = cluster.getJTClient().getClient().submitJob(jconf);
    JobID id = rJob.getID();
    JobInfo jInfo = remoteJTClient.getJobInfo(id);

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

    count = 0;
    while (count < 60) {
      if (jInfo.getStatus().getRunState() == JobStatus.RUNNING) {
        break;
      } else {
        UtilsForTests.waitFor(1000);
        jInfo = remoteJTClient.getJobInfo(rJob.getID());
      }
      count++;
    }
    Assert.assertTrue("Job has not been started for 1 min.",
      count != 60);

    //Assert if jobInfo is null
    Assert.assertNotNull("jobInfo is null", jInfo);

    count = 0;
    LOG.info("Waiting till the job is completed...");
    while ( jInfo != null && (!jInfo.getStatus().isJobComplete())) {
      UtilsForTests.waitFor(1000);
      count++;
      jInfo = remoteJTClient.getJobInfo(id);
      //If the count goes beyond a point, then break; This is to avoid
      //infinite loop under unforeseen circumstances. Testcase will
View Full Code Here

      //Submitting the job
      RunningJob rJob = cluster.getJTClient().getClient().submitJob(jconf);

      JobID jobID = rJob.getID();

      JobInfo jInfo = remoteJTClient.getJobInfo(jobID);
      LOG.info("jInfo is :" + jInfo);

      boolean jobStarted = cluster.getJTClient().isJobStarted(jobID);

      Assert.assertTrue("Job has not started even after a minute",
          jobStarted );

      LOG.info("job id is :" + jobID.toString());

      TaskInfo[] taskInfos = cluster.getJTClient().getProxy()
          .getTaskInfo(jobID);

      // getJobInfo method should
      // return a JobInProgress object when running,
      JobInfo jobInfo = cluster.getJTClient().getProxy()
          .getJobInfo(jobID);

      Assert.assertNotNull("The Job information is not present ", jobInfo);

      //Allow the job to continue through MR control job.
View Full Code Here

    JobClient client = cluster.getJTClient().getClient();

    RunningJob rJob = client.submitJob(new JobConf(conf));
    JobID id = rJob.getID();

    JobInfo jInfo = wovenClient.getJobInfo(id);

    while (jInfo.getStatus().getRunState() != JobStatus.RUNNING) {
      Thread.sleep(1000);
      jInfo = wovenClient.getJobInfo(id);
    }

    LOG.info("Waiting till job starts running one map");
View Full Code Here

    RunningJob rJob = cluster.getJTClient().getClient().submitJob(jconf);
    taskController = conf.get("mapred.task.tracker.task-controller");
    // get the job info so we can get the env variables from the daemon.
    // Now wait for the task to be in the running state, only then the
    // directories will be created
    JobInfo info = wovenClient.getJobInfo(rJob.getID());
    Assert.assertNotNull("JobInfo is null",info);
    JobID id = rJob.getID();
    while (info.runningMaps() != 1) {
      Thread.sleep(1000);
      info = wovenClient.getJobInfo(id);
    }
    TaskInfo[] myTaskInfos = wovenClient.getTaskInfo(id);
    for (TaskInfo tInfo : myTaskInfos) {
      if (!tInfo.isSetupOrCleanup()) {
        String[] taskTrackers = tInfo.getTaskTrackers();
        for (String taskTracker : taskTrackers) {
          TTInfo ttInfo = wovenClient.getTTInfo(taskTracker);
          TTClient ttCli = cluster.getTTClient(ttInfo.getStatus().getHost());
          Assert.assertNotNull("TTClient instance is null",ttCli);
          TTTaskInfo ttTaskInfo = ttCli.getProxy().getTask(tInfo.getTaskID());
          Assert.assertNotNull("TTTaskInfo is null",ttTaskInfo);
          while (ttTaskInfo.getTaskStatus().getRunState() !=
                 TaskStatus.State.RUNNING) {
            Thread.sleep(100);
            ttTaskInfo = ttCli.getProxy().getTask(tInfo.getTaskID());
          }
          testPermissionWithTaskController(ttCli, conf, info);
          FinishTaskControlAction action = new FinishTaskControlAction(TaskID
              .downgrade(tInfo.getTaskID()));
          for (TTClient cli : cluster.getTTClients()) {
            cli.getProxy().sendAction(action);
          }
        }
      }
    }
    JobInfo jInfo = wovenClient.getJobInfo(id);
    jInfo = cluster.getJTClient().getProxy().getJobInfo(id);
    while (!jInfo.getStatus().isJobComplete()) {
      Thread.sleep(100);
      jInfo = cluster.getJTClient().getProxy().getJobInfo(id);
    }
  }
View Full Code Here

    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));

    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) {
      TTProtocol tt = ttClient.getProxy();
      tt.sendAction(action);
      ttTaskinfo = tt.getTasks();
      for (TTTaskInfo tttInfo : ttTaskinfo) {
        if (!tttInfo.isTaskCleanupTask()) {
          pid = tttInfo.getPid();
          ttClientIns = ttClient;
          ttIns = tt;
          break;
        }
      }
      if (ttClientIns != null) {
        break;
      }
    }
    Assert.assertTrue("Map process is not alive before task fails.",
        ttIns.isProcessTreeAlive(pid));
   
    while (ttIns.getTask(tID).getTaskStatus().getRunState()
        == TaskStatus.State.RUNNING) {
      UtilsForTests.waitFor(1000);
      ttIns = ttClientIns.getProxy();
    }

    String[] taskDiagnostics = runJob.getTaskDiagnostics(tAttID);
    Assert.assertNotNull("Task diagnostics is null", taskDiagnostics);

    for (String strVal : taskDiagnostics) {
      mat = taskOverLimitPattern.matcher(strVal);
      Assert.assertTrue("Taskover limit error message is not matched.",
          mat.find());
    }

    runJob.killJob();

    LOG.info("Waiting till the job is completed...");
    counter = 0;
    while (counter < 60) {
      if (jInfo.getStatus().isJobComplete()) {
        break;
      }
      UtilsForTests.waitFor(1000);
      jInfo = wovenClient.getJobInfo(id);
      counter ++;
View Full Code Here

    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));
View Full Code Here

      //counter for job Loop
      countLoop++;

      TTClient tClient = null;
      JobInfo jInfo = wovenClient.getJobInfo(rJob.getID());
      LOG.info("jInfo is :" + jInfo);

      //Assert if jobInfo is null
      Assert.assertNotNull("jobInfo is null", jInfo);

      //Wait for the job to start running.
      count = 0;
      while (jInfo.getStatus().getRunState() != JobStatus.RUNNING) {
        UtilsForTests.waitFor(10000);
        count++;
        jInfo = wovenClient.getJobInfo(rJob.getID());
        //If the count goes beyond a point, then break; This is to avoid
        //infinite loop under unforeseen circumstances. Testcase will anyway
View Full Code Here

      //Submitting the job
      RunningJob rJob = cluster.getJTClient().getClient().submitJob(jconf);

      JobID jobID = rJob.getID();
      JobInfo jInfo = remoteJTClient.getJobInfo(jobID);
      String jobIDString = jobID.toString();
      LOG.info("jobIDString is :" + jobIDString);

      //Assert if jobInfo is null
      Assert.assertNotNull("jobInfo is null", jInfo);

      waitTillRunState(jInfo, jobID, remoteJTClient);

      if (jobHistoryPathString != null) {
        FileStatus[] jobHistoryFileStatuses = dfs.
          listStatus(new Path (jobHistoryPathString));
        jobFileFound = false;
        for (FileStatus jobHistoryFileStatus : jobHistoryFileStatuses) {
          if ((jobHistoryFileStatus.getPath().toString()).
              matches(jobIDString)) {
            jobFileFound = true;
            break;
          }
        }
        Assert.assertTrue("jobFileFound is false", jobFileFound);
      }

      TaskInfo[] taskInfos = cluster.getJTClient().getProxy()
          .getTaskInfo(rJob.getID());

      //Killing this job will happen only in the second iteration.
      if (testIterationLoop == 2) {
        //Killing the job because all the verification needed
        //for this testcase is completed.
        rJob.killJob();
      }

      //Making sure that the job is complete.
      count = 0;
      while (jInfo != null && !jInfo.getStatus().isJobComplete()) {
        UtilsForTests.waitFor(10000);
        count++;
        jInfo = remoteJTClient.getJobInfo(rJob.getID());
        //If the count goes beyond 100 seconds, then break; This is to avoid
        //infinite loop.
View Full Code Here

    int testIterationLoop = 0;
    FileStatus[] jobHistoryDoneFileStatuses;
    RunningJob[] rJobCollection = new RunningJob[4];
    JobID[] rJobIDCollection = new JobID[4];
    String jobHistoryDonePathString = null;
    JobInfo jInfo = null;
    for ( int noOfJobs = 0; noOfJobs < 4; noOfJobs++ ) {
      SleepJob job = null;
      testIterationLoop++;
      job = new SleepJob();
      job.setConf(conf);
View Full Code Here

TOP

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

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.