Search in sources :

Example 6 with JobReport

use of org.apache.hadoop.mapreduce.v2.api.records.JobReport in project hadoop by apache.

the class MRApp method verifyCompleted.

public void verifyCompleted() {
    for (Job job : getContext().getAllJobs().values()) {
        JobReport jobReport = job.getReport();
        System.out.println("Job start time :" + jobReport.getStartTime());
        System.out.println("Job finish time :" + jobReport.getFinishTime());
        Assert.assertTrue("Job start time is not less than finish time", jobReport.getStartTime() <= jobReport.getFinishTime());
        Assert.assertTrue("Job finish time is in future", jobReport.getFinishTime() <= System.currentTimeMillis());
        for (Task task : job.getTasks().values()) {
            TaskReport taskReport = task.getReport();
            System.out.println("Task start time : " + taskReport.getStartTime());
            System.out.println("Task finish time : " + taskReport.getFinishTime());
            Assert.assertTrue("Task start time is not less than finish time", taskReport.getStartTime() <= taskReport.getFinishTime());
            for (TaskAttempt attempt : task.getAttempts().values()) {
                TaskAttemptReport attemptReport = attempt.getReport();
                Assert.assertTrue("Attempt start time is not less than finish time", attemptReport.getStartTime() <= attemptReport.getFinishTime());
            }
        }
    }
}
Also used : Task(org.apache.hadoop.mapreduce.v2.app.job.Task) TaskReport(org.apache.hadoop.mapreduce.v2.api.records.TaskReport) TaskAttemptReport(org.apache.hadoop.mapreduce.v2.api.records.TaskAttemptReport) TaskAttempt(org.apache.hadoop.mapreduce.v2.app.job.TaskAttempt) Job(org.apache.hadoop.mapreduce.v2.app.job.Job) JobReport(org.apache.hadoop.mapreduce.v2.api.records.JobReport)

Example 7 with JobReport

use of org.apache.hadoop.mapreduce.v2.api.records.JobReport in project hadoop by apache.

the class TestTypeConverter method testFromYarnJobReport.

@Test
public void testFromYarnJobReport() throws Exception {
    int jobStartTime = 612354;
    int jobFinishTime = 612355;
    JobState state = JobState.RUNNING;
    JobId jobId = Records.newRecord(JobId.class);
    JobReport jobReport = Records.newRecord(JobReport.class);
    ApplicationId applicationId = ApplicationId.newInstance(0, 0);
    jobId.setAppId(applicationId);
    jobId.setId(0);
    jobReport.setJobId(jobId);
    jobReport.setJobState(state);
    jobReport.setStartTime(jobStartTime);
    jobReport.setFinishTime(jobFinishTime);
    jobReport.setUser("TestTypeConverter-user");
    jobReport.setJobPriority(Priority.newInstance(0));
    JobStatus jobStatus = TypeConverter.fromYarn(jobReport, "dummy-jobfile");
    Assert.assertEquals(jobStartTime, jobStatus.getStartTime());
    Assert.assertEquals(jobFinishTime, jobStatus.getFinishTime());
    Assert.assertEquals(state.toString(), jobStatus.getState().toString());
    Assert.assertEquals(JobPriority.DEFAULT, jobStatus.getPriority());
}
Also used : JobState(org.apache.hadoop.mapreduce.v2.api.records.JobState) 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) Test(org.junit.Test)

Example 8 with JobReport

use of org.apache.hadoop.mapreduce.v2.api.records.JobReport in project hadoop by apache.

the class GetJobReportResponsePBImpl method getJobReport.

@Override
public JobReport getJobReport() {
    GetJobReportResponseProtoOrBuilder p = viaProto ? proto : builder;
    if (this.jobReport != null) {
        return this.jobReport;
    }
    if (!p.hasJobReport()) {
        return null;
    }
    this.jobReport = convertFromProtoFormat(p.getJobReport());
    return this.jobReport;
}
Also used : GetJobReportResponseProtoOrBuilder(org.apache.hadoop.mapreduce.v2.proto.MRServiceProtos.GetJobReportResponseProtoOrBuilder)

Example 9 with JobReport

use of org.apache.hadoop.mapreduce.v2.api.records.JobReport in project hadoop by apache.

the class MRBuilderUtils method newJobReport.

public static JobReport newJobReport(JobId jobId, String jobName, String userName, JobState state, long submitTime, long startTime, long finishTime, float setupProgress, float mapProgress, float reduceProgress, float cleanupProgress, String jobFile, List<AMInfo> amInfos, boolean isUber, String diagnostics, Priority priority) {
    JobReport report = Records.newRecord(JobReport.class);
    report.setJobId(jobId);
    report.setJobName(jobName);
    report.setUser(userName);
    report.setJobState(state);
    report.setSubmitTime(submitTime);
    report.setStartTime(startTime);
    report.setFinishTime(finishTime);
    report.setSetupProgress(setupProgress);
    report.setCleanupProgress(cleanupProgress);
    report.setMapProgress(mapProgress);
    report.setReduceProgress(reduceProgress);
    report.setJobFile(jobFile);
    report.setAMInfos(amInfos);
    report.setIsUber(isUber);
    report.setDiagnostics(diagnostics);
    report.setJobPriority(priority);
    return report;
}
Also used : JobReport(org.apache.hadoop.mapreduce.v2.api.records.JobReport)

Example 10 with JobReport

use of org.apache.hadoop.mapreduce.v2.api.records.JobReport in project hadoop by apache.

the class TestClientServiceDelegate method getJobReportResponse.

private GetJobReportResponse getJobReportResponse() {
    GetJobReportResponse jobReportResponse = Records.newRecord(GetJobReportResponse.class);
    JobReport jobReport = Records.newRecord(JobReport.class);
    jobReport.setJobId(jobId);
    jobReport.setJobState(JobState.SUCCEEDED);
    jobReportResponse.setJobReport(jobReport);
    return jobReportResponse;
}
Also used : GetJobReportResponse(org.apache.hadoop.mapreduce.v2.api.protocolrecords.GetJobReportResponse) JobReport(org.apache.hadoop.mapreduce.v2.api.records.JobReport)

Aggregations

JobReport (org.apache.hadoop.mapreduce.v2.api.records.JobReport)26 Job (org.apache.hadoop.mapreduce.v2.app.job.Job)9 Test (org.junit.Test)9 JobId (org.apache.hadoop.mapreduce.v2.api.records.JobId)8 GetJobReportResponse (org.apache.hadoop.mapreduce.v2.api.protocolrecords.GetJobReportResponse)5 GetJobReportRequest (org.apache.hadoop.mapreduce.v2.api.protocolrecords.GetJobReportRequest)4 AMInfo (org.apache.hadoop.mapreduce.v2.api.records.AMInfo)4 Task (org.apache.hadoop.mapreduce.v2.app.job.Task)4 TaskAttemptReport (org.apache.hadoop.mapreduce.v2.api.records.TaskAttemptReport)3 TaskAttempt (org.apache.hadoop.mapreduce.v2.app.job.TaskAttempt)3 CompletedJob (org.apache.hadoop.mapreduce.v2.hs.CompletedJob)3 IOException (java.io.IOException)2 Date (java.util.Date)2 Configuration (org.apache.hadoop.conf.Configuration)2 Counters (org.apache.hadoop.mapreduce.Counters)2 GetTaskAttemptReportRequest (org.apache.hadoop.mapreduce.v2.api.protocolrecords.GetTaskAttemptReportRequest)2 JobState (org.apache.hadoop.mapreduce.v2.api.records.JobState)2 TaskId (org.apache.hadoop.mapreduce.v2.api.records.TaskId)2 TaskReport (org.apache.hadoop.mapreduce.v2.api.records.TaskReport)2 ApplicationId (org.apache.hadoop.yarn.api.records.ApplicationId)2