Skip to content

Add 'ml.reset_job' API and 'MlJob.blocked' #524

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 2, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
136 changes: 134 additions & 2 deletions output/schema/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -7836,9 +7836,16 @@
"description": "Resets an existing anomaly detection job.",
"docUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-reset-job.html",
"name": "ml.reset_job",
"request": null,
"request": {
"name": "Request",
"namespace": "ml.reset_job"
},
"requestBodyRequired": false,
"response": null,
"response": {
"name": "Response",
"namespace": "ml.reset_job"
},
"since": "7.14.0",
"stability": "stable",
"urls": [
{
Expand Down Expand Up @@ -105147,6 +105154,17 @@
}
}
},
{
"name": "blocked",
"required": false,
"type": {
"kind": "instance_of",
"type": {
"name": "JobBlocked",
"namespace": "ml._types"
}
}
},
{
"name": "create_time",
"required": false,
Expand Down Expand Up @@ -105361,6 +105379,55 @@
}
]
},
{
"kind": "interface",
"name": {
"name": "JobBlocked",
"namespace": "ml._types"
},
"properties": [
{
"name": "reason",
"required": true,
"type": {
"kind": "instance_of",
"type": {
"name": "JobBlockedReason",
"namespace": "ml._types"
}
}
},
{
"name": "task_id",
"required": true,
"type": {
"kind": "instance_of",
"type": {
"name": "TaskId",
"namespace": "_types"
}
}
}
]
},
{
"kind": "enum",
"members": [
{
"name": "delete"
},
{
"name": "reset"
},
{
"name": "revert"
}
],
"name": {
"name": "JobBlockedReason",
"namespace": "ml._types"
}
},
{
"kind": "interface",
"name": {
Expand Down Expand Up @@ -114618,6 +114685,71 @@
"namespace": "ml.put_trained_model_alias"
}
},
{
"attachedBehaviors": [
"CommonQueryParameters"
],
"body": {
"kind": "no_body"
},
"inherits": {
"type": {
"name": "RequestBase",
"namespace": "_types"
}
},
"kind": "request",
"name": {
"name": "Request",
"namespace": "ml.reset_job"
},
"path": [
{
"description": "The ID of the job to reset.",
"name": "job_id",
"required": true,
"type": {
"kind": "instance_of",
"type": {
"name": "Id",
"namespace": "_types"
}
}
}
],
"query": [
{
"description": "Should this request wait until the operation has completed before returning.",
"name": "wait_for_completion",
"required": false,
"serverDefault": true,
"type": {
"kind": "instance_of",
"type": {
"name": "boolean",
"namespace": "internal"
}
}
}
]
},
{
"body": {
"kind": "properties",
"properties": []
},
"inherits": {
"type": {
"name": "AcknowledgedResponseBase",
"namespace": "_types"
}
},
"kind": "response",
"name": {
"name": "Response",
"namespace": "ml.reset_job"
}
},
{
"attachedBehaviors": [
"CommonQueryParameters"
Expand Down
2 changes: 1 addition & 1 deletion output/schema/validation-errors.json
Original file line number Diff line number Diff line change
Expand Up @@ -1212,7 +1212,7 @@
},
"ml.reset_job": {
"request": [
"Missing request & response"
"Request: should not have a body"
],
"response": []
},
Expand Down
16 changes: 16 additions & 0 deletions output/typescript/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10695,6 +10695,7 @@ export interface MlJob {
analysis_config: MlAnalysisConfig
analysis_limits?: MlAnalysisLimits
background_persist_interval?: Time
blocked?: MlJobBlocked
create_time?: integer
custom_settings?: MlCustomSettings
daily_model_snapshot_retention_after_days?: long
Expand All @@ -10716,6 +10717,13 @@ export interface MlJob {
system_annotations_retention_days?: long
}

export interface MlJobBlocked {
reason: MlJobBlockedReason
task_id: TaskId
}

export type MlJobBlockedReason = 'delete' | 'reset' | 'revert'

export interface MlJobConfig {
allow_lazy_open?: boolean
analysis_config: MlAnalysisConfig
Expand Down Expand Up @@ -11791,6 +11799,14 @@ export interface MlPutTrainedModelAliasRequest extends RequestBase {
export interface MlPutTrainedModelAliasResponse extends AcknowledgedResponseBase {
}

export interface MlResetJobRequest extends RequestBase {
job_id: Id
wait_for_completion?: boolean
}

export interface MlResetJobResponse extends AcknowledgedResponseBase {
}

export interface MlRevertModelSnapshotRequest extends RequestBase {
job_id: Id
snapshot_id: Id
Expand Down
14 changes: 13 additions & 1 deletion specification/ml/_types/Job.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { AnalysisConfig, AnalysisLimits } from '@ml/_types/Analysis'
import { ModelPlotConfig } from '@ml/_types/ModelPlot'
import { Dictionary } from '@spec_utils/Dictionary'
import { CustomSettings } from '@ml/_types/Settings'
import { Field, Id, IndexName, VersionString } from '@_types/common'
import { Field, Id, TaskId, IndexName, VersionString } from '@_types/common'
import { double, integer, long } from '@_types/Numeric'
import { DateString, Time } from '@_types/Time'
import { DiscoveryNode } from './DiscoveryNode'
Expand All @@ -48,6 +48,7 @@ export class Job {
analysis_config: AnalysisConfig
analysis_limits?: AnalysisLimits
background_persist_interval?: Time
blocked?: JobBlocked
create_time?: integer
custom_settings?: CustomSettings
daily_model_snapshot_retention_after_days?: long
Expand Down Expand Up @@ -159,3 +160,14 @@ export class DataDescription {
time_format?: string
field_delimiter?: string
}

export class JobBlocked {
reason: JobBlockedReason
task_id: TaskId
}

export enum JobBlockedReason {
delete = 0,
reset = 1,
revert = 2
}
40 changes: 40 additions & 0 deletions specification/ml/reset_job/MlResetJobRequest.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import { RequestBase } from '@_types/Base'
import { Id } from '@_types/common'

/**
* @rest_spec_name ml.reset_job
* @since 7.14.0
* @stability stable
*/
export interface Request extends RequestBase {
path_parts: {
/** The ID of the job to reset. */
job_id: Id
}
query_parameters?: {
/**
* Should this request wait until the operation has completed before returning.
* @server_default true
*/
wait_for_completion?: boolean
}
}
22 changes: 22 additions & 0 deletions specification/ml/reset_job/MlResetJobResponse.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import { AcknowledgedResponseBase } from '@_types/Base'

export class Response extends AcknowledgedResponseBase {}