Skip to content

Commit 8f4d599

Browse files
authored
Add 'ml.reset_job' API and 'MlJob.blocked' (#524)
1 parent bc07eba commit 8f4d599

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
{
@@ -105175,6 +105182,17 @@
105175105182
}
105176105183
}
105177105184
},
105185+
{
105186+
"name": "blocked",
105187+
"required": false,
105188+
"type": {
105189+
"kind": "instance_of",
105190+
"type": {
105191+
"name": "JobBlocked",
105192+
"namespace": "ml._types"
105193+
}
105194+
}
105195+
},
105178105196
{
105179105197
"name": "create_time",
105180105198
"required": false,
@@ -105389,6 +105407,55 @@
105389105407
}
105390105408
]
105391105409
},
105410+
{
105411+
"kind": "interface",
105412+
"name": {
105413+
"name": "JobBlocked",
105414+
"namespace": "ml._types"
105415+
},
105416+
"properties": [
105417+
{
105418+
"name": "reason",
105419+
"required": true,
105420+
"type": {
105421+
"kind": "instance_of",
105422+
"type": {
105423+
"name": "JobBlockedReason",
105424+
"namespace": "ml._types"
105425+
}
105426+
}
105427+
},
105428+
{
105429+
"name": "task_id",
105430+
"required": false,
105431+
"type": {
105432+
"kind": "instance_of",
105433+
"type": {
105434+
"name": "TaskId",
105435+
"namespace": "_types"
105436+
}
105437+
}
105438+
}
105439+
]
105440+
},
105441+
{
105442+
"kind": "enum",
105443+
"members": [
105444+
{
105445+
"name": "delete"
105446+
},
105447+
{
105448+
"name": "reset"
105449+
},
105450+
{
105451+
"name": "revert"
105452+
}
105453+
],
105454+
"name": {
105455+
"name": "JobBlockedReason",
105456+
"namespace": "ml._types"
105457+
}
105458+
},
105392105459
{
105393105460
"kind": "interface",
105394105461
"name": {
@@ -114640,6 +114707,71 @@
114640114707
"namespace": "ml.put_trained_model_alias"
114641114708
}
114642114709
},
114710+
{
114711+
"attachedBehaviors": [
114712+
"CommonQueryParameters"
114713+
],
114714+
"body": {
114715+
"kind": "no_body"
114716+
},
114717+
"inherits": {
114718+
"type": {
114719+
"name": "RequestBase",
114720+
"namespace": "_types"
114721+
}
114722+
},
114723+
"kind": "request",
114724+
"name": {
114725+
"name": "Request",
114726+
"namespace": "ml.reset_job"
114727+
},
114728+
"path": [
114729+
{
114730+
"description": "The ID of the job to reset.",
114731+
"name": "job_id",
114732+
"required": true,
114733+
"type": {
114734+
"kind": "instance_of",
114735+
"type": {
114736+
"name": "Id",
114737+
"namespace": "_types"
114738+
}
114739+
}
114740+
}
114741+
],
114742+
"query": [
114743+
{
114744+
"description": "Should this request wait until the operation has completed before returning.",
114745+
"name": "wait_for_completion",
114746+
"required": false,
114747+
"serverDefault": true,
114748+
"type": {
114749+
"kind": "instance_of",
114750+
"type": {
114751+
"name": "boolean",
114752+
"namespace": "internal"
114753+
}
114754+
}
114755+
}
114756+
]
114757+
},
114758+
{
114759+
"body": {
114760+
"kind": "properties",
114761+
"properties": []
114762+
},
114763+
"inherits": {
114764+
"type": {
114765+
"name": "AcknowledgedResponseBase",
114766+
"namespace": "_types"
114767+
}
114768+
},
114769+
"kind": "response",
114770+
"name": {
114771+
"name": "Response",
114772+
"namespace": "ml.reset_job"
114773+
}
114774+
},
114643114775
{
114644114776
"attachedBehaviors": [
114645114777
"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
@@ -10698,6 +10698,7 @@ export interface MlJob {
1069810698
analysis_config: MlAnalysisConfig
1069910699
analysis_limits?: MlAnalysisLimits
1070010700
background_persist_interval?: Time
10701+
blocked?: MlJobBlocked
1070110702
create_time?: integer
1070210703
custom_settings?: MlCustomSettings
1070310704
daily_model_snapshot_retention_after_days?: long
@@ -10719,6 +10720,13 @@ export interface MlJob {
1071910720
system_annotations_retention_days?: long
1072010721
}
1072110722

10723+
export interface MlJobBlocked {
10724+
reason: MlJobBlockedReason
10725+
task_id?: TaskId
10726+
}
10727+
10728+
export type MlJobBlockedReason = 'delete' | 'reset' | 'revert'
10729+
1072210730
export interface MlJobConfig {
1072310731
allow_lazy_open?: boolean
1072410732
analysis_config: MlAnalysisConfig
@@ -11792,6 +11800,14 @@ export interface MlPutTrainedModelAliasRequest extends RequestBase {
1179211800
export interface MlPutTrainedModelAliasResponse extends AcknowledgedResponseBase {
1179311801
}
1179411802

11803+
export interface MlResetJobRequest extends RequestBase {
11804+
job_id: Id
11805+
wait_for_completion?: boolean
11806+
}
11807+
11808+
export interface MlResetJobResponse extends AcknowledgedResponseBase {
11809+
}
11810+
1179511811
export interface MlRevertModelSnapshotRequest extends RequestBase {
1179611812
job_id: Id
1179711813
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)