private String getTaskType(TaskAttemptExecutionAPIEntity taskAttemptInfo) { return taskAttemptInfo.getTags().get(MRJobTagName.TASK_TYPE.toString()); }
@Override public void flush(TaskAttemptExecutionAPIEntity entity) { Map<String, Object> fields = new HashMap<>(entity.getTags()); fields.put("startTime", entity.getStartTime()); fields.put("endTime", entity.getEndTime()); fields.put("taskStatus", entity.getTaskStatus()); if (!fields.containsKey(MRJobTagName.ERROR_CATEGORY.toString())) { fields.put("errorCategory", ""); } collector.collect(stormStreamId, new ValuesArray(fields.get(MRJobTagName.TASK_ATTEMPT_ID.toString()), fields)); } }
@Override public void jobEntityCreated(JobBaseAPIEntity entity) throws Exception { if (!(entity instanceof TaskAttemptExecutionAPIEntity)) { return; } TaskAttemptExecutionAPIEntity e = (TaskAttemptExecutionAPIEntity) entity; Map<String, String> tags = new HashMap<>(); tags.put(MRJobTagName.SITE.toString(), e.getTags().get(MRJobTagName.SITE.toString())); tags.put(MRJobTagName.JOD_DEF_ID.toString(), e.getTags().get(MRJobTagName.JOD_DEF_ID.toString())); tags.put(MRJobTagName.RACK.toString(), e.getTags().get(MRJobTagName.RACK.toString())); tags.put(MRJobTagName.HOSTNAME.toString(), e.getTags().get(MRJobTagName.HOSTNAME.toString())); tags.put(MRJobTagName.JOB_ID.toString(), e.getTags().get(MRJobTagName.JOB_ID.toString())); tags.put(MRJobTagName.TASK_TYPE.toString(), e.getTags().get(MRJobTagName.TASK_TYPE.toString())); CounterKey key = new CounterKey(); key.tags = tags; key.timestamp = roundToMinute(e.getEndTime()); CounterValue value = counters.get(key); if (value == null) { value = new CounterValue(); counters.put(key, value); } if (e.getTaskStatus().equals(EagleTaskStatus.FAILED.name())) { value.failedCount++; } else if (e.getTaskStatus().equals(EagleTaskStatus.KILLED.name())) { value.killedCount++; } value.totalCount++; }
Map<String, String> tags = new HashMap<>(); failureTask.setTags(tags); tags.put(MRJobTagName.SITE.toString(), e.getTags().get(MRJobTagName.SITE.toString())); tags.put(MRJobTagName.JOD_DEF_ID.toString(), e.getTags().get(MRJobTagName.JOD_DEF_ID.toString())); tags.put(MRJobTagName.RACK.toString(), e.getTags().get(MRJobTagName.RACK.toString())); tags.put(MRJobTagName.HOSTNAME.toString(), e.getTags().get(MRJobTagName.HOSTNAME.toString())); tags.put(MRJobTagName.JOB_ID.toString(), e.getTags().get(MRJobTagName.JOB_ID.toString())); tags.put(MRJobTagName.TASK_ATTEMPT_ID.toString(), e.getTags().get(MRJobTagName.TASK_ATTEMPT_ID.toString())); tags.put(MRJobTagName.TASK_TYPE.toString(), e.getTags().get(MRJobTagName.TASK_TYPE.toString()));
private void taskAttemptEntityCreated(TaskAttemptExecutionAPIEntity entity) { JobCounters jobCounters = entity.getJobCounters(); String taskType = entity.getTags().get(TASK_TYPE.toString()); if (taskType != null && jobCounters != null && jobCounters.getCounters() != null) { if (Constants.TaskType.MAP.toString().equals(taskType.toUpperCase())) { mapAttemptDuration += entity.getDuration(); this.mapTaskAttemptCounterAgg.accumulate(jobCounters.getCounters().get(Constants.TASK_COUNTER)); this.mapFileSystemCounterAgg.accumulate(jobCounters.getCounters().get(Constants.FILE_SYSTEM_COUNTER)); return; } else if (Constants.TaskType.REDUCE.toString().equals(taskType.toUpperCase())) { reduceAttemptDuration += entity.getDuration(); this.reduceTaskAttemptCounterAgg.accumulate(jobCounters.getCounters().get(Constants.TASK_COUNTER)); this.reduceFileSystemTaskCounterAgg.accumulate(jobCounters.getCounters().get(Constants.FILE_SYSTEM_COUNTER)); return; } } ObjectMapper objectMapper = new ObjectMapper(); try { LOG.warn("Unknown task type of task attempt execution entity: " + objectMapper.writeValueAsString(entity)); } catch (Exception e) { LOG.error(e.getMessage(), e); } }
attempt2ErrorMsg.put(taskAttemptID, Pair.of(taskID, entity.getError())); if (entity.getTags().containsKey(MRJobTagName.ERROR_CATEGORY.toString())) { TaskAttemptErrorCategoryEntity taskAttemptErrorCategoryEntity = new TaskAttemptErrorCategoryEntity(); Map<String, String> taskAttemptErrorCategoryEntityTags = new HashMap<>(entity.getTags()); taskAttemptErrorCategoryEntity.setTags(taskAttemptErrorCategoryEntityTags); entityCreated(taskAttemptErrorCategoryEntity); String errorCategory = entity.getTags().get(MRJobTagName.ERROR_CATEGORY.toString()); if (!errorCategoryTaskMapping.containsKey(errorCategory)) { errorCategoryTaskMapping.put(errorCategory, new HashMap<>());