From aa86d57487f5e11f5fe0bdddf55431ff5af9e197 Mon Sep 17 00:00:00 2001 From: Dimitrios Athanasiou Date: Mon, 6 Feb 2017 13:48:41 +0000 Subject: [PATCH] Include start/end in log message for starting datafeed Original commit: elastic/x-pack-elasticsearch@7b88bb27c1bfe64d28626d6373285cbff7d7b2ee --- .../elasticsearch/xpack/ml/action/StartDatafeedAction.java | 1 - .../elasticsearch/xpack/ml/datafeed/DatafeedJobRunner.java | 7 ++++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/StartDatafeedAction.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/StartDatafeedAction.java index 15bb7d9d30a..4ba07422256 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/StartDatafeedAction.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/StartDatafeedAction.java @@ -55,7 +55,6 @@ public class StartDatafeedAction public static final ParseField START_TIME = new ParseField("start"); public static final ParseField END_TIME = new ParseField("end"); - public static final ParseField START_TIMEOUT = new ParseField("start_timeout"); public static final StartDatafeedAction INSTANCE = new StartDatafeedAction(); public static final String NAME = "cluster:admin/ml/datafeeds/start"; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/datafeed/DatafeedJobRunner.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/datafeed/DatafeedJobRunner.java index fd0461d5ad2..06e903a39b6 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/datafeed/DatafeedJobRunner.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/datafeed/DatafeedJobRunner.java @@ -12,6 +12,7 @@ import org.elasticsearch.common.component.AbstractComponent; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.util.concurrent.FutureUtils; +import org.elasticsearch.index.mapper.DateFieldMapper; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.xpack.ml.MlPlugin; import org.elasticsearch.xpack.ml.action.StartDatafeedAction; @@ -40,6 +41,8 @@ import java.util.function.Supplier; public class DatafeedJobRunner extends AbstractComponent { + private static final String INF_SYMBOL = "\u221E"; + private final Client client; private final ClusterService clusterService; private final JobProvider jobProvider; @@ -80,7 +83,9 @@ public class DatafeedJobRunner extends AbstractComponent { // otherwise if a stop datafeed call is made immediately after the start datafeed call we could cancel // the DatafeedTask without stopping datafeed, which causes the datafeed to keep on running. private void innerRun(Holder holder, long startTime, Long endTime) { - logger.info("Starting datafeed [{}] for job [{}]", holder.datafeed.getId(), holder.datafeed.getJobId()); + logger.info("Starting datafeed [{}] for job [{}] in [{}, {})", holder.datafeed.getId(), holder.datafeed.getJobId(), + DateFieldMapper.DEFAULT_DATE_TIME_FORMATTER.printer().print(startTime), + endTime == null ? INF_SYMBOL : DateFieldMapper.DEFAULT_DATE_TIME_FORMATTER.printer().print(endTime)); holder.future = threadPool.executor(MlPlugin.DATAFEED_RUNNER_THREAD_POOL_NAME).submit(() -> { Long next = null; try {