public JPMEntityRepository() { entitySet.add(JobExecutionAPIEntity.class); entitySet.add(TaskExecutionAPIEntity.class); entitySet.add(TaskAttemptExecutionAPIEntity.class); entitySet.add(YarnAppAPIEntity.class); serDeserMap.put(JobConfig.class, new JobConfigSerDeser()); serDeserMap.put(JobCounters.class, new JobCountersSerDeser()); } }
final Map<String, Long> counterMap = entry.getValue(); try { nextGroupPos = pos = serializeGroup(buffer, pos, groupName, counterMap); ++totalGroups; } catch (JobCounterException ex) {
private int serializeGroup(byte[] buffer, int currentPos, String groupName, Map<String, Long> counterMap) throws JobCounterException { int pos = currentPos; final CounterGroupKey groupKey = getCounterGroup(groupName); if (groupKey == null) { throw new JobCounterException("Group name " + groupName + " is not defined"); } Bytes.putInt(buffer, pos, groupKey.getIndex()); pos += 4; int totalCounterNumberPos = pos; pos += 4; int totalCounters = 0; for (Map.Entry<String, Long> entry : counterMap.entrySet()) { final String counterName = entry.getKey(); final CounterKey counterKey = groupKey.getCounterKeyByName(counterName); if (counterKey == null) { continue; } final Long counterValue = entry.getValue(); Bytes.putInt(buffer, pos, counterKey.getIndex()); pos += 4; Bytes.putLong(buffer, pos, counterValue); pos += 8; ++totalCounters; } Bytes.putInt(buffer, totalCounterNumberPos, totalCounters); return pos; }
final int nextGroupPos = pos + (totalCounters * 12); try { final CounterGroupKey groupKey = getCounterGroup(groupIndex); if (groupKey == null) { throw new JobCounterException("Group index " + groupIndex + " is not defined");
public JPAEntityRepository() { serDeserMap.put(JobCounters.class, new JobCountersSerDeser()); serDeserMap.put(JobConfig.class, new JobConfigSerDeser()); entitySet.add(JobConfigurationAPIEntity.class); entitySet.add(JobEventAPIEntity.class); entitySet.add(JobExecutionAPIEntity.class); entitySet.add(JobErrorCategoryMappingAPIEntity.class); entitySet.add(TaskAttemptExecutionAPIEntity.class); entitySet.add(TaskExecutionAPIEntity.class); entitySet.add(TaskFailureCountAPIEntity.class); entitySet.add(TaskAttemptCounterAPIEntity.class); entitySet.add(JobProcessTimeStampEntity.class); entitySet.add(JobCountEntity.class); entitySet.add(TaskAttemptErrorCategoryEntity.class); entitySet.add(JobSuggestionAPIEntity.class); entitySet.add(JobRpcAnalysisAPIEntity.class); } }