Search in sources :

Example 1 with GetDiagnosticsResponse

use of org.apache.hadoop.mapreduce.v2.api.protocolrecords.GetDiagnosticsResponse in project hadoop by apache.

the class ClientServiceDelegate method getTaskDiagnostics.

public String[] getTaskDiagnostics(org.apache.hadoop.mapreduce.TaskAttemptID arg0) throws IOException, InterruptedException {
    org.apache.hadoop.mapreduce.v2.api.records.TaskAttemptId attemptID = TypeConverter.toYarn(arg0);
    GetDiagnosticsRequest request = recordFactory.newRecordInstance(GetDiagnosticsRequest.class);
    request.setTaskAttemptId(attemptID);
    List<String> list = ((GetDiagnosticsResponse) invoke("getDiagnostics", GetDiagnosticsRequest.class, request)).getDiagnosticsList();
    String[] result = new String[list.size()];
    int i = 0;
    for (String c : list) {
        result[i++] = c.toString();
    }
    return result;
}
Also used : GetDiagnosticsRequest(org.apache.hadoop.mapreduce.v2.api.protocolrecords.GetDiagnosticsRequest) GetDiagnosticsResponse(org.apache.hadoop.mapreduce.v2.api.protocolrecords.GetDiagnosticsResponse)

Example 2 with GetDiagnosticsResponse

use of org.apache.hadoop.mapreduce.v2.api.protocolrecords.GetDiagnosticsResponse in project hadoop by apache.

the class NotRunningJob method getDiagnostics.

@Override
public GetDiagnosticsResponse getDiagnostics(GetDiagnosticsRequest request) throws IOException {
    GetDiagnosticsResponse resp = recordFactory.newRecordInstance(GetDiagnosticsResponse.class);
    resp.addDiagnostics("");
    return resp;
}
Also used : GetDiagnosticsResponse(org.apache.hadoop.mapreduce.v2.api.protocolrecords.GetDiagnosticsResponse)

Example 3 with GetDiagnosticsResponse

use of org.apache.hadoop.mapreduce.v2.api.protocolrecords.GetDiagnosticsResponse in project hadoop by apache.

the class TestJobHistoryServer method testReports.

//Test reports of  JobHistoryServer. History server should get log files from  MRApp and read them
@Test(timeout = 50000)
public void testReports() throws Exception {
    Configuration config = new Configuration();
    config.setClass(CommonConfigurationKeysPublic.NET_TOPOLOGY_NODE_SWITCH_MAPPING_IMPL_KEY, MyResolver.class, DNSToSwitchMapping.class);
    RackResolver.init(config);
    MRApp app = new MRAppWithHistory(1, 1, true, this.getClass().getName(), true);
    app.submit(config);
    Job job = app.getContext().getAllJobs().values().iterator().next();
    app.waitForState(job, JobState.SUCCEEDED);
    historyServer = new JobHistoryServer();
    historyServer.init(config);
    historyServer.start();
    // search JobHistory  service
    JobHistory jobHistory = null;
    for (Service service : historyServer.getServices()) {
        if (service instanceof JobHistory) {
            jobHistory = (JobHistory) service;
        }
    }
    ;
    Map<JobId, Job> jobs = jobHistory.getAllJobs();
    assertEquals(1, jobs.size());
    assertEquals("job_0_0000", jobs.keySet().iterator().next().toString());
    Task task = job.getTasks().values().iterator().next();
    TaskAttempt attempt = task.getAttempts().values().iterator().next();
    HistoryClientService historyService = historyServer.getClientService();
    MRClientProtocol protocol = historyService.getClientHandler();
    GetTaskAttemptReportRequest gtarRequest = recordFactory.newRecordInstance(GetTaskAttemptReportRequest.class);
    // test getTaskAttemptReport
    TaskAttemptId taId = attempt.getID();
    taId.setTaskId(task.getID());
    taId.getTaskId().setJobId(job.getID());
    gtarRequest.setTaskAttemptId(taId);
    GetTaskAttemptReportResponse response = protocol.getTaskAttemptReport(gtarRequest);
    assertEquals("container_0_0000_01_000000", response.getTaskAttemptReport().getContainerId().toString());
    assertTrue(response.getTaskAttemptReport().getDiagnosticInfo().isEmpty());
    // counters
    assertNotNull(response.getTaskAttemptReport().getCounters().getCounter(TaskCounter.PHYSICAL_MEMORY_BYTES));
    assertEquals(taId.toString(), response.getTaskAttemptReport().getTaskAttemptId().toString());
    // test getTaskReport
    GetTaskReportRequest request = recordFactory.newRecordInstance(GetTaskReportRequest.class);
    TaskId taskId = task.getID();
    taskId.setJobId(job.getID());
    request.setTaskId(taskId);
    GetTaskReportResponse reportResponse = protocol.getTaskReport(request);
    assertEquals("", reportResponse.getTaskReport().getDiagnosticsList().iterator().next());
    // progress
    assertEquals(1.0f, reportResponse.getTaskReport().getProgress(), 0.01);
    // report has corrected taskId
    assertEquals(taskId.toString(), reportResponse.getTaskReport().getTaskId().toString());
    // Task state should be SUCCEEDED
    assertEquals(TaskState.SUCCEEDED, reportResponse.getTaskReport().getTaskState());
    // For invalid jobid, throw IOException
    GetTaskReportsRequest gtreportsRequest = recordFactory.newRecordInstance(GetTaskReportsRequest.class);
    gtreportsRequest.setJobId(TypeConverter.toYarn(JobID.forName("job_1415730144495_0001")));
    gtreportsRequest.setTaskType(TaskType.REDUCE);
    try {
        protocol.getTaskReports(gtreportsRequest);
        fail("IOException not thrown for invalid job id");
    } catch (IOException e) {
    // Expected
    }
    // test getTaskAttemptCompletionEvents
    GetTaskAttemptCompletionEventsRequest taskAttemptRequest = recordFactory.newRecordInstance(GetTaskAttemptCompletionEventsRequest.class);
    taskAttemptRequest.setJobId(job.getID());
    GetTaskAttemptCompletionEventsResponse taskAttemptCompletionEventsResponse = protocol.getTaskAttemptCompletionEvents(taskAttemptRequest);
    assertEquals(0, taskAttemptCompletionEventsResponse.getCompletionEventCount());
    // test getDiagnostics
    GetDiagnosticsRequest diagnosticRequest = recordFactory.newRecordInstance(GetDiagnosticsRequest.class);
    diagnosticRequest.setTaskAttemptId(taId);
    GetDiagnosticsResponse diagnosticResponse = protocol.getDiagnostics(diagnosticRequest);
    // it is strange : why one empty string ?
    assertEquals(1, diagnosticResponse.getDiagnosticsCount());
    assertEquals("", diagnosticResponse.getDiagnostics(0));
}
Also used : MRAppWithHistory(org.apache.hadoop.mapreduce.v2.hs.TestJobHistoryEvents.MRAppWithHistory) Task(org.apache.hadoop.mapreduce.v2.app.job.Task) TaskId(org.apache.hadoop.mapreduce.v2.api.records.TaskId) Configuration(org.apache.hadoop.conf.Configuration) GetTaskAttemptReportRequest(org.apache.hadoop.mapreduce.v2.api.protocolrecords.GetTaskAttemptReportRequest) GetTaskReportResponse(org.apache.hadoop.mapreduce.v2.api.protocolrecords.GetTaskReportResponse) GetDiagnosticsResponse(org.apache.hadoop.mapreduce.v2.api.protocolrecords.GetDiagnosticsResponse) MRClientProtocol(org.apache.hadoop.mapreduce.v2.api.MRClientProtocol) GetTaskAttemptReportResponse(org.apache.hadoop.mapreduce.v2.api.protocolrecords.GetTaskAttemptReportResponse) GetTaskReportRequest(org.apache.hadoop.mapreduce.v2.api.protocolrecords.GetTaskReportRequest) GetTaskAttemptCompletionEventsRequest(org.apache.hadoop.mapreduce.v2.api.protocolrecords.GetTaskAttemptCompletionEventsRequest) TaskAttempt(org.apache.hadoop.mapreduce.v2.app.job.TaskAttempt) GetDiagnosticsRequest(org.apache.hadoop.mapreduce.v2.api.protocolrecords.GetDiagnosticsRequest) Job(org.apache.hadoop.mapreduce.v2.app.job.Job) JobId(org.apache.hadoop.mapreduce.v2.api.records.JobId) MRApp(org.apache.hadoop.mapreduce.v2.app.MRApp) TaskAttemptId(org.apache.hadoop.mapreduce.v2.api.records.TaskAttemptId) Service(org.apache.hadoop.service.Service) IOException(java.io.IOException) GetTaskAttemptCompletionEventsResponse(org.apache.hadoop.mapreduce.v2.api.protocolrecords.GetTaskAttemptCompletionEventsResponse) GetTaskReportsRequest(org.apache.hadoop.mapreduce.v2.api.protocolrecords.GetTaskReportsRequest) Test(org.junit.Test)

Example 4 with GetDiagnosticsResponse

use of org.apache.hadoop.mapreduce.v2.api.protocolrecords.GetDiagnosticsResponse in project tez by apache.

the class NotRunningJob method getDiagnostics.

@Override
public GetDiagnosticsResponse getDiagnostics(GetDiagnosticsRequest request) throws IOException {
    GetDiagnosticsResponse resp = recordFactory.newRecordInstance(GetDiagnosticsResponse.class);
    resp.addDiagnostics("");
    return resp;
}
Also used : GetDiagnosticsResponse(org.apache.hadoop.mapreduce.v2.api.protocolrecords.GetDiagnosticsResponse)

Aggregations

GetDiagnosticsResponse (org.apache.hadoop.mapreduce.v2.api.protocolrecords.GetDiagnosticsResponse)4 GetDiagnosticsRequest (org.apache.hadoop.mapreduce.v2.api.protocolrecords.GetDiagnosticsRequest)2 IOException (java.io.IOException)1 Configuration (org.apache.hadoop.conf.Configuration)1 MRClientProtocol (org.apache.hadoop.mapreduce.v2.api.MRClientProtocol)1 GetTaskAttemptCompletionEventsRequest (org.apache.hadoop.mapreduce.v2.api.protocolrecords.GetTaskAttemptCompletionEventsRequest)1 GetTaskAttemptCompletionEventsResponse (org.apache.hadoop.mapreduce.v2.api.protocolrecords.GetTaskAttemptCompletionEventsResponse)1 GetTaskAttemptReportRequest (org.apache.hadoop.mapreduce.v2.api.protocolrecords.GetTaskAttemptReportRequest)1 GetTaskAttemptReportResponse (org.apache.hadoop.mapreduce.v2.api.protocolrecords.GetTaskAttemptReportResponse)1 GetTaskReportRequest (org.apache.hadoop.mapreduce.v2.api.protocolrecords.GetTaskReportRequest)1 GetTaskReportResponse (org.apache.hadoop.mapreduce.v2.api.protocolrecords.GetTaskReportResponse)1 GetTaskReportsRequest (org.apache.hadoop.mapreduce.v2.api.protocolrecords.GetTaskReportsRequest)1 JobId (org.apache.hadoop.mapreduce.v2.api.records.JobId)1 TaskAttemptId (org.apache.hadoop.mapreduce.v2.api.records.TaskAttemptId)1 TaskId (org.apache.hadoop.mapreduce.v2.api.records.TaskId)1 MRApp (org.apache.hadoop.mapreduce.v2.app.MRApp)1 Job (org.apache.hadoop.mapreduce.v2.app.job.Job)1 Task (org.apache.hadoop.mapreduce.v2.app.job.Task)1 TaskAttempt (org.apache.hadoop.mapreduce.v2.app.job.TaskAttempt)1 MRAppWithHistory (org.apache.hadoop.mapreduce.v2.hs.TestJobHistoryEvents.MRAppWithHistory)1