From 6532995b05ac56cd97610e27c84a5ee707a16497 Mon Sep 17 00:00:00 2001 From: David Kyle Date: Thu, 22 Nov 2018 17:46:22 +0000 Subject: [PATCH] Log get job stats in the right place and fix silly error --- .../action/TransportGetJobsStatsAction.java | 3 +-- .../mixed_cluster/60_ml_config_migration.yml | 8 ++++--- .../60_ml_config_migration.yml | 24 +++++++++---------- 3 files changed, 17 insertions(+), 18 deletions(-) diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportGetJobsStatsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportGetJobsStatsAction.java index 5cae0ef96ee54..0cc5fc068a81c 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportGetJobsStatsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportGetJobsStatsAction.java @@ -74,7 +74,7 @@ public TransportGetJobsStatsAction(Settings settings, TransportService transport @Override protected void doExecute(Task task, GetJobsStatsAction.Request request, ActionListener finalListener) { - + logger.debug("Get stats for job [{}]", request.getJobId()); jobManager.expandJobIds(request.getJobId(), request.allowNoJobs(), ActionListener.wrap( expandedIds -> { request.setExpandedJobsIds(new ArrayList<>(expandedIds)); @@ -111,7 +111,6 @@ protected QueryPage readTaskResponse(Strea protected void taskOperation(GetJobsStatsAction.Request request, TransportOpenJobAction.JobTask task, ActionListener> listener) { String jobId = task.getJobId(); - logger.debug("Get stats for job [{}]", jobId); ClusterState state = clusterService.state(); PersistentTasksCustomMetaData tasks = state.getMetaData().custom(PersistentTasksCustomMetaData.TYPE); Optional> stats = processManager.getStatistics(task); diff --git a/x-pack/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/mixed_cluster/60_ml_config_migration.yml b/x-pack/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/mixed_cluster/60_ml_config_migration.yml index 9bb825c7b567e..6e06d2d4db827 100644 --- a/x-pack/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/mixed_cluster/60_ml_config_migration.yml +++ b/x-pack/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/mixed_cluster/60_ml_config_migration.yml @@ -14,14 +14,15 @@ - do: xpack.ml.get_job_stats: - job_id: migration-old-cluster-open-job + job_id: migration* - match: { count: 2 } - match: { jobs.0.job_id: migration-old-cluster-closed-job} - match: { jobs.0.state: closed } - is_false: jobs.0.node - match: { jobs.1.job_id: migration-old-cluster-open-job} - match: { jobs.1.state: opened } - - is_true: jobs.1.node +# TODO can't test for assignment here as the job may not be re-allocated yet +# - is_true: jobs.1.node - is_false: jobs.1.assignment_explanation - do: @@ -38,7 +39,8 @@ datafeed_id: migration* - match: { datafeeds.0.datafeed_id: migration-old-cluster-started-datafeed} - match: { datafeeds.0.state: started } - - is_true: datafeeds.0.node +# TODO can't test for assignment here as the datafeed may not be re-allocated yet +# - is_true: datafeeds.0.node - match: { datafeeds.1.datafeed_id: migration-old-cluster-stopped-datafeed} - match: { datafeeds.1.state: stopped } - is_false: datafeeds.1.node diff --git a/x-pack/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/upgraded_cluster/60_ml_config_migration.yml b/x-pack/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/upgraded_cluster/60_ml_config_migration.yml index af437c012a224..c22815a0ae799 100644 --- a/x-pack/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/upgraded_cluster/60_ml_config_migration.yml +++ b/x-pack/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/upgraded_cluster/60_ml_config_migration.yml @@ -18,19 +18,16 @@ setup: - do: xpack.ml.get_job_stats: - job_id: migration-old-cluster-open-job -# - match: { count: 2 } -# - match: { jobs.0.job_id: migration-old-cluster-closed-job } -# - match: { jobs.0.state: closed } -# - is_false: jobs.0.node -# - match: { jobs.1.job_id: migration-old-cluster-open-job } -# - match: { jobs.1.state: opened } + job_id: migration* + - match: { count: 2 } + - match: { jobs.0.job_id: migration-old-cluster-closed-job } + - match: { jobs.0.state: closed } + - is_false: jobs.0.node + - match: { jobs.1.job_id: migration-old-cluster-open-job } + - match: { jobs.1.state: opened } +# TODO can't test for assignment here as the job may not be re-allocated yet # - is_true: jobs.1.node -# - is_false: jobs.1.assignment_explanation - - match: { jobs.0.job_id: migration-old-cluster-open-job } - - match: { jobs.0.state: opened } - - is_true: jobs.0.node - - is_false: jobs.0.assignment_explanation + - is_false: jobs.1.assignment_explanation - do: xpack.ml.get_datafeeds: @@ -46,7 +43,8 @@ setup: datafeed_id: migration* - match: { datafeeds.0.datafeed_id: migration-old-cluster-started-datafeed } - match: { datafeeds.0.state: started } - - is_true: datafeeds.0.node +# TODO can't test for assignment here as the datafeed may not be re-allocated yet +# - is_true: datafeeds.0.node - match: { datafeeds.1.datafeed_id: migration-old-cluster-stopped-datafeed } - match: { datafeeds.1.state: stopped } - is_false: datafeeds.1.node