Java Code Examples for org.apache.hadoop.mapreduce.v2.api.records.Counters#addAllCounterGroups()

The following examples show how to use org.apache.hadoop.mapreduce.v2.api.records.Counters#addAllCounterGroups() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TypeConverter.java    From hadoop with Apache License 2.0 6 votes vote down vote up
public static Counters toYarn(org.apache.hadoop.mapred.Counters counters) {
  if (counters == null) {
    return null;
  }
  Counters yCntrs = recordFactory.newRecordInstance(Counters.class);
  yCntrs.addAllCounterGroups(new HashMap<String, CounterGroup>());
  for (org.apache.hadoop.mapred.Counters.Group grp : counters) {
    CounterGroup yGrp = recordFactory.newRecordInstance(CounterGroup.class);
    yGrp.setName(grp.getName());
    yGrp.setDisplayName(grp.getDisplayName());
    yGrp.addAllCounters(new HashMap<String, Counter>());
    for (org.apache.hadoop.mapred.Counters.Counter cntr : grp) {
      Counter yCntr = recordFactory.newRecordInstance(Counter.class);
      yCntr.setName(cntr.getName());
      yCntr.setDisplayName(cntr.getDisplayName());
      yCntr.setValue(cntr.getValue());
      yGrp.setCounter(yCntr.getName(), yCntr);
    }
    yCntrs.setCounterGroup(yGrp.getName(), yGrp);
  }
  return yCntrs;
}
 
Example 2
Source File: TypeConverter.java    From hadoop with Apache License 2.0 6 votes vote down vote up
public static Counters toYarn(org.apache.hadoop.mapreduce.Counters counters) {
  if (counters == null) {
    return null;
  }
  Counters yCntrs = recordFactory.newRecordInstance(Counters.class);
  yCntrs.addAllCounterGroups(new HashMap<String, CounterGroup>());
  for (org.apache.hadoop.mapreduce.CounterGroup grp : counters) {
    CounterGroup yGrp = recordFactory.newRecordInstance(CounterGroup.class);
    yGrp.setName(grp.getName());
    yGrp.setDisplayName(grp.getDisplayName());
    yGrp.addAllCounters(new HashMap<String, Counter>());
    for (org.apache.hadoop.mapreduce.Counter cntr : grp) {
      Counter yCntr = recordFactory.newRecordInstance(Counter.class);
      yCntr.setName(cntr.getName());
      yCntr.setDisplayName(cntr.getDisplayName());
      yCntr.setValue(cntr.getValue());
      yGrp.setCounter(yCntr.getName(), yCntr);
    }
    yCntrs.setCounterGroup(yGrp.getName(), yGrp);
  }
  return yCntrs;
}
 
Example 3
Source File: TypeConverter.java    From big-c with Apache License 2.0 6 votes vote down vote up
public static Counters toYarn(org.apache.hadoop.mapred.Counters counters) {
  if (counters == null) {
    return null;
  }
  Counters yCntrs = recordFactory.newRecordInstance(Counters.class);
  yCntrs.addAllCounterGroups(new HashMap<String, CounterGroup>());
  for (org.apache.hadoop.mapred.Counters.Group grp : counters) {
    CounterGroup yGrp = recordFactory.newRecordInstance(CounterGroup.class);
    yGrp.setName(grp.getName());
    yGrp.setDisplayName(grp.getDisplayName());
    yGrp.addAllCounters(new HashMap<String, Counter>());
    for (org.apache.hadoop.mapred.Counters.Counter cntr : grp) {
      Counter yCntr = recordFactory.newRecordInstance(Counter.class);
      yCntr.setName(cntr.getName());
      yCntr.setDisplayName(cntr.getDisplayName());
      yCntr.setValue(cntr.getValue());
      yGrp.setCounter(yCntr.getName(), yCntr);
    }
    yCntrs.setCounterGroup(yGrp.getName(), yGrp);
  }
  return yCntrs;
}
 
Example 4
Source File: TypeConverter.java    From big-c with Apache License 2.0 6 votes vote down vote up
public static Counters toYarn(org.apache.hadoop.mapreduce.Counters counters) {
  if (counters == null) {
    return null;
  }
  Counters yCntrs = recordFactory.newRecordInstance(Counters.class);
  yCntrs.addAllCounterGroups(new HashMap<String, CounterGroup>());
  for (org.apache.hadoop.mapreduce.CounterGroup grp : counters) {
    CounterGroup yGrp = recordFactory.newRecordInstance(CounterGroup.class);
    yGrp.setName(grp.getName());
    yGrp.setDisplayName(grp.getDisplayName());
    yGrp.addAllCounters(new HashMap<String, Counter>());
    for (org.apache.hadoop.mapreduce.Counter cntr : grp) {
      Counter yCntr = recordFactory.newRecordInstance(Counter.class);
      yCntr.setName(cntr.getName());
      yCntr.setDisplayName(cntr.getDisplayName());
      yCntr.setValue(cntr.getValue());
      yGrp.setCounter(yCntr.getName(), yCntr);
    }
    yCntrs.setCounterGroup(yGrp.getName(), yGrp);
  }
  return yCntrs;
}
 
Example 5
Source File: NotRunningJob.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Override
public GetCountersResponse getCounters(GetCountersRequest request)
    throws IOException {
  GetCountersResponse resp =
    recordFactory.newRecordInstance(GetCountersResponse.class);
  Counters counters = recordFactory.newRecordInstance(Counters.class);
  counters.addAllCounterGroups(new HashMap<String, CounterGroup>());
  resp.setCounters(counters);
  return resp;
}
 
Example 6
Source File: NotRunningJob.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Override
public GetTaskReportResponse getTaskReport(GetTaskReportRequest request)
    throws IOException {
  GetTaskReportResponse resp =
    recordFactory.newRecordInstance(GetTaskReportResponse.class);
  TaskReport report = recordFactory.newRecordInstance(TaskReport.class);
  report.setTaskId(request.getTaskId());
  report.setTaskState(TaskState.NEW);
  Counters counters = recordFactory.newRecordInstance(Counters.class);
  counters.addAllCounterGroups(new HashMap<String, CounterGroup>());
  report.setCounters(counters);
  report.addAllRunningAttempts(new ArrayList<TaskAttemptId>());
  return resp;
}
 
Example 7
Source File: NotRunningJob.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Override
public GetCountersResponse getCounters(GetCountersRequest request)
    throws IOException {
  GetCountersResponse resp =
    recordFactory.newRecordInstance(GetCountersResponse.class);
  Counters counters = recordFactory.newRecordInstance(Counters.class);
  counters.addAllCounterGroups(new HashMap<String, CounterGroup>());
  resp.setCounters(counters);
  return resp;
}
 
Example 8
Source File: NotRunningJob.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Override
public GetTaskReportResponse getTaskReport(GetTaskReportRequest request)
    throws IOException {
  GetTaskReportResponse resp =
    recordFactory.newRecordInstance(GetTaskReportResponse.class);
  TaskReport report = recordFactory.newRecordInstance(TaskReport.class);
  report.setTaskId(request.getTaskId());
  report.setTaskState(TaskState.NEW);
  Counters counters = recordFactory.newRecordInstance(Counters.class);
  counters.addAllCounterGroups(new HashMap<String, CounterGroup>());
  report.setCounters(counters);
  report.addAllRunningAttempts(new ArrayList<TaskAttemptId>());
  return resp;
}
 
Example 9
Source File: NotRunningJob.java    From incubator-tez with Apache License 2.0 5 votes vote down vote up
@Override
public GetCountersResponse getCounters(GetCountersRequest request)
    throws IOException {
  GetCountersResponse resp =
    recordFactory.newRecordInstance(GetCountersResponse.class);
  Counters counters = recordFactory.newRecordInstance(Counters.class);
  counters.addAllCounterGroups(new HashMap<String, CounterGroup>());
  resp.setCounters(counters);
  return resp;
}
 
Example 10
Source File: NotRunningJob.java    From incubator-tez with Apache License 2.0 5 votes vote down vote up
@Override
public GetTaskReportResponse getTaskReport(GetTaskReportRequest request)
    throws IOException {
  GetTaskReportResponse resp =
    recordFactory.newRecordInstance(GetTaskReportResponse.class);
  TaskReport report = recordFactory.newRecordInstance(TaskReport.class);
  report.setTaskId(request.getTaskId());
  report.setTaskState(TaskState.NEW);
  Counters counters = recordFactory.newRecordInstance(Counters.class);
  counters.addAllCounterGroups(new HashMap<String, CounterGroup>());
  report.setCounters(counters);
  report.addAllRunningAttempts(new ArrayList<TaskAttemptId>());
  return resp;
}
 
Example 11
Source File: NotRunningJob.java    From tez with Apache License 2.0 5 votes vote down vote up
@Override
public GetCountersResponse getCounters(GetCountersRequest request)
    throws IOException {
  GetCountersResponse resp =
    recordFactory.newRecordInstance(GetCountersResponse.class);
  Counters counters = recordFactory.newRecordInstance(Counters.class);
  counters.addAllCounterGroups(new HashMap<String, CounterGroup>());
  resp.setCounters(counters);
  return resp;
}
 
Example 12
Source File: NotRunningJob.java    From tez with Apache License 2.0 5 votes vote down vote up
@Override
public GetTaskReportResponse getTaskReport(GetTaskReportRequest request)
    throws IOException {
  GetTaskReportResponse resp =
    recordFactory.newRecordInstance(GetTaskReportResponse.class);
  TaskReport report = recordFactory.newRecordInstance(TaskReport.class);
  report.setTaskId(request.getTaskId());
  report.setTaskState(TaskState.NEW);
  Counters counters = recordFactory.newRecordInstance(Counters.class);
  counters.addAllCounterGroups(new HashMap<String, CounterGroup>());
  report.setCounters(counters);
  report.addAllRunningAttempts(new ArrayList<TaskAttemptId>());
  return resp;
}