Skip to content

Auto-generated code for main #2571

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 1 commit into from
May 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
56 changes: 56 additions & 0 deletions elasticsearch/_async/client/ml.py
Original file line number Diff line number Diff line change
Expand Up @@ -5043,6 +5043,62 @@ async def update_model_snapshot(
path_parts=__path_parts,
)

@_rewrite_parameters(
body_fields=("number_of_allocations",),
)
async def update_trained_model_deployment(
self,
*,
model_id: str,
error_trace: t.Optional[bool] = None,
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
human: t.Optional[bool] = None,
number_of_allocations: t.Optional[int] = None,
pretty: t.Optional[bool] = None,
body: t.Optional[t.Dict[str, t.Any]] = None,
) -> ObjectApiResponse[t.Any]:
"""
Updates certain properties of trained model deployment.

`<https://www.elastic.co/guide/en/elasticsearch/reference/master/update-trained-model-deployment.html>`_

:param model_id: The unique identifier of the trained model. Currently, only
PyTorch models are supported.
:param number_of_allocations: The number of model allocations on each node where
the model is deployed. All allocations on a node share the same copy of the
model in memory but use a separate set of threads to evaluate the model.
Increasing this value generally increases the throughput. If this setting
is greater than the number of hardware threads it will automatically be changed
to a value less than the number of hardware threads.
"""
if model_id in SKIP_IN_PATH:
raise ValueError("Empty value passed for parameter 'model_id'")
__path_parts: t.Dict[str, str] = {"model_id": _quote(model_id)}
__path = f'/_ml/trained_models/{__path_parts["model_id"]}/deployment/_update'
__query: t.Dict[str, t.Any] = {}
__body: t.Dict[str, t.Any] = body if body is not None else {}
if error_trace is not None:
__query["error_trace"] = error_trace
if filter_path is not None:
__query["filter_path"] = filter_path
if human is not None:
__query["human"] = human
if pretty is not None:
__query["pretty"] = pretty
if not __body:
if number_of_allocations is not None:
__body["number_of_allocations"] = number_of_allocations
__headers = {"accept": "application/json", "content-type": "application/json"}
return await self.perform_request( # type: ignore[return-value]
"POST",
__path,
params=__query,
headers=__headers,
body=__body,
endpoint_id="ml.update_trained_model_deployment",
path_parts=__path_parts,
)

@_rewrite_parameters()
async def upgrade_job_snapshot(
self,
Expand Down
56 changes: 56 additions & 0 deletions elasticsearch/_sync/client/ml.py
Original file line number Diff line number Diff line change
Expand Up @@ -5043,6 +5043,62 @@ def update_model_snapshot(
path_parts=__path_parts,
)

@_rewrite_parameters(
body_fields=("number_of_allocations",),
)
def update_trained_model_deployment(
self,
*,
model_id: str,
error_trace: t.Optional[bool] = None,
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
human: t.Optional[bool] = None,
number_of_allocations: t.Optional[int] = None,
pretty: t.Optional[bool] = None,
body: t.Optional[t.Dict[str, t.Any]] = None,
) -> ObjectApiResponse[t.Any]:
"""
Updates certain properties of trained model deployment.

`<https://www.elastic.co/guide/en/elasticsearch/reference/master/update-trained-model-deployment.html>`_

:param model_id: The unique identifier of the trained model. Currently, only
PyTorch models are supported.
:param number_of_allocations: The number of model allocations on each node where
the model is deployed. All allocations on a node share the same copy of the
model in memory but use a separate set of threads to evaluate the model.
Increasing this value generally increases the throughput. If this setting
is greater than the number of hardware threads it will automatically be changed
to a value less than the number of hardware threads.
"""
if model_id in SKIP_IN_PATH:
raise ValueError("Empty value passed for parameter 'model_id'")
__path_parts: t.Dict[str, str] = {"model_id": _quote(model_id)}
__path = f'/_ml/trained_models/{__path_parts["model_id"]}/deployment/_update'
__query: t.Dict[str, t.Any] = {}
__body: t.Dict[str, t.Any] = body if body is not None else {}
if error_trace is not None:
__query["error_trace"] = error_trace
if filter_path is not None:
__query["filter_path"] = filter_path
if human is not None:
__query["human"] = human
if pretty is not None:
__query["pretty"] = pretty
if not __body:
if number_of_allocations is not None:
__body["number_of_allocations"] = number_of_allocations
__headers = {"accept": "application/json", "content-type": "application/json"}
return self.perform_request( # type: ignore[return-value]
"POST",
__path,
params=__query,
headers=__headers,
body=__body,
endpoint_id="ml.update_trained_model_deployment",
path_parts=__path_parts,
)

@_rewrite_parameters()
def upgrade_job_snapshot(
self,
Expand Down
Loading