Search in sources :

Example 6 with JobIdPBImpl

use of org.apache.hadoop.mapreduce.v2.api.records.impl.pb.JobIdPBImpl in project hadoop by apache.

the class TestBlocks method getJob.

private Job getJob() {
    Job job = mock(Job.class);
    JobId jobId = new JobIdPBImpl();
    ApplicationId appId = ApplicationIdPBImpl.newInstance(System.currentTimeMillis(), 4);
    jobId.setAppId(appId);
    jobId.setId(1);
    when(job.getID()).thenReturn(jobId);
    JobReport report = mock(JobReport.class);
    when(report.getStartTime()).thenReturn(100010L);
    when(report.getFinishTime()).thenReturn(100015L);
    when(job.getReport()).thenReturn(report);
    when(job.getName()).thenReturn("JobName");
    when(job.getUserName()).thenReturn("UserName");
    when(job.getQueueName()).thenReturn("QueueName");
    when(job.getState()).thenReturn(JobState.SUCCEEDED);
    when(job.getTotalMaps()).thenReturn(3);
    when(job.getCompletedMaps()).thenReturn(2);
    when(job.getTotalReduces()).thenReturn(2);
    when(job.getCompletedReduces()).thenReturn(1);
    when(job.getCompletedReduces()).thenReturn(1);
    return job;
}
Also used : JobIdPBImpl(org.apache.hadoop.mapreduce.v2.api.records.impl.pb.JobIdPBImpl) Job(org.apache.hadoop.mapreduce.v2.app.job.Job) ApplicationId(org.apache.hadoop.yarn.api.records.ApplicationId) JobId(org.apache.hadoop.mapreduce.v2.api.records.JobId) JobReport(org.apache.hadoop.mapreduce.v2.api.records.JobReport)

Example 7 with JobIdPBImpl

use of org.apache.hadoop.mapreduce.v2.api.records.impl.pb.JobIdPBImpl in project hadoop by apache.

the class TestBlocks method getTask.

private Task getTask(long timestamp) {
    JobId jobId = new JobIdPBImpl();
    jobId.setId(0);
    jobId.setAppId(ApplicationIdPBImpl.newInstance(timestamp, 1));
    TaskId taskId = new TaskIdPBImpl();
    taskId.setId(0);
    taskId.setTaskType(TaskType.REDUCE);
    taskId.setJobId(jobId);
    Task task = mock(Task.class);
    when(task.getID()).thenReturn(taskId);
    TaskReport report = mock(TaskReport.class);
    when(report.getProgress()).thenReturn(0.7f);
    when(report.getTaskState()).thenReturn(TaskState.SUCCEEDED);
    when(report.getStartTime()).thenReturn(100001L);
    when(report.getFinishTime()).thenReturn(100011L);
    when(task.getReport()).thenReturn(report);
    when(task.getType()).thenReturn(TaskType.REDUCE);
    return task;
}
Also used : Task(org.apache.hadoop.mapreduce.v2.app.job.Task) TaskId(org.apache.hadoop.mapreduce.v2.api.records.TaskId) TaskReport(org.apache.hadoop.mapreduce.v2.api.records.TaskReport) TaskIdPBImpl(org.apache.hadoop.mapreduce.v2.api.records.impl.pb.TaskIdPBImpl) JobIdPBImpl(org.apache.hadoop.mapreduce.v2.api.records.impl.pb.JobIdPBImpl) JobId(org.apache.hadoop.mapreduce.v2.api.records.JobId)

Aggregations

JobId (org.apache.hadoop.mapreduce.v2.api.records.JobId)7 JobIdPBImpl (org.apache.hadoop.mapreduce.v2.api.records.impl.pb.JobIdPBImpl)7 TaskIdPBImpl (org.apache.hadoop.mapreduce.v2.api.records.impl.pb.TaskIdPBImpl)5 TaskId (org.apache.hadoop.mapreduce.v2.api.records.TaskId)4 TaskReport (org.apache.hadoop.mapreduce.v2.api.records.TaskReport)4 Job (org.apache.hadoop.mapreduce.v2.app.job.Job)4 Task (org.apache.hadoop.mapreduce.v2.app.job.Task)4 Test (org.junit.Test)4 PrintWriter (java.io.PrintWriter)3 HashMap (java.util.HashMap)3 AppContext (org.apache.hadoop.mapreduce.v2.app.AppContext)3 FewAttemptsBlock (org.apache.hadoop.mapreduce.v2.app.webapp.AttemptsPage.FewAttemptsBlock)3 BlockForTest (org.apache.hadoop.yarn.webapp.view.BlockForTest)3 HtmlBlock (org.apache.hadoop.yarn.webapp.view.HtmlBlock)3 Block (org.apache.hadoop.yarn.webapp.view.HtmlBlock.Block)3 ApplicationId (org.apache.hadoop.yarn.api.records.ApplicationId)2 Configuration (org.apache.hadoop.conf.Configuration)1 JobReport (org.apache.hadoop.mapreduce.v2.api.records.JobReport)1 TaskAttemptId (org.apache.hadoop.mapreduce.v2.api.records.TaskAttemptId)1 TaskAttemptReport (org.apache.hadoop.mapreduce.v2.api.records.TaskAttemptReport)1