Skip to content

Commit 7b889ce

Browse files
committed
Add 'ml.reset_job' API and 'MlJob.blocked'
1 parent f7bb071 commit 7b889ce

File tree

6 files changed

+226
-4
lines changed

6 files changed

+226
-4
lines changed

output/schema/schema.json

Lines changed: 134 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7836,9 +7836,16 @@
78367836
"description": "Resets an existing anomaly detection job.",
78377837
"docUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-reset-job.html",
78387838
"name": "ml.reset_job",
7839-
"request": null,
7839+
"request": {
7840+
"name": "Request",
7841+
"namespace": "ml.reset_job"
7842+
},
78407843
"requestBodyRequired": false,
7841-
"response": null,
7844+
"response": {
7845+
"name": "Response",
7846+
"namespace": "ml.reset_job"
7847+
},
7848+
"since": "7.14.0",
78427849
"stability": "stable",
78437850
"urls": [
78447851
{
@@ -105147,6 +105154,17 @@
105147105154
}
105148105155
}
105149105156
},
105157+
{
105158+
"name": "blocked",
105159+
"required": false,
105160+
"type": {
105161+
"kind": "instance_of",
105162+
"type": {
105163+
"name": "JobBlocked",
105164+
"namespace": "ml._types"
105165+
}
105166+
}
105167+
},
105150105168
{
105151105169
"name": "create_time",
105152105170
"required": false,
@@ -105361,6 +105379,55 @@
105361105379
}
105362105380
]
105363105381
},
105382+
{
105383+
"kind": "interface",
105384+
"name": {
105385+
"name": "JobBlocked",
105386+
"namespace": "ml._types"
105387+
},
105388+
"properties": [
105389+
{
105390+
"name": "reason",
105391+
"required": true,
105392+
"type": {
105393+
"kind": "instance_of",
105394+
"type": {
105395+
"name": "JobBlockedReason",
105396+
"namespace": "ml._types"
105397+
}
105398+
}
105399+
},
105400+
{
105401+
"name": "task_id",
105402+
"required": true,
105403+
"type": {
105404+
"kind": "instance_of",
105405+
"type": {
105406+
"name": "TaskId",
105407+
"namespace": "_types"
105408+
}
105409+
}
105410+
}
105411+
]
105412+
},
105413+
{
105414+
"kind": "enum",
105415+
"members": [
105416+
{
105417+
"name": "delete"
105418+
},
105419+
{
105420+
"name": "reset"
105421+
},
105422+
{
105423+
"name": "revert"
105424+
}
105425+
],
105426+
"name": {
105427+
"name": "JobBlockedReason",
105428+
"namespace": "ml._types"
105429+
}
105430+
},
105364105431
{
105365105432
"kind": "interface",
105366105433
"name": {
@@ -114618,6 +114685,71 @@
114618114685
"namespace": "ml.put_trained_model_alias"
114619114686
}
114620114687
},
114688+
{
114689+
"attachedBehaviors": [
114690+
"CommonQueryParameters"
114691+
],
114692+
"body": {
114693+
"kind": "no_body"
114694+
},
114695+
"inherits": {
114696+
"type": {
114697+
"name": "RequestBase",
114698+
"namespace": "_types"
114699+
}
114700+
},
114701+
"kind": "request",
114702+
"name": {
114703+
"name": "Request",
114704+
"namespace": "ml.reset_job"
114705+
},
114706+
"path": [
114707+
{
114708+
"description": "The ID of the job to reset.",
114709+
"name": "job_id",
114710+
"required": true,
114711+
"type": {
114712+
"kind": "instance_of",
114713+
"type": {
114714+
"name": "Id",
114715+
"namespace": "_types"
114716+
}
114717+
}
114718+
}
114719+
],
114720+
"query": [
114721+
{
114722+
"description": "Should this request wait until the operation has completed before returning.",
114723+
"name": "wait_for_completion",
114724+
"required": false,
114725+
"serverDefault": true,
114726+
"type": {
114727+
"kind": "instance_of",
114728+
"type": {
114729+
"name": "boolean",
114730+
"namespace": "internal"
114731+
}
114732+
}
114733+
}
114734+
]
114735+
},
114736+
{
114737+
"body": {
114738+
"kind": "properties",
114739+
"properties": []
114740+
},
114741+
"inherits": {
114742+
"type": {
114743+
"name": "AcknowledgedResponseBase",
114744+
"namespace": "_types"
114745+
}
114746+
},
114747+
"kind": "response",
114748+
"name": {
114749+
"name": "Response",
114750+
"namespace": "ml.reset_job"
114751+
}
114752+
},
114621114753
{
114622114754
"attachedBehaviors": [
114623114755
"CommonQueryParameters"

output/schema/validation-errors.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1212,7 +1212,7 @@
12121212
},
12131213
"ml.reset_job": {
12141214
"request": [
1215-
"Missing request & response"
1215+
"Request: should not have a body"
12161216
],
12171217
"response": []
12181218
},

output/typescript/types.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10695,6 +10695,7 @@ export interface MlJob {
1069510695
analysis_config: MlAnalysisConfig
1069610696
analysis_limits?: MlAnalysisLimits
1069710697
background_persist_interval?: Time
10698+
blocked?: MlJobBlocked
1069810699
create_time?: integer
1069910700
custom_settings?: MlCustomSettings
1070010701
daily_model_snapshot_retention_after_days?: long
@@ -10716,6 +10717,13 @@ export interface MlJob {
1071610717
system_annotations_retention_days?: long
1071710718
}
1071810719

10720+
export interface MlJobBlocked {
10721+
reason: MlJobBlockedReason
10722+
task_id: TaskId
10723+
}
10724+
10725+
export type MlJobBlockedReason = 'delete' | 'reset' | 'revert'
10726+
1071910727
export interface MlJobConfig {
1072010728
allow_lazy_open?: boolean
1072110729
analysis_config: MlAnalysisConfig
@@ -11791,6 +11799,14 @@ export interface MlPutTrainedModelAliasRequest extends RequestBase {
1179111799
export interface MlPutTrainedModelAliasResponse extends AcknowledgedResponseBase {
1179211800
}
1179311801

11802+
export interface MlResetJobRequest extends RequestBase {
11803+
job_id: Id
11804+
wait_for_completion?: boolean
11805+
}
11806+
11807+
export interface MlResetJobResponse extends AcknowledgedResponseBase {
11808+
}
11809+
1179411810
export interface MlRevertModelSnapshotRequest extends RequestBase {
1179511811
job_id: Id
1179611812
snapshot_id: Id

specification/ml/_types/Job.ts

Lines changed: 13 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
@@ -159,3 +160,14 @@ export class DataDescription {
159160
time_format?: string
160161
field_delimiter?: string
161162
}
163+
164+
export class JobBlocked {
165+
reason: JobBlockedReason
166+
task_id: TaskId
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)