Search in sources :

Example 31 with HistoryFileInfo

use of org.apache.hadoop.mapreduce.v2.hs.HistoryFileManager.HistoryFileInfo in project hadoop by apache.

the class TestJobHistoryEntities method testCompletedJob.

/* Verify some expected values based on the history file */
@Test(timeout = 100000)
public void testCompletedJob() throws Exception {
    HistoryFileInfo info = mock(HistoryFileInfo.class);
    when(info.getConfFile()).thenReturn(fullConfPath);
    when(info.getHistoryFile()).thenReturn(fullHistoryPath);
    //Re-initialize to verify the delayed load.
    completedJob = new CompletedJob(conf, jobId, fullHistoryPath, loadTasks, "user", info, jobAclsManager);
    //Verify tasks loaded based on loadTask parameter.
    assertEquals(loadTasks, completedJob.tasksLoaded.get());
    assertEquals(1, completedJob.getAMInfos().size());
    assertEquals(10, completedJob.getCompletedMaps());
    assertEquals(1, completedJob.getCompletedReduces());
    assertEquals(12, completedJob.getTasks().size());
    //Verify tasks loaded at this point.
    assertEquals(true, completedJob.tasksLoaded.get());
    assertEquals(10, completedJob.getTasks(TaskType.MAP).size());
    assertEquals(2, completedJob.getTasks(TaskType.REDUCE).size());
    assertEquals("user", completedJob.getUserName());
    assertEquals(JobState.SUCCEEDED, completedJob.getState());
    JobReport jobReport = completedJob.getReport();
    assertEquals("user", jobReport.getUser());
    assertEquals(JobState.SUCCEEDED, jobReport.getJobState());
    assertEquals(fullHistoryPath.toString(), jobReport.getHistoryFile());
}
Also used : HistoryFileInfo(org.apache.hadoop.mapreduce.v2.hs.HistoryFileManager.HistoryFileInfo) JobReport(org.apache.hadoop.mapreduce.v2.api.records.JobReport) Test(org.junit.Test)

Example 32 with HistoryFileInfo

use of org.apache.hadoop.mapreduce.v2.hs.HistoryFileManager.HistoryFileInfo in project hadoop by apache.

the class TestJobInfo method testAverageMergeTime.

@Test(timeout = 10000)
public void testAverageMergeTime() throws IOException {
    String historyFileName = "job_1329348432655_0001-1329348443227-user-Sleep+job-1329348468601-10-1-SUCCEEDED-default.jhist";
    String confFileName = "job_1329348432655_0001_conf.xml";
    Configuration conf = new Configuration();
    JobACLsManager jobAclsMgr = new JobACLsManager(conf);
    Path fulleHistoryPath = new Path(TestJobHistoryEntities.class.getClassLoader().getResource(historyFileName).getFile());
    Path fullConfPath = new Path(TestJobHistoryEntities.class.getClassLoader().getResource(confFileName).getFile());
    HistoryFileInfo info = mock(HistoryFileInfo.class);
    when(info.getConfFile()).thenReturn(fullConfPath);
    when(info.getHistoryFile()).thenReturn(fulleHistoryPath);
    JobId jobId = MRBuilderUtils.newJobId(1329348432655l, 1, 1);
    CompletedJob completedJob = new CompletedJob(conf, jobId, fulleHistoryPath, true, "user", info, jobAclsMgr);
    JobInfo jobInfo = new JobInfo(completedJob);
    // There are 2 tasks with merge time of 45 and 55 respectively. So average
    // merge time should be 50.
    Assert.assertEquals(50L, jobInfo.getAvgMergeTime().longValue());
}
Also used : Path(org.apache.hadoop.fs.Path) TestJobHistoryEntities(org.apache.hadoop.mapreduce.v2.hs.TestJobHistoryEntities) HistoryFileInfo(org.apache.hadoop.mapreduce.v2.hs.HistoryFileManager.HistoryFileInfo) CompletedJob(org.apache.hadoop.mapreduce.v2.hs.CompletedJob) Configuration(org.apache.hadoop.conf.Configuration) JobACLsManager(org.apache.hadoop.mapred.JobACLsManager) JobId(org.apache.hadoop.mapreduce.v2.api.records.JobId) Test(org.junit.Test)

Aggregations

HistoryFileInfo (org.apache.hadoop.mapreduce.v2.hs.HistoryFileManager.HistoryFileInfo)27 Test (org.junit.Test)25 Configuration (org.apache.hadoop.conf.Configuration)17 JobId (org.apache.hadoop.mapreduce.v2.api.records.JobId)17 Path (org.apache.hadoop.fs.Path)14 Job (org.apache.hadoop.mapreduce.v2.app.job.Job)14 IOException (java.io.IOException)8 JobIndexInfo (org.apache.hadoop.mapreduce.v2.jobhistory.JobIndexInfo)8 MRApp (org.apache.hadoop.mapreduce.v2.app.MRApp)6 FileContext (org.apache.hadoop.fs.FileContext)5 FileStatus (org.apache.hadoop.fs.FileStatus)5 JobHistoryParser (org.apache.hadoop.mapreduce.jobhistory.JobHistoryParser)5 JobInfo (org.apache.hadoop.mapreduce.jobhistory.JobHistoryParser.JobInfo)5 FSDataInputStream (org.apache.hadoop.fs.FSDataInputStream)4 HdfsConfiguration (org.apache.hadoop.hdfs.HdfsConfiguration)4 Task (org.apache.hadoop.mapreduce.v2.app.job.Task)4 YarnConfiguration (org.apache.hadoop.yarn.conf.YarnConfiguration)4 TaskID (org.apache.hadoop.mapreduce.TaskID)3 TaskInfo (org.apache.hadoop.mapreduce.jobhistory.JobHistoryParser.TaskInfo)3 TaskId (org.apache.hadoop.mapreduce.v2.api.records.TaskId)3