From 980d2cd944116bf42450f391da329dd0022b8eb7 Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Wed, 26 Mar 2025 16:10:51 +0400 Subject: [PATCH] Fix ml.get_trained_model_stats response (#4056) * Fix ml.get_trained_model_stats response * Fix typo (cherry picked from commit 60e7bab864f673ba14787e696fd3d701b7a74e15) --- output/openapi/elasticsearch-openapi.json | 43 +++++--- .../elasticsearch-serverless-openapi.json | 43 +++++--- output/schema/schema-serverless.json | 100 ++++++++++++------ output/schema/schema.json | 50 +++++++-- output/typescript/types.ts | 9 +- specification/ml/_types/TrainedModel.ts | 16 ++- 6 files changed, 188 insertions(+), 73 deletions(-) diff --git a/output/openapi/elasticsearch-openapi.json b/output/openapi/elasticsearch-openapi.json index d814045c5b..abff19c6a7 100644 --- a/output/openapi/elasticsearch-openapi.json +++ b/output/openapi/elasticsearch-openapi.json @@ -85837,12 +85837,12 @@ "peak_throughput_per_minute": { "type": "number" }, - "rejection_execution_count": { + "rejected_execution_count": { "description": "The number of inference requests that were not processed because the queue was full.", "type": "number" }, "routing_state": { - "$ref": "#/components/schemas/ml._types:TrainedModelAssignmentRoutingTable" + "$ref": "#/components/schemas/ml._types:TrainedModelAssignmentRoutingStateAndReason" }, "start_time": { "$ref": "#/components/schemas/_types:EpochTimeUnitMillis" @@ -85865,7 +85865,7 @@ "throughput_last_minute" ] }, - "ml._types:TrainedModelAssignmentRoutingTable": { + "ml._types:TrainedModelAssignmentRoutingStateAndReason": { "type": "object", "properties": { "reason": { @@ -85874,20 +85874,10 @@ }, "routing_state": { "$ref": "#/components/schemas/ml._types:RoutingState" - }, - "current_allocations": { - "description": "Current number of allocations.", - "type": "number" - }, - "target_allocations": { - "description": "Target number of allocations.", - "type": "number" } }, "required": [ - "routing_state", - "current_allocations", - "target_allocations" + "routing_state" ] }, "ml._types:RoutingState": { @@ -86960,6 +86950,31 @@ "task_parameters" ] }, + "ml._types:TrainedModelAssignmentRoutingTable": { + "type": "object", + "properties": { + "reason": { + "description": "The reason for the current state. It is usually populated only when the\n`routing_state` is `failed`.", + "type": "string" + }, + "routing_state": { + "$ref": "#/components/schemas/ml._types:RoutingState" + }, + "current_allocations": { + "description": "Current number of allocations.", + "type": "number" + }, + "target_allocations": { + "description": "Target number of allocations.", + "type": "number" + } + }, + "required": [ + "routing_state", + "current_allocations", + "target_allocations" + ] + }, "ml._types:TrainedModelAssignmentTaskParameters": { "type": "object", "properties": { diff --git a/output/openapi/elasticsearch-serverless-openapi.json b/output/openapi/elasticsearch-serverless-openapi.json index c44c5ed991..0e159d7381 100644 --- a/output/openapi/elasticsearch-serverless-openapi.json +++ b/output/openapi/elasticsearch-serverless-openapi.json @@ -55715,12 +55715,12 @@ "peak_throughput_per_minute": { "type": "number" }, - "rejection_execution_count": { + "rejected_execution_count": { "description": "The number of inference requests that were not processed because the queue was full.", "type": "number" }, "routing_state": { - "$ref": "#/components/schemas/ml._types:TrainedModelAssignmentRoutingTable" + "$ref": "#/components/schemas/ml._types:TrainedModelAssignmentRoutingStateAndReason" }, "start_time": { "$ref": "#/components/schemas/_types:EpochTimeUnitMillis" @@ -55743,7 +55743,7 @@ "throughput_last_minute" ] }, - "ml._types:TrainedModelAssignmentRoutingTable": { + "ml._types:TrainedModelAssignmentRoutingStateAndReason": { "type": "object", "properties": { "reason": { @@ -55752,20 +55752,10 @@ }, "routing_state": { "$ref": "#/components/schemas/ml._types:RoutingState" - }, - "current_allocations": { - "description": "Current number of allocations.", - "type": "number" - }, - "target_allocations": { - "description": "Target number of allocations.", - "type": "number" } }, "required": [ - "routing_state", - "current_allocations", - "target_allocations" + "routing_state" ] }, "ml._types:RoutingState": { @@ -56760,6 +56750,31 @@ "task_parameters" ] }, + "ml._types:TrainedModelAssignmentRoutingTable": { + "type": "object", + "properties": { + "reason": { + "description": "The reason for the current state. It is usually populated only when the\n`routing_state` is `failed`.", + "type": "string" + }, + "routing_state": { + "$ref": "#/components/schemas/ml._types:RoutingState" + }, + "current_allocations": { + "description": "Current number of allocations.", + "type": "number" + }, + "target_allocations": { + "description": "Target number of allocations.", + "type": "number" + } + }, + "required": [ + "routing_state", + "current_allocations", + "target_allocations" + ] + }, "ml._types:TrainedModelAssignmentTaskParameters": { "type": "object", "properties": { diff --git a/output/schema/schema-serverless.json b/output/schema/schema-serverless.json index fe63536314..c42e3864aa 100644 --- a/output/schema/schema-serverless.json +++ b/output/schema/schema-serverless.json @@ -138532,7 +138532,7 @@ } } ], - "specLocation": "ml/_types/TrainedModel.ts#L487-L496" + "specLocation": "ml/_types/TrainedModel.ts#L499-L508" }, { "kind": "interface", @@ -138553,7 +138553,7 @@ } } ], - "specLocation": "ml/_types/TrainedModel.ts#L479-L481" + "specLocation": "ml/_types/TrainedModel.ts#L491-L493" }, { "kind": "interface", @@ -138574,7 +138574,7 @@ } } ], - "specLocation": "ml/_types/TrainedModel.ts#L483-L485" + "specLocation": "ml/_types/TrainedModel.ts#L495-L497" }, { "kind": "interface", @@ -138991,7 +138991,7 @@ } } ], - "specLocation": "ml/_types/TrainedModel.ts#L451-L458" + "specLocation": "ml/_types/TrainedModel.ts#L463-L470" }, { "kind": "interface", @@ -139166,7 +139166,7 @@ }, { "description": "The number of inference requests that were not processed because the queue was full.", - "name": "rejection_execution_count", + "name": "rejected_execution_count", "required": false, "type": { "kind": "instance_of", @@ -139183,7 +139183,7 @@ "type": { "kind": "instance_of", "type": { - "name": "TrainedModelAssignmentRoutingTable", + "name": "TrainedModelAssignmentRoutingStateAndReason", "namespace": "ml._types" } } @@ -139250,7 +139250,7 @@ { "kind": "interface", "name": { - "name": "TrainedModelAssignmentRoutingTable", + "name": "TrainedModelAssignmentRoutingStateAndReason", "namespace": "ml._types" }, "properties": [ @@ -139277,33 +139277,9 @@ "namespace": "ml._types" } } - }, - { - "description": "Current number of allocations.", - "name": "current_allocations", - "required": true, - "type": { - "kind": "instance_of", - "type": { - "name": "integer", - "namespace": "_types" - } - } - }, - { - "description": "Target number of allocations.", - "name": "target_allocations", - "required": true, - "type": { - "kind": "instance_of", - "type": { - "name": "integer", - "namespace": "_types" - } - } } ], - "specLocation": "ml/_types/TrainedModel.ts#L431-L449" + "specLocation": "ml/_types/TrainedModel.ts#L431-L441" }, { "kind": "interface", @@ -141870,7 +141846,65 @@ } } ], - "specLocation": "ml/_types/TrainedModel.ts#L460-L477" + "specLocation": "ml/_types/TrainedModel.ts#L472-L489" + }, + { + "kind": "interface", + "name": { + "name": "TrainedModelAssignmentRoutingTable", + "namespace": "ml._types" + }, + "properties": [ + { + "description": "The reason for the current state. It is usually populated only when the\n`routing_state` is `failed`.", + "name": "reason", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + }, + { + "description": "The current routing state.", + "name": "routing_state", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "RoutingState", + "namespace": "ml._types" + } + } + }, + { + "description": "Current number of allocations.", + "name": "current_allocations", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "integer", + "namespace": "_types" + } + } + }, + { + "description": "Target number of allocations.", + "name": "target_allocations", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "integer", + "namespace": "_types" + } + } + } + ], + "specLocation": "ml/_types/TrainedModel.ts#L443-L461" }, { "kind": "interface", diff --git a/output/schema/schema.json b/output/schema/schema.json index ef95864ad7..f862b88363 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -175037,7 +175037,41 @@ } } ], - "specLocation": "ml/_types/TrainedModel.ts#L460-L477" + "specLocation": "ml/_types/TrainedModel.ts#L472-L489" + }, + { + "kind": "interface", + "name": { + "name": "TrainedModelAssignmentRoutingStateAndReason", + "namespace": "ml._types" + }, + "properties": [ + { + "description": "The reason for the current state. It is usually populated only when the\n`routing_state` is `failed`.", + "name": "reason", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + }, + { + "description": "The current routing state.", + "name": "routing_state", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "RoutingState", + "namespace": "ml._types" + } + } + } + ], + "specLocation": "ml/_types/TrainedModel.ts#L431-L441" }, { "kind": "interface", @@ -175095,7 +175129,7 @@ } } ], - "specLocation": "ml/_types/TrainedModel.ts#L431-L449" + "specLocation": "ml/_types/TrainedModel.ts#L443-L461" }, { "kind": "interface", @@ -175646,7 +175680,7 @@ } } ], - "specLocation": "ml/_types/TrainedModel.ts#L451-L458" + "specLocation": "ml/_types/TrainedModel.ts#L463-L470" }, { "kind": "interface", @@ -175836,7 +175870,7 @@ }, { "description": "The number of inference requests that were not processed because the queue was full.", - "name": "rejection_execution_count", + "name": "rejected_execution_count", "required": false, "type": { "kind": "instance_of", @@ -175853,7 +175887,7 @@ "type": { "kind": "instance_of", "type": { - "name": "TrainedModelAssignmentRoutingTable", + "name": "TrainedModelAssignmentRoutingStateAndReason", "namespace": "ml._types" } } @@ -176394,7 +176428,7 @@ } } ], - "specLocation": "ml/_types/TrainedModel.ts#L479-L481" + "specLocation": "ml/_types/TrainedModel.ts#L491-L493" }, { "kind": "interface", @@ -176415,7 +176449,7 @@ } } ], - "specLocation": "ml/_types/TrainedModel.ts#L483-L485" + "specLocation": "ml/_types/TrainedModel.ts#L495-L497" }, { "kind": "interface", @@ -176449,7 +176483,7 @@ } } ], - "specLocation": "ml/_types/TrainedModel.ts#L487-L496" + "specLocation": "ml/_types/TrainedModel.ts#L499-L508" }, { "kind": "interface", diff --git a/output/typescript/types.ts b/output/typescript/types.ts index 738b731f66..e4dee87e6c 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -15746,6 +15746,11 @@ export interface MlTrainedModelAssignment { task_parameters: MlTrainedModelAssignmentTaskParameters } +export interface MlTrainedModelAssignmentRoutingStateAndReason { + reason?: string + routing_state: MlRoutingState +} + export interface MlTrainedModelAssignmentRoutingTable { reason?: string routing_state: MlRoutingState @@ -15820,8 +15825,8 @@ export interface MlTrainedModelDeploymentNodesStats { number_of_allocations?: integer number_of_pending_requests?: integer peak_throughput_per_minute: long - rejection_execution_count?: integer - routing_state: MlTrainedModelAssignmentRoutingTable + rejected_execution_count?: integer + routing_state: MlTrainedModelAssignmentRoutingStateAndReason start_time?: EpochTime threads_per_allocation?: integer throughput_last_minute: integer diff --git a/specification/ml/_types/TrainedModel.ts b/specification/ml/_types/TrainedModel.ts index acc7fe5c4f..1c48b362f1 100644 --- a/specification/ml/_types/TrainedModel.ts +++ b/specification/ml/_types/TrainedModel.ts @@ -187,9 +187,9 @@ export class TrainedModelDeploymentNodesStats { peak_throughput_per_minute: long /** The number of inference requests that were not processed because the queue was full. */ - rejection_execution_count?: integer + rejected_execution_count?: integer /** The current routing state and reason for the current routing state for this allocation. */ - routing_state: TrainedModelAssignmentRoutingTable + routing_state: TrainedModelAssignmentRoutingStateAndReason /** The epoch timestamp when the allocation started. */ start_time?: EpochTime /** The number of threads used by each allocation during inference. */ @@ -428,6 +428,18 @@ export enum RoutingState { stopping } +export class TrainedModelAssignmentRoutingStateAndReason { + /** + * The reason for the current state. It is usually populated only when the + * `routing_state` is `failed`. + */ + reason?: string + /** + * The current routing state. + */ + routing_state: RoutingState +} + export class TrainedModelAssignmentRoutingTable { /** * The reason for the current state. It is usually populated only when the