renamed `scheduler_status` to `scheduler_state` in get job response

Original commit: elastic/x-pack-elasticsearch@a7955eb027
This commit is contained in:
Martijn van Groningen 2016-12-09 15:18:30 +01:00
parent d5412627d2
commit b42f9cccb0
4 changed files with 14 additions and 14 deletions

View File

@ -68,11 +68,11 @@ public class GetJobsAction extends Action<GetJobsAction.Request, GetJobsAction.R
private static final String CONFIG = "config"; private static final String CONFIG = "config";
private static final String DATA_COUNTS = "data_counts"; private static final String DATA_COUNTS = "data_counts";
private static final String MODEL_SIZE_STATS = "model_size_stats"; private static final String MODEL_SIZE_STATS = "model_size_stats";
private static final String SCHEDULER_STATE = "scheduler_state"; private static final String SCHEDULER_STATUS = "scheduler_status";
private static final String STATUS = "status"; private static final String STATUS = "status";
private static final List<String> METRIC_WHITELIST = Arrays.asList(ALL, CONFIG, DATA_COUNTS, private static final List<String> METRIC_WHITELIST = Arrays.asList(ALL, CONFIG, DATA_COUNTS,
MODEL_SIZE_STATS, SCHEDULER_STATE, STATUS); MODEL_SIZE_STATS, SCHEDULER_STATUS, STATUS);
private GetJobsAction() { private GetJobsAction() {
super(NAME); super(NAME);
@ -195,7 +195,7 @@ public class GetJobsAction extends Action<GetJobsAction.Request, GetJobsAction.R
config(stats.contains(CONFIG)); config(stats.contains(CONFIG));
dataCounts(stats.contains(DATA_COUNTS)); dataCounts(stats.contains(DATA_COUNTS));
modelSizeStats(stats.contains(MODEL_SIZE_STATS)); modelSizeStats(stats.contains(MODEL_SIZE_STATS));
schedulerStatus(stats.contains(SCHEDULER_STATE)); schedulerStatus(stats.contains(SCHEDULER_STATUS));
status(stats.contains(STATUS)); status(stats.contains(STATUS));
} }
} }
@ -343,7 +343,7 @@ public class GetJobsAction extends Action<GetJobsAction.Request, GetJobsAction.R
builder.field(MODEL_SIZE_STATS, modelSizeStats); builder.field(MODEL_SIZE_STATS, modelSizeStats);
} }
if (schedulerStatus != null) { if (schedulerStatus != null) {
builder.field(SCHEDULER_STATE, schedulerStatus); builder.field(SCHEDULER_STATUS, schedulerStatus);
} }
if (status != null) { if (status != null) {
builder.field(STATUS, status); builder.field(STATUS, status);

View File

@ -188,7 +188,7 @@ public class ScheduledJobIT extends ESRestTestCase {
assertBusy(() -> { assertBusy(() -> {
try { try {
Response getJobResponse = client.performRequest("get", PrelertPlugin.BASE_PATH + "jobs/" + jobId + "/_stats", Response getJobResponse = client.performRequest("get", PrelertPlugin.BASE_PATH + "jobs/" + jobId + "/_stats",
Collections.singletonMap("metric", "scheduler_state")); Collections.singletonMap("metric", "scheduler_status"));
assertThat(responseEntityToString(getJobResponse), containsString("\"status\":\"STOPPED\"")); assertThat(responseEntityToString(getJobResponse), containsString("\"status\":\"STOPPED\""));
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException(e); throw new RuntimeException(e);

View File

@ -15,7 +15,7 @@
}, },
"metric" : { "metric" : {
"type" : "list", "type" : "list",
"options" : ["_all", "config", "data_counts", "model_size_stats", "scheduler_state", "status"], "options" : ["_all", "config", "data_counts", "model_size_stats", "scheduler_status", "status"],
"description" : "Limit the information returned to the specified statistics" "description" : "Limit the information returned to the specified statistics"
} }
}, },

View File

@ -67,7 +67,7 @@ setup:
- is_true: jobs.0.config - is_true: jobs.0.config
- is_false: jobs.0.data_counts - is_false: jobs.0.data_counts
- is_false: jobs.0.model_size_stats - is_false: jobs.0.model_size_stats
- is_false: jobs.0.scheduler_state - is_false: jobs.0.scheduler_status
- do: - do:
@ -101,7 +101,7 @@ setup:
- is_false: jobs.0.config - is_false: jobs.0.config
- is_true: jobs.0.data_counts - is_true: jobs.0.data_counts
- is_false: jobs.0.model_size_stats - is_false: jobs.0.model_size_stats
- is_false: jobs.0.scheduler_state - is_false: jobs.0.scheduler_status
- do: - do:
xpack.prelert.get_jobs: xpack.prelert.get_jobs:
@ -109,13 +109,13 @@ setup:
metric: "model_size_stats" metric: "model_size_stats"
- is_false: jobs.0.config - is_false: jobs.0.config
- is_false: jobs.0.data_counts - is_false: jobs.0.data_counts
- is_false: jobs.0.scheduler_state - is_false: jobs.0.scheduler_status
- match: { jobs.0.model_size_stats.model_bytes: 100 } - match: { jobs.0.model_size_stats.model_bytes: 100 }
- do: - do:
xpack.prelert.get_jobs: xpack.prelert.get_jobs:
job_id: "job-stats-test" job_id: "job-stats-test"
metric: "scheduler_state" metric: "scheduler_status"
- is_false: jobs.0.config - is_false: jobs.0.config
- is_false: jobs.0.data_counts - is_false: jobs.0.data_counts
@ -126,7 +126,7 @@ setup:
- is_false: jobs.0.config - is_false: jobs.0.config
- is_false: jobs.0.data_counts - is_false: jobs.0.data_counts
- is_false: jobs.0.model_size_stats - is_false: jobs.0.model_size_stats
- is_false: jobs.0.scheduler_state - is_false: jobs.0.scheduler_status
- match: { jobs.0.status: OPENED } - match: { jobs.0.status: OPENED }
- do: - do:
@ -135,18 +135,18 @@ setup:
metric: "_all" metric: "_all"
- is_true: jobs.0.config - is_true: jobs.0.config
- is_true: jobs.0.data_counts - is_true: jobs.0.data_counts
- is_false: jobs.0.scheduler_state - is_false: jobs.0.scheduler_status
- match: { jobs.0.job_id: job-stats-test } - match: { jobs.0.job_id: job-stats-test }
- match: { jobs.0.status: OPENED } - match: { jobs.0.status: OPENED }
- do: - do:
xpack.prelert.get_jobs: xpack.prelert.get_jobs:
job_id: "scheduled-job" job_id: "scheduled-job"
metric: "scheduler_state" metric: "scheduler_status"
- is_false: jobs.0.config - is_false: jobs.0.config
- is_false: jobs.0.data_counts - is_false: jobs.0.data_counts
- is_false: jobs.0.model_size_stats - is_false: jobs.0.model_size_stats
- match: { jobs.0.scheduler_state: STOPPED } - match: { jobs.0.scheduler_status: STOPPED }
--- ---
"Test bad metric": "Test bad metric":