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

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


    jobConf.setMemoryForReduceTask(2048);
    int exitCode = ToolRunner.run(jobConf, job, jobArgs);
    Assert.assertEquals("Exit Code:", 0, exitCode);
    UtilsForTests.waitFor(1000);
    JobID jobId = jobClient.getAllJobs()[0].getJobID();
    JobInfo jInfo = remoteJTClient.getJobInfo(jobId);
    Assert.assertEquals(assertMessage,
        jInfo.getStatus().getRunState(), JobStatus.SUCCEEDED);
    return jobId;
  }
View Full Code Here


    }
    jtClient.getClient().killJob(jobId);
    LOG.info("Waiting till the job is completed...");
    Assert.assertTrue("Job has not been completed for 1 min",
        jtClient.isJobStopped(jobId));
    JobInfo jobInfo = rtClient.getJobInfo(jobId);
    Assert.assertEquals("Job has not been killed",
            jobInfo.getStatus().getRunState(), JobStatus.KILLED);
    UtilsForTests.waitFor(3000);
    Assert.assertTrue("Job directories have not been cleaned up properly " +
        "after completion of job", verifyJobDirectoryCleanup(map));
  }
View Full Code Here

    job.setConf(conf);
    JobConf jobConf = job.setupJobConf(1, 0, 10000,0, 10, 10);
    JobClient client = jtClient.getClient();
    RunningJob runJob = client.submitJob(jobConf);
    JobID jobId = runJob.getID();
    JobInfo jobInfo = rtClient.getJobInfo(jobId);
    Assert.assertTrue("Job has not been started for 1 min",
        jtClient.isJobStarted(jobId));
    TaskInfo [] taskInfos = rtClient.getTaskInfo(jobId);
    boolean isFailTask = false;
    for (TaskInfo taskinfo : taskInfos) {
      if (!taskinfo.isSetupOrCleanup()) {       
        Assert.assertTrue("Task has not been started for 1 min ",
            jtClient.isTaskStarted(taskinfo));
        String tasktracker = getTaskTracker(taskinfo);
        Assert.assertNotNull("TaskTracker has not been found", tasktracker);
        TTClient ttclient = getTTClient(tasktracker);       
        map.put(ttClient, getTTClientMapRedLocalDirs(ttClient,
            taskinfo, jobId));
        if (!isFailTask) {
          Assert.assertNotNull("TaskInfo is null.", taskinfo);
          TaskID taskId = TaskID.downgrade(taskinfo.getTaskID());
          TaskAttemptID taskAttID = new TaskAttemptID(taskId,
              taskinfo.numFailedAttempts());
          int MAX_MAP_TASK_ATTEMPTS = Integer.
               parseInt(jobConf.get("mapred.map.max.attempts"));
          while(taskinfo.numFailedAttempts() < MAX_MAP_TASK_ATTEMPTS) {
            org.apache.hadoop.mapreduce.JobID temp = jobInfo.getID();
            RunningJob networkJob = client.getJob(new JobID(temp.getJtIdentifier(), temp.getId()));
            networkJob.killTask(taskAttID, true);
            taskinfo = rtClient.getTaskInfo(taskinfo.getTaskID());
            taskAttID = new TaskAttemptID(taskId, taskinfo.numFailedAttempts());
            jobInfo = rtClient.getJobInfo(jobId);
          }
          isFailTask=true;
        }
      }
    }
    LOG.info("Waiting till the job is completed...");
    Assert.assertTrue("Job has not been completed for 1 min",
        jtClient.isJobStopped(jobId));
    jobInfo = rtClient.getJobInfo(jobId);
    Assert.assertEquals("Job has not been failed",
            jobInfo.getStatus().getRunState(), JobStatus.FAILED);
    UtilsForTests.waitFor(3000);
    Assert.assertTrue("Directories have not been cleaned up " +
        "after completion of job", verifyJobDirectoryCleanup(map));
  }
View Full Code Here

    //Controls the job till all verification is done
    FinishTaskControlAction.configureControlActionForJob(conf);
    //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 );
     
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
        //fail later.
        if (count > 10) {
          Assert.fail("job has not reached running state for more than" +
            "100 seconds. Failing at this point");
        }
      }

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

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

      boolean distCacheFileIsFound;

      for (TaskInfo taskInfo : taskInfos) {
        distCacheFileIsFound = false;
        String[] taskTrackers = taskInfo.getTaskTrackers();
        for (String taskTracker : taskTrackers) {
          //Formatting tasktracker to get just its FQDN
          taskTracker = UtilsForTests.getFQDNofTT(taskTracker);
          LOG.info("taskTracker is :" + taskTracker);

          //The tasktrackerFound variable is initialized
          taskTrackerFound = false;

          //This will be entered from the second job onwards
          if (countLoop > 1) {
            if (taskTracker != null) {
              continueLoop = taskTrackerCollection.contains(taskTracker);
            }
            if (continueLoop) {
              taskTrackerFound = true;
            }
          }
          //Collecting the tasktrackers
          if (taskTracker != null)
            taskTrackerCollection.add(taskTracker);

          //we have loopped through two times to look for task
          //getting submitted on same tasktrackers.The same tasktracker
          //for subsequent jobs was not hit maybe because of many number
          //of tasktrackers. So, testcase has to stop here.
          if (countLoop > 1) {
            continueLoop = false;
          }

          tClient = cluster.getTTClient(taskTracker);

          //tClient maybe null because the task is already dead. Ex: setup
          if (tClient == null) {
            continue;
          }

          String[] localDirs = tClient.getMapredLocalDirs();
          int distributedFileCount = 0;
          //Go to every single path
          for (String localDir : localDirs) {
            //Public Distributed cache will always be stored under
            //mapre.local.dir/tasktracker/archive
            localDir = localDir + Path.SEPARATOR +
                   TaskTracker.getPublicDistributedCacheDir();
            LOG.info("localDir is : " + localDir);

            //Get file status of all the directories
            //and files under that path.
            FileStatus[] fileStatuses = tClient.listStatus(localDir,
                true, true);
            for (FileStatus  fileStatus : fileStatuses) {
              Path path = fileStatus.getPath();
              LOG.info("path is :" + path.toString());
              //Checking if the received path ends with
              //the distributed filename
              distCacheFileIsFound = (path.toString()).
                  endsWith(distributedFileName);
              //If file is found, check for its permission.
              //Since the file is found break out of loop
              if (distCacheFileIsFound){
                LOG.info("PATH found is :" + path.toString());
                distributedFileCount++;
                String filename = path.getName();
                FsPermission fsPerm = fileStatus.getPermission();
                Assert.assertTrue("File Permission is not 777",
                    fsPerm.equals(new FsPermission("777")));
              }
            }
          }

          LOG.debug("The distributed FileCount is :" + distributedFileCount);
          LOG.debug("The taskTrackerFound is :" + taskTrackerFound);

          // If distributed cache is modified in dfs
          // between two job runs, it can be present more than once
          // in any of the task tracker, in which job ran.
          if (distributedFileCount != 2 && taskTrackerFound) {
            Assert.fail("The distributed cache file has to be two. " +
                "But found was " + distributedFileCount);
          } else if (distributedFileCount < 1)
            Assert.fail("The distributed cache file is less than one. " +
                "But found was " + distributedFileCount);
          if (!distCacheFileIsFound) {
            Assert.assertEquals("The distributed cache file does not exist",
                distCacheFileIsFound, false);
          }
        }
      }
      //Allow the job to continue through MR control job.
      cluster.signalAllTasks(rJob.getID());

      //Killing the job because all the verification needed
      //for this testcase is completed.
      rJob.killJob();

      //Waiting for 3 seconds for cleanup to start
      Thread.sleep(3000);

      //Getting the last cleanup task's tasktracker also, as
      //distributed cache gets uploaded even during cleanup.
      TaskInfo[] myTaskInfos = wovenClient.getTaskInfo(rJob.getID());
      if (myTaskInfos != null) {
        for(TaskInfo info : myTaskInfos) {
          if(info.isSetupOrCleanup()) {
            String[] taskTrackers = info.getTaskTrackers();
            for(String taskTracker : taskTrackers) {
              //Formatting tasktracker to get just its FQDN
              taskTracker = UtilsForTests.getFQDNofTT(taskTracker);
              LOG.info("taskTracker is :" + taskTracker);
              //Collecting the tasktrackers
              if (taskTracker != null)
                taskTrackerCollection.add(taskTracker);
            }   
          }
        }
      }

      //Making sure that the job is complete.
      while (jInfo != null && !jInfo.getStatus().isJobComplete()) {
        Thread.sleep(10000);
        jInfo = wovenClient.getJobInfo(rJob.getID());
      }

    } while (continueLoop);
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));
    JobStatus[] jobStatus = client.getAllJobs();
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

    jconf.setOutputCommitter(theClass);
    if(!isUserKill)
    { 
      RunningJob rJob = cluster.getJTClient().getClient().submitJob(jconf);
      JobID id = rJob.getID();
      JobInfo jInfo = wovenClient.getJobInfo(id);
      Assert.assertTrue("Job is not in PREP state",
          jInfo.getStatus().getRunState() == JobStatus.PREP);
    }
    else
    {
      //user kill job
      RunningJob rJob = cluster.getJTClient().getClient().submitJob(jconf);
      JobInfo info = wovenClient.getJobInfo(rJob.getID());
      Assert.assertNotNull("Job Info is null",info);
      JobID id = rJob.getID();     
      Assert.assertTrue("Failed to start the job",
          cluster.getJTClient().isJobStarted(id));
      rJob.killJob();
View Full Code Here

        getLastDaySucceededTasks();

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

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

    //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(rJob.getID());
      //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);

    JobInfo jInfo = remoteJTClient.getJobInfo(rJob.getID());
    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);

    TaskInfo[] taskInfos = remoteJTClient.getTaskInfo(rJob.getID());
    for (TaskInfo taskinfo : taskInfos) {
      if (!taskinfo.isSetupOrCleanup()) {
        taskInfo = taskinfo;
      }
    }

    count = 0;
    taskInfo = remoteJTClient.getTaskInfo(taskInfo.getTaskID());
    while (count < 60) {
      if (taskInfo.getTaskStatus().length > 0) {
        if (taskInfo.getTaskStatus()[0].getRunState()
              == TaskStatus.State.RUNNING) {
          break;
        }
      }
      UtilsForTests.waitFor(1000);
      taskInfo = remoteJTClient.getTaskInfo(taskInfo.getTaskID());
      count++;
    }

    Assert.assertTrue("Task has not been started for 1 min.",
      count != 60);

    TaskID tID = TaskID.downgrade(taskInfo.getTaskID());
    TaskAttemptID taskAttID = new TaskAttemptID(tID , 0);
    rJob.killTask(taskAttID, false);

    count = 0;
    LOG.info("Waiting till the job is completed...");
    while (!jInfo.getStatus().isJobComplete()) {
      UtilsForTests.waitFor(1000);
      count++;
      jInfo = remoteJTClient.getJobInfo(rJob.getID());
      //If the count goes beyond a point, then break; This is to avoid
      //infinite loop under unforeseen circumstances. Testcase will
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.