Search in sources :

Example 6 with GetCountersRequest

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

the class TestClientServiceDelegate method testCountersFromHistoryServer.

@Test
public void testCountersFromHistoryServer() throws Exception {
    MRClientProtocol historyServerProxy = mock(MRClientProtocol.class);
    when(historyServerProxy.getCounters(getCountersRequest())).thenReturn(getCountersResponseFromHistoryServer());
    ResourceMgrDelegate rm = mock(ResourceMgrDelegate.class);
    when(rm.getApplicationReport(TypeConverter.toYarn(oldJobId).getAppId())).thenReturn(null);
    ClientServiceDelegate clientServiceDelegate = getClientServiceDelegate(historyServerProxy, rm);
    Counters counters = TypeConverter.toYarn(clientServiceDelegate.getJobCounters(oldJobId));
    Assert.assertNotNull(counters);
    Assert.assertEquals(1001, counters.getCounterGroup("dummyCounters").getCounter("dummyCounter").getValue());
}
Also used : Counters(org.apache.hadoop.mapreduce.v2.api.records.Counters) MRClientProtocol(org.apache.hadoop.mapreduce.v2.api.MRClientProtocol) Test(org.junit.Test)

Aggregations

GetCountersRequest (org.apache.hadoop.mapreduce.v2.api.protocolrecords.GetCountersRequest)4 Counters (org.apache.hadoop.mapreduce.v2.api.records.Counters)3 Test (org.junit.Test)3 MRClientProtocol (org.apache.hadoop.mapreduce.v2.api.MRClientProtocol)2 GetCountersResponse (org.apache.hadoop.mapreduce.v2.api.protocolrecords.GetCountersResponse)2 CounterGroup (org.apache.hadoop.mapreduce.v2.api.records.CounterGroup)2 IOException (java.io.IOException)1 Configuration (org.apache.hadoop.conf.Configuration)1 GetDiagnosticsRequest (org.apache.hadoop.mapreduce.v2.api.protocolrecords.GetDiagnosticsRequest)1 GetJobReportRequest (org.apache.hadoop.mapreduce.v2.api.protocolrecords.GetJobReportRequest)1 GetTaskAttemptCompletionEventsRequest (org.apache.hadoop.mapreduce.v2.api.protocolrecords.GetTaskAttemptCompletionEventsRequest)1 GetTaskAttemptReportRequest (org.apache.hadoop.mapreduce.v2.api.protocolrecords.GetTaskAttemptReportRequest)1 GetTaskReportRequest (org.apache.hadoop.mapreduce.v2.api.protocolrecords.GetTaskReportRequest)1 GetTaskReportsRequest (org.apache.hadoop.mapreduce.v2.api.protocolrecords.GetTaskReportsRequest)1 JobReport (org.apache.hadoop.mapreduce.v2.api.records.JobReport)1 TaskAttemptReport (org.apache.hadoop.mapreduce.v2.api.records.TaskAttemptReport)1 TaskReport (org.apache.hadoop.mapreduce.v2.api.records.TaskReport)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