[ML] Improve datafeed notifications (elastic/x-pack-elasticsearch#951)

- include 'real-time' instead of now as the end time for real-time
  datafeeds
- do not notify lookback is completed when datafeed was stopped
- do not notify datafeed switch to real-time when datafeed was stopped

Relates elastic/x-pack-elasticsearch#878

Original commit: elastic/x-pack-elasticsearch@aa22f9b86f
This commit is contained in:
Dimitris Athanasiou 2017-04-04 17:04:41 +01:00 committed by GitHub
parent dee1bd1825
commit 38706faec7

View File

@ -81,19 +81,25 @@ class DatafeedJob {
String msg = Messages.getMessage(Messages.JOB_AUDIT_DATAFEED_STARTED_FROM_TO, String msg = Messages.getMessage(Messages.JOB_AUDIT_DATAFEED_STARTED_FROM_TO,
DateFieldMapper.DEFAULT_DATE_TIME_FORMATTER.printer().print(lookbackStartTimeMs), DateFieldMapper.DEFAULT_DATE_TIME_FORMATTER.printer().print(lookbackStartTimeMs),
DateFieldMapper.DEFAULT_DATE_TIME_FORMATTER.printer().print(lookbackEnd)); endTime == null ? "real-time" : DateFieldMapper.DEFAULT_DATE_TIME_FORMATTER.printer().print(lookbackEnd));
auditor.info(jobId, msg); auditor.info(jobId, msg);
FlushJobAction.Request request = new FlushJobAction.Request(jobId); FlushJobAction.Request request = new FlushJobAction.Request(jobId);
request.setCalcInterim(true); request.setCalcInterim(true);
run(lookbackStartTimeMs, lookbackEnd, request); run(lookbackStartTimeMs, lookbackEnd, request);
auditor.info(jobId, Messages.getMessage(Messages.JOB_AUDIT_DATAFEED_LOOKBACK_COMPLETED));
LOGGER.info("[{}] Lookback has finished", jobId); if (isRunning()) {
if (isLookbackOnly) { auditor.info(jobId, Messages.getMessage(Messages.JOB_AUDIT_DATAFEED_LOOKBACK_COMPLETED));
return null; LOGGER.info("[{}] Lookback has finished", jobId);
if (isLookbackOnly) {
return null;
} else {
auditor.info(jobId, Messages.getMessage(Messages.JOB_AUDIT_DATAFEED_CONTINUED_REALTIME));
return nextRealtimeTimestamp();
}
} else { } else {
auditor.info(jobId, Messages.getMessage(Messages.JOB_AUDIT_DATAFEED_CONTINUED_REALTIME)); LOGGER.debug("Lookback finished after being stopped");
return nextRealtimeTimestamp(); return null;
} }
} }