private List<MRTaskExecutionResponse.SuggestionResult> getDeviationSuggest(double avgSmaller, double avgLarger) { if (avgSmaller <= 0) { avgSmaller = 1; } double deviation = avgLarger / avgSmaller; String suggestName = String.format(DEVIATION_SUGGEST_FORMAT, counterName.getName()); String suggestion = null; if (deviation > threshold) { suggestion = String.format(DATA_SKEW_SUGGESTION_FORMAT, counterName.getName(), threshold, avgLarger, avgSmaller); } List<MRTaskExecutionResponse.SuggestionResult> suggestionResults = new ArrayList<>(); suggestionResults.add(new MRTaskExecutionResponse.SuggestionResult(suggestName, deviation, suggestion)); return suggestionResults; } }
private List<MRTaskExecutionResponse.SuggestionResult> getSpillSuggest(double smallerSpillBytes, double largerSpillBytes) { if (smallerSpillBytes == 0) { smallerSpillBytes = 1; } double deviation = largerSpillBytes / smallerSpillBytes; String suggestion = null; if (deviation > threshold) { suggestion = String.format(SPILL_SUGGESTION_FORMAT, threshold, largerSpillBytes, smallerSpillBytes); } List<MRTaskExecutionResponse.SuggestionResult> suggestionResults = new ArrayList<>(); String suggestName = String.format(SPILL_RATIO_NAME_FORMAT, JobCounters.CounterName.SPLIT_RAW_BYTES.getName()); suggestionResults.add(new MRTaskExecutionResponse.SuggestionResult(suggestName, deviation, suggestion)); return suggestionResults; } }
public MRTaskExecutionResponse.TaskDistributionResponse getHistoryTaskDistribution(List<org.apache.eagle.jpm.mr.historyentity.TaskExecutionAPIEntity> tasks, String counterName, String distRange) { MRTaskExecutionResponse.TaskDistributionResponse response = new MRTaskExecutionResponse.TaskDistributionResponse(); response.counterName = counterName; List<Long> distRangeList = ResourceUtils.parseDistributionList(distRange); for (int i = 0; i < distRangeList.size(); i++) { response.taskBuckets.add(new MRTaskExecutionResponse.CountUnit(distRangeList.get(i))); } JobCounters.CounterName jobCounterName = JobCounters.CounterName.valueOf(counterName.toUpperCase()); for (org.apache.eagle.jpm.mr.historyentity.TaskExecutionAPIEntity task : tasks) { Long counterValue = task.getJobCounters().getCounterValue(jobCounterName); int pos = ResourceUtils.getDistributionPosition(distRangeList, counterValue); response.taskBuckets.get(pos).countVal++; } return response; }
private List<MRTaskExecutionResponse.SuggestionResult> getGCsuggest(double smallerRatio, double largerRatio) { if (smallerRatio <= 0) { smallerRatio = 1; } double deviation = largerRatio / smallerRatio; String suggestName = String.format(GC_RATIO_NAME_FORMAT, JobCounters.CounterName.GC_MILLISECONDS.getName(), JobCounters.CounterName.CPU_MILLISECONDS.getName()); String suggestion = null; if (deviation > threshold) { suggestion = String.format(GC_SUGGESTION_FORMAT, threshold, largerRatio, smallerRatio); } List<MRTaskExecutionResponse.SuggestionResult> suggestionResults = new ArrayList<>(); suggestionResults.add(new MRTaskExecutionResponse.SuggestionResult(suggestName, deviation, suggestion)); return suggestionResults; }