@TransactionalWrite @Override public void updateOnlyPredictionHistory(PredictionBatch pb, Long predictorId) { validationService.validate(pb); DateTime start = toPredictionResolution(pb.sourceTimestamp); List<Prediction> predictions = normalizeToPredictionWindow(start, pb.predictions); savePredictionHistory( predictorId, start, filterToSelectedPredictionDistances(start, predictions)); }
@TransactionalWrite @Override public void updatePredictions(PredictionBatch pb, Long predictorId) { validationService.validate(pb); UtilizationKey utilizationKey = pb.utilizationKey; DateTime start = toPredictionResolution(pb.sourceTimestamp); List<Prediction> predictions = normalizeToPredictionWindow(start, pb.predictions); long updatedRows = maybeUpdatePredictionLookupTable(utilizationKey, start, predictions); if (updatedRows == 0) { initializePredictionLookupTable(utilizationKey); updatePredictions(pb, predictorId); // retry now that the lookup table exists } else { savePredictionHistory( predictorId, start, filterToSelectedPredictionDistances(start, predictions)); } }