mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-06-30 02:13:33 -04:00
This commit adds a new API that users can use calling: ``` POST _ml/trained_models/{model_id}/deployment/_update { "number_of_allocations": 4 } ``` This allows a user to update the number of allocations for a deployment that is `started`. If the allocations are increased we rebalance and let the assignment planner find how to allocate the additional allocations. If the allocations are decreased we cannot use the assignment planner. Instead, we implement the reduction in a new class `AllocationReducer` that tries to reduce the allocations so that: 1. availability zone balance is maintained 2. assignments that can be completely stopped are preferred to release memory
88 lines
2.4 KiB
Text
88 lines
2.4 KiB
Text
[role="xpack"]
|
|
[[update-trained-model-deployment]]
|
|
= Update trained model deployment API
|
|
|
|
[subs="attributes"]
|
|
++++
|
|
<titleabbrev>Update trained model deployment</titleabbrev>
|
|
++++
|
|
|
|
Updates certain properties of a trained model deployment.
|
|
|
|
beta::[]
|
|
|
|
[[update-trained-model-deployment-request]]
|
|
== {api-request-title}
|
|
|
|
`POST _ml/trained_models/<model_id>/deployment/_update`
|
|
|
|
|
|
[[update-trained-model-deployments-prereqs]]
|
|
== {api-prereq-title}
|
|
|
|
Requires the `manage_ml` cluster privilege. This privilege is included in the
|
|
`machine_learning_admin` built-in role.
|
|
|
|
[[update-trained-model-deployment-desc]]
|
|
== {api-description-title}
|
|
|
|
You can update a trained model deployment whose `assignment_state` is `started`.
|
|
You can either increase or decrease the number of allocations of such a deployment.
|
|
|
|
[[update-trained-model-deployments-path-parms]]
|
|
== {api-path-parms-title}
|
|
|
|
`<model_id>`::
|
|
(Required, string)
|
|
include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=model-id]
|
|
|
|
[[update-trained-model-deployment-request-body]]
|
|
== {api-request-body-title}
|
|
|
|
`number_of_allocations`::
|
|
(Optional, integer)
|
|
The total number of allocations this model is assigned across {ml} nodes.
|
|
Increasing this value generally increases the throughput.
|
|
|
|
|
|
[[update-trained-model-deployment-example]]
|
|
== {api-examples-title}
|
|
|
|
The following example updates the deployment for a
|
|
`elastic__distilbert-base-uncased-finetuned-conll03-english` trained model to have 4 allocations:
|
|
|
|
[source,console]
|
|
--------------------------------------------------
|
|
POST _ml/trained_models/elastic__distilbert-base-uncased-finetuned-conll03-english/deployment/_update
|
|
{
|
|
"number_of_allocations": 4
|
|
}
|
|
--------------------------------------------------
|
|
// TEST[skip:TBD]
|
|
|
|
The API returns the following results:
|
|
|
|
[source,console-result]
|
|
----
|
|
{
|
|
"assignment": {
|
|
"task_parameters": {
|
|
"model_id": "elastic__distilbert-base-uncased-finetuned-conll03-english",
|
|
"model_bytes": 265632637,
|
|
"threads_per_allocation" : 1,
|
|
"number_of_allocations" : 4,
|
|
"queue_capacity" : 1024
|
|
},
|
|
"routing_table": {
|
|
"uckeG3R8TLe2MMNBQ6AGrw": {
|
|
"current_allocations": 1,
|
|
"target_allocations": 4,
|
|
"routing_state": "started",
|
|
"reason": ""
|
|
}
|
|
},
|
|
"assignment_state": "started",
|
|
"start_time": "2022-11-02T11:50:34.766591Z"
|
|
}
|
|
}
|
|
----
|