Skip to content

Commit 3727bbd

Browse files
committed
Add 'ml.reset_job' API and 'MlJob.blocked'
1 parent 8a71389 commit 3727bbd

File tree

6 files changed

+228
-4
lines changed

6 files changed

+228
-4
lines changed

output/schema/schema.json

Lines changed: 134 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7835,9 +7835,16 @@
78357835
"description": "Resets an existing anomaly detection job.",
78367836
"docUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-reset-job.html",
78377837
"name": "ml.reset_job",
7838-
"request": null,
7838+
"request": {
7839+
"name": "Request",
7840+
"namespace": "ml.reset_job"
7841+
},
78397842
"requestBodyRequired": false,
7840-
"response": null,
7843+
"response": {
7844+
"name": "Response",
7845+
"namespace": "ml.reset_job"
7846+
},
7847+
"since": "7.14.0",
78417848
"stability": "stable",
78427849
"urls": [
78437850
{
@@ -105103,6 +105110,17 @@
105103105110
}
105104105111
}
105105105112
},
105113+
{
105114+
"name": "blocked",
105115+
"required": false,
105116+
"type": {
105117+
"kind": "instance_of",
105118+
"type": {
105119+
"name": "JobBlocked",
105120+
"namespace": "ml._types"
105121+
}
105122+
}
105123+
},
105106105124
{
105107105125
"name": "create_time",
105108105126
"required": true,
@@ -105306,6 +105324,55 @@
105306105324
}
105307105325
]
105308105326
},
105327+
{
105328+
"kind": "interface",
105329+
"name": {
105330+
"name": "JobBlocked",
105331+
"namespace": "ml._types"
105332+
},
105333+
"properties": [
105334+
{
105335+
"name": "reason",
105336+
"required": true,
105337+
"type": {
105338+
"kind": "instance_of",
105339+
"type": {
105340+
"name": "JobBlockedReason",
105341+
"namespace": "ml._types"
105342+
}
105343+
}
105344+
},
105345+
{
105346+
"name": "task_id",
105347+
"required": true,
105348+
"type": {
105349+
"kind": "instance_of",
105350+
"type": {
105351+
"name": "TaskId",
105352+
"namespace": "_types"
105353+
}
105354+
}
105355+
}
105356+
]
105357+
},
105358+
{
105359+
"kind": "enum",
105360+
"members": [
105361+
{
105362+
"name": "delete"
105363+
},
105364+
{
105365+
"name": "reset"
105366+
},
105367+
{
105368+
"name": "revert"
105369+
}
105370+
],
105371+
"name": {
105372+
"name": "JobBlockedReason",
105373+
"namespace": "ml._types"
105374+
}
105375+
},
105309105376
{
105310105377
"kind": "interface",
105311105378
"name": {
@@ -114455,6 +114522,71 @@
114455114522
"namespace": "ml.put_trained_model_alias"
114456114523
}
114457114524
},
114525+
{
114526+
"attachedBehaviors": [
114527+
"CommonQueryParameters"
114528+
],
114529+
"body": {
114530+
"kind": "no_body"
114531+
},
114532+
"inherits": {
114533+
"type": {
114534+
"name": "RequestBase",
114535+
"namespace": "_types"
114536+
}
114537+
},
114538+
"kind": "request",
114539+
"name": {
114540+
"name": "Request",
114541+
"namespace": "ml.reset_job"
114542+
},
114543+
"path": [
114544+
{
114545+
"description": "The ID of the job to reset.",
114546+
"name": "job_id",
114547+
"required": true,
114548+
"type": {
114549+
"kind": "instance_of",
114550+
"type": {
114551+
"name": "Id",
114552+
"namespace": "_types"
114553+
}
114554+
}
114555+
}
114556+
],
114557+
"query": [
114558+
{
114559+
"description": "Should this request wait until the operation has completed before returning.",
114560+
"name": "wait_for_completion",
114561+
"required": false,
114562+
"serverDefault": true,
114563+
"type": {
114564+
"kind": "instance_of",
114565+
"type": {
114566+
"name": "boolean",
114567+
"namespace": "internal"
114568+
}
114569+
}
114570+
}
114571+
]
114572+
},
114573+
{
114574+
"body": {
114575+
"kind": "properties",
114576+
"properties": []
114577+
},
114578+
"inherits": {
114579+
"type": {
114580+
"name": "AcknowledgedResponseBase",
114581+
"namespace": "_types"
114582+
}
114583+
},
114584+
"kind": "response",
114585+
"name": {
114586+
"name": "Response",
114587+
"namespace": "ml.reset_job"
114588+
}
114589+
},
114458114590
{
114459114591
"attachedBehaviors": [
114460114592
"CommonQueryParameters"

output/schema/validation-errors.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1208,7 +1208,7 @@
12081208
},
12091209
"ml.reset_job": {
12101210
"request": [
1211-
"Missing request & response"
1211+
"Request: should not have a body"
12121212
],
12131213
"response": []
12141214
},

output/typescript/types.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10689,6 +10689,7 @@ export interface MlJob {
1068910689
analysis_config: MlAnalysisConfig
1069010690
analysis_limits?: MlAnalysisLimits
1069110691
background_persist_interval: Time
10692+
blocked?: MlJobBlocked
1069210693
create_time: integer
1069310694
custom_settings?: MlCustomSettings
1069410695
daily_model_snapshot_retention_after_days?: long
@@ -10709,6 +10710,13 @@ export interface MlJob {
1070910710
results_retention_days?: long
1071010711
}
1071110712

10713+
export interface MlJobBlocked {
10714+
reason: MlJobBlockedReason
10715+
task_id: TaskId
10716+
}
10717+
10718+
export type MlJobBlockedReason = 'delete' | 'reset' | 'revert'
10719+
1071210720
export interface MlJobConfig {
1071310721
allow_lazy_open?: boolean
1071410722
analysis_config: MlAnalysisConfig
@@ -11774,6 +11782,14 @@ export interface MlPutTrainedModelAliasRequest extends RequestBase {
1177411782
export interface MlPutTrainedModelAliasResponse extends AcknowledgedResponseBase {
1177511783
}
1177611784

11785+
export interface MlResetJobRequest extends RequestBase {
11786+
job_id: Id
11787+
wait_for_completion?: boolean
11788+
}
11789+
11790+
export interface MlResetJobResponse extends AcknowledgedResponseBase {
11791+
}
11792+
1177711793
export interface MlRevertModelSnapshotRequest extends RequestBase {
1177811794
job_id: Id
1177911795
snapshot_id: Id

specification/ml/_types/Job.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import { AnalysisConfig, AnalysisLimits } from '@ml/_types/Analysis'
2121
import { ModelPlotConfig } from '@ml/_types/ModelPlot'
2222
import { Dictionary } from '@spec_utils/Dictionary'
2323
import { CustomSettings } from '@ml/_types/Settings'
24-
import { Field, Id, IndexName, VersionString } from '@_types/common'
24+
import { Field, Id, TaskId, IndexName, VersionString } from '@_types/common'
2525
import { double, integer, long } from '@_types/Numeric'
2626
import { DateString, Time } from '@_types/Time'
2727
import { DiscoveryNode } from './DiscoveryNode'
@@ -48,6 +48,7 @@ export class Job {
4848
analysis_config: AnalysisConfig
4949
analysis_limits?: AnalysisLimits
5050
background_persist_interval: Time
51+
blocked?: JobBlocked
5152
create_time: integer
5253
custom_settings?: CustomSettings
5354
daily_model_snapshot_retention_after_days?: long
@@ -157,3 +158,16 @@ export class DataDescription {
157158
time_format?: string
158159
field_delimiter?: string
159160
}
161+
162+
163+
export class JobBlocked {
164+
reason: JobBlockedReason
165+
task_id: TaskId
166+
}
167+
168+
169+
export enum JobBlockedReason {
170+
delete = 0,
171+
reset = 1,
172+
revert = 2
173+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
* Licensed to Elasticsearch B.V. under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch B.V. licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
import { RequestBase } from '@_types/Base'
21+
import { Id } from '@_types/common'
22+
23+
/**
24+
* @rest_spec_name ml.reset_job
25+
* @since 7.14.0
26+
* @stability stable
27+
*/
28+
export interface Request extends RequestBase {
29+
path_parts: {
30+
/** The ID of the job to reset. */
31+
job_id: Id
32+
}
33+
query_parameters?: {
34+
/**
35+
* Should this request wait until the operation has completed before returning.
36+
* @server_default true
37+
*/
38+
wait_for_completion?: boolean
39+
}
40+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*
2+
* Licensed to Elasticsearch B.V. under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch B.V. licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
import { AcknowledgedResponseBase } from '@_types/Base'
21+
22+
export class Response extends AcknowledgedResponseBase {}

0 commit comments

Comments
 (0)