diff options
| author | S. Solomon Darnell | 2025-03-28 21:52:21 -0500 |
|---|---|---|
| committer | S. Solomon Darnell | 2025-03-28 21:52:21 -0500 |
| commit | 4a52a71956a8d46fcb7294ac71734504bb09bcc2 (patch) | |
| tree | ee3dc5af3b6313e921cd920906356f5d4febc4ed /.venv/lib/python3.12/site-packages/azure/ai/ml/_restclient/runhistory/operations | |
| parent | cc961e04ba734dd72309fb548a2f97d67d578813 (diff) | |
| download | gn-ai-master.tar.gz | |
Diffstat (limited to '.venv/lib/python3.12/site-packages/azure/ai/ml/_restclient/runhistory/operations')
9 files changed, 9556 insertions, 0 deletions
diff --git a/.venv/lib/python3.12/site-packages/azure/ai/ml/_restclient/runhistory/operations/__init__.py b/.venv/lib/python3.12/site-packages/azure/ai/ml/_restclient/runhistory/operations/__init__.py new file mode 100644 index 00000000..3e84a44a --- /dev/null +++ b/.venv/lib/python3.12/site-packages/azure/ai/ml/_restclient/runhistory/operations/__init__.py @@ -0,0 +1,27 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._delete_operations import DeleteOperations +from ._events_operations import EventsOperations +from ._experiments_operations import ExperimentsOperations +from ._metric_operations import MetricOperations +from ._runs_operations import RunsOperations +from ._run_artifacts_operations import RunArtifactsOperations +from ._run_operations import RunOperations +from ._spans_operations import SpansOperations + +__all__ = [ + 'DeleteOperations', + 'EventsOperations', + 'ExperimentsOperations', + 'MetricOperations', + 'RunsOperations', + 'RunArtifactsOperations', + 'RunOperations', + 'SpansOperations', +] diff --git a/.venv/lib/python3.12/site-packages/azure/ai/ml/_restclient/runhistory/operations/_delete_operations.py b/.venv/lib/python3.12/site-packages/azure/ai/ml/_restclient/runhistory/operations/_delete_operations.py new file mode 100644 index 00000000..9080611e --- /dev/null +++ b/.venv/lib/python3.12/site-packages/azure/ai/ml/_restclient/runhistory/operations/_delete_operations.py @@ -0,0 +1,248 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Optional, TypeVar + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_patch_configuration_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/history/v1.0/private/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/deleteConfiguration") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + headers=_header_parameters, + **kwargs + ) + + +def build_get_configuration_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/history/v1.0/private/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/deleteConfiguration") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + headers=_header_parameters, + **kwargs + ) + +# fmt: on +class DeleteOperations(object): + """DeleteOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.machinelearningservices.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def patch_configuration( + self, + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + body=None, # type: Optional["_models.DeleteConfiguration"] + **kwargs # type: Any + ): + # type: (...) -> "_models.DeleteConfiguration" + """patch_configuration. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param body: + :type body: ~azure.mgmt.machinelearningservices.models.DeleteConfiguration + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeleteConfiguration, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.DeleteConfiguration + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeleteConfiguration"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if body is not None: + _json = self._serialize.body(body, 'DeleteConfiguration') + else: + _json = None + + request = build_patch_configuration_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + content_type=content_type, + json=_json, + template_url=self.patch_configuration.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeleteConfiguration', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + patch_configuration.metadata = {'url': "/history/v1.0/private/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/deleteConfiguration"} # type: ignore + + + @distributed_trace + def get_configuration( + self, + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.DeleteConfiguration" + """get_configuration. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeleteConfiguration, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.DeleteConfiguration + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeleteConfiguration"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_configuration_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=self.get_configuration.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeleteConfiguration', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_configuration.metadata = {'url': "/history/v1.0/private/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/deleteConfiguration"} # type: ignore + diff --git a/.venv/lib/python3.12/site-packages/azure/ai/ml/_restclient/runhistory/operations/_events_operations.py b/.venv/lib/python3.12/site-packages/azure/ai/ml/_restclient/runhistory/operations/_events_operations.py new file mode 100644 index 00000000..f87546d9 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/azure/ai/ml/_restclient/runhistory/operations/_events_operations.py @@ -0,0 +1,713 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Optional, TypeVar + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_batch_post_by_experiment_name_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + experiment_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experiments/{experimentName}/batch/events") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "experimentName": _SERIALIZER.url("experiment_name", experiment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + headers=_header_parameters, + **kwargs + ) + + +def build_batch_post_by_experiment_id_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + experiment_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experimentids/{experimentId}/batch/events") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "experimentId": _SERIALIZER.url("experiment_id", experiment_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + headers=_header_parameters, + **kwargs + ) + + +def build_batch_post_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/batch/events") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + headers=_header_parameters, + **kwargs + ) + + +def build_post_by_experiment_name_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + experiment_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experiments/{experimentName}/runs/{runId}/events") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "runId": _SERIALIZER.url("run_id", run_id, 'str'), + "experimentName": _SERIALIZER.url("experiment_name", experiment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + headers=_header_parameters, + **kwargs + ) + + +def build_post_by_experiment_id_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + experiment_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experimentids/{experimentId}/runs/{runId}/events") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "runId": _SERIALIZER.url("run_id", run_id, 'str'), + "experimentId": _SERIALIZER.url("experiment_id", experiment_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + headers=_header_parameters, + **kwargs + ) + + +def build_post_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/runs/{runId}/events") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "runId": _SERIALIZER.url("run_id", run_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + headers=_header_parameters, + **kwargs + ) + +# fmt: on +class EventsOperations(object): + """EventsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.machinelearningservices.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def batch_post_by_experiment_name( + self, + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + experiment_name, # type: str + body=None, # type: Optional["_models.BatchEventCommand"] + **kwargs # type: Any + ): + # type: (...) -> "_models.BatchEventCommandResult" + """batch_post_by_experiment_name. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param experiment_name: + :type experiment_name: str + :param body: + :type body: ~azure.mgmt.machinelearningservices.models.BatchEventCommand + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BatchEventCommandResult, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.BatchEventCommandResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BatchEventCommandResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if body is not None: + _json = self._serialize.body(body, 'BatchEventCommand') + else: + _json = None + + request = build_batch_post_by_experiment_name_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + experiment_name=experiment_name, + content_type=content_type, + json=_json, + template_url=self.batch_post_by_experiment_name.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('BatchEventCommandResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + batch_post_by_experiment_name.metadata = {'url': "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experiments/{experimentName}/batch/events"} # type: ignore + + + @distributed_trace + def batch_post_by_experiment_id( + self, + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + experiment_id, # type: str + body=None, # type: Optional["_models.BatchEventCommand"] + **kwargs # type: Any + ): + # type: (...) -> "_models.BatchEventCommandResult" + """batch_post_by_experiment_id. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param experiment_id: + :type experiment_id: str + :param body: + :type body: ~azure.mgmt.machinelearningservices.models.BatchEventCommand + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BatchEventCommandResult, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.BatchEventCommandResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BatchEventCommandResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if body is not None: + _json = self._serialize.body(body, 'BatchEventCommand') + else: + _json = None + + request = build_batch_post_by_experiment_id_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + experiment_id=experiment_id, + content_type=content_type, + json=_json, + template_url=self.batch_post_by_experiment_id.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('BatchEventCommandResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + batch_post_by_experiment_id.metadata = {'url': "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experimentids/{experimentId}/batch/events"} # type: ignore + + + @distributed_trace + def batch_post( + self, + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + body=None, # type: Optional["_models.BatchEventCommand"] + **kwargs # type: Any + ): + # type: (...) -> "_models.BatchEventCommandResult" + """batch_post. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param body: + :type body: ~azure.mgmt.machinelearningservices.models.BatchEventCommand + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BatchEventCommandResult, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.BatchEventCommandResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BatchEventCommandResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if body is not None: + _json = self._serialize.body(body, 'BatchEventCommand') + else: + _json = None + + request = build_batch_post_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + content_type=content_type, + json=_json, + template_url=self.batch_post.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('BatchEventCommandResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + batch_post.metadata = {'url': "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/batch/events"} # type: ignore + + + @distributed_trace + def post_by_experiment_name( # pylint: disable=inconsistent-return-statements + self, + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + experiment_name, # type: str + body=None, # type: Optional["_models.BaseEvent"] + **kwargs # type: Any + ): + # type: (...) -> None + """post_by_experiment_name. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param run_id: + :type run_id: str + :param experiment_name: + :type experiment_name: str + :param body: + :type body: ~azure.mgmt.machinelearningservices.models.BaseEvent + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if body is not None: + _json = self._serialize.body(body, 'BaseEvent') + else: + _json = None + + request = build_post_by_experiment_name_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + run_id=run_id, + experiment_name=experiment_name, + content_type=content_type, + json=_json, + template_url=self.post_by_experiment_name.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in []: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + post_by_experiment_name.metadata = {'url': "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experiments/{experimentName}/runs/{runId}/events"} # type: ignore + + + @distributed_trace + def post_by_experiment_id( # pylint: disable=inconsistent-return-statements + self, + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + experiment_id, # type: str + body=None, # type: Optional["_models.BaseEvent"] + **kwargs # type: Any + ): + # type: (...) -> None + """post_by_experiment_id. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param run_id: + :type run_id: str + :param experiment_id: + :type experiment_id: str + :param body: + :type body: ~azure.mgmt.machinelearningservices.models.BaseEvent + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if body is not None: + _json = self._serialize.body(body, 'BaseEvent') + else: + _json = None + + request = build_post_by_experiment_id_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + run_id=run_id, + experiment_id=experiment_id, + content_type=content_type, + json=_json, + template_url=self.post_by_experiment_id.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in []: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + post_by_experiment_id.metadata = {'url': "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experimentids/{experimentId}/runs/{runId}/events"} # type: ignore + + + @distributed_trace + def post( # pylint: disable=inconsistent-return-statements + self, + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + body=None, # type: Optional["_models.BaseEvent"] + **kwargs # type: Any + ): + # type: (...) -> None + """post. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param run_id: + :type run_id: str + :param body: + :type body: ~azure.mgmt.machinelearningservices.models.BaseEvent + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if body is not None: + _json = self._serialize.body(body, 'BaseEvent') + else: + _json = None + + request = build_post_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + run_id=run_id, + content_type=content_type, + json=_json, + template_url=self.post.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in []: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + post.metadata = {'url': "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/runs/{runId}/events"} # type: ignore + diff --git a/.venv/lib/python3.12/site-packages/azure/ai/ml/_restclient/runhistory/operations/_experiments_operations.py b/.venv/lib/python3.12/site-packages/azure/ai/ml/_restclient/runhistory/operations/_experiments_operations.py new file mode 100644 index 00000000..3b12b9c1 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/azure/ai/ml/_restclient/runhistory/operations/_experiments_operations.py @@ -0,0 +1,878 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_get_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + experiment_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experiments/{experimentName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "experimentName": _SERIALIZER.url("experiment_name", experiment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + headers=_header_parameters, + **kwargs + ) + + +def build_create_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + experiment_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experiments/{experimentName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "experimentName": _SERIALIZER.url("experiment_name", experiment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + headers=_header_parameters, + **kwargs + ) + + +def build_get_by_id_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + experiment_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experimentids/{experimentId}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "experimentId": _SERIALIZER.url("experiment_id", experiment_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + headers=_header_parameters, + **kwargs + ) + + +def build_update_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + experiment_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experimentids/{experimentId}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "experimentId": _SERIALIZER.url("experiment_id", experiment_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + headers=_header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + experiment_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experimentids/{experimentId}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "experimentId": _SERIALIZER.url("experiment_id", experiment_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + headers=_header_parameters, + **kwargs + ) + + +def build_get_by_query_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + url_safe_experiment_names_only = kwargs.pop('url_safe_experiment_names_only', True) # type: Optional[bool] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experiments:query") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if url_safe_experiment_names_only is not None: + _query_parameters['urlSafeExperimentNamesOnly'] = _SERIALIZER.query("url_safe_experiment_names_only", url_safe_experiment_names_only, 'bool') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_delete_tags_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + experiment_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experimentids/{experimentId}/tags:delete") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "experimentId": _SERIALIZER.url("experiment_id", experiment_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + headers=_header_parameters, + **kwargs + ) + +# fmt: on +class ExperimentsOperations(object): + """ExperimentsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.machinelearningservices.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def get( + self, + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + experiment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.Experiment" + """Get details of an Experiment. + + Get details of an Experiment with specific Experiment name. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param experiment_name: The experiment name. + :type experiment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Experiment, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.Experiment + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Experiment"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + experiment_name=experiment_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Experiment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experiments/{experimentName}"} # type: ignore + + + @distributed_trace + def create( + self, + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + experiment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.Experiment" + """Create an Experiment. + + Create a new Experiment. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param experiment_name: The experiment name. + :type experiment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Experiment, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.Experiment + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Experiment"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_create_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + experiment_name=experiment_name, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Experiment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create.metadata = {'url': "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experiments/{experimentName}"} # type: ignore + + + @distributed_trace + def get_by_id( + self, + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + experiment_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.Experiment" + """Get details of an Experiment. + + Get details of an Experiment with specific Experiment Id. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param experiment_id: The identifier of the experiment. + :type experiment_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Experiment, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.Experiment + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Experiment"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_by_id_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + experiment_id=experiment_id, + template_url=self.get_by_id.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Experiment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_by_id.metadata = {'url': "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experimentids/{experimentId}"} # type: ignore + + + @distributed_trace + def update( + self, + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + experiment_id, # type: str + body=None, # type: Optional["_models.ModifyExperiment"] + **kwargs # type: Any + ): + # type: (...) -> "_models.Experiment" + """Update details of an Experiment. + + Update details of an Experiment with specific Experiment Id. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param experiment_id: The identifier of the experiment. + :type experiment_id: str + :param body: Experiment details which needs to be updated. + :type body: ~azure.mgmt.machinelearningservices.models.ModifyExperiment + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Experiment, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.Experiment + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Experiment"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if body is not None: + _json = self._serialize.body(body, 'ModifyExperiment') + else: + _json = None + + request = build_update_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + experiment_id=experiment_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Experiment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experimentids/{experimentId}"} # type: ignore + + + def _delete_initial( + self, + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + experiment_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Any + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request_initial( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + experiment_id=experiment_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('object', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _delete_initial.metadata = {'url': "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experimentids/{experimentId}"} # type: ignore + + + @distributed_trace + def begin_delete( + self, + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + experiment_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[Any] + """Delete an Experiment. + + Delete an existing Empty Experiment. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param experiment_id: The identifier of the experiment. + :type experiment_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either any or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[any] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[Any] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + experiment_id=experiment_id, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('object', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experimentids/{experimentId}"} # type: ignore + + @distributed_trace + def get_by_query( + self, + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + url_safe_experiment_names_only=True, # type: Optional[bool] + body=None, # type: Optional["_models.ExperimentQueryParams"] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.PaginatedExperimentList"] + """Get all Experiments in a specific workspace. + + Get all experiments in a specific workspace with the specified query filters. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param url_safe_experiment_names_only: + :type url_safe_experiment_names_only: bool + :param body: Query parameters for data sorting and filtering. + :type body: ~azure.mgmt.machinelearningservices.models.ExperimentQueryParams + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PaginatedExperimentList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.PaginatedExperimentList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + cls = kwargs.pop('cls', None) # type: ClsType["_models.PaginatedExperimentList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + if body is not None: + _json = self._serialize.body(body, 'ExperimentQueryParams') + else: + _json = None + + request = build_get_by_query_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + content_type=content_type, + json=_json, + url_safe_experiment_names_only=url_safe_experiment_names_only, + template_url=self.get_by_query.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + if body is not None: + _json = self._serialize.body(body, 'ExperimentQueryParams') + else: + _json = None + + request = build_get_by_query_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + content_type=content_type, + json=_json, + url_safe_experiment_names_only=url_safe_experiment_names_only, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PaginatedExperimentList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + get_by_query.metadata = {'url': "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experiments:query"} # type: ignore + + @distributed_trace + def delete_tags( + self, + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + experiment_id, # type: str + body=None, # type: Optional["_models.DeleteTagsCommand"] + **kwargs # type: Any + ): + # type: (...) -> "_models.DeleteExperimentTagsResult" + """Delete list of Tags in an Experiment. + + Delete list of Tags from a specific Experiment Id. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param experiment_id: The identifier of the experiment. + :type experiment_id: str + :param body: The requested tags list to be deleted. + :type body: ~azure.mgmt.machinelearningservices.models.DeleteTagsCommand + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeleteExperimentTagsResult, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.DeleteExperimentTagsResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeleteExperimentTagsResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if body is not None: + _json = self._serialize.body(body, 'DeleteTagsCommand') + else: + _json = None + + request = build_delete_tags_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + experiment_id=experiment_id, + content_type=content_type, + json=_json, + template_url=self.delete_tags.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeleteExperimentTagsResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + delete_tags.metadata = {'url': "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experimentids/{experimentId}/tags:delete"} # type: ignore + diff --git a/.venv/lib/python3.12/site-packages/azure/ai/ml/_restclient/runhistory/operations/_metric_operations.py b/.venv/lib/python3.12/site-packages/azure/ai/ml/_restclient/runhistory/operations/_metric_operations.py new file mode 100644 index 00000000..f9184554 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/azure/ai/ml/_restclient/runhistory/operations/_metric_operations.py @@ -0,0 +1,1206 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_get_full_fidelity_metric_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/metric/v2.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/runs/{runId}/full") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "runId": _SERIALIZER.url("run_id", run_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + headers=_header_parameters, + **kwargs + ) + + +def build_list_metric_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/metric/v2.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/runs/{runId}/list") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "runId": _SERIALIZER.url("run_id", run_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + headers=_header_parameters, + **kwargs + ) + + +def build_list_generic_resource_metrics_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/metric/v2.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/azuremonitor/list") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + headers=_header_parameters, + **kwargs + ) + + +def build_get_sampled_metric_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/metric/v2.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/runs/{runId}/sample") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "runId": _SERIALIZER.url("run_id", run_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + headers=_header_parameters, + **kwargs + ) + + +def build_post_run_metrics_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/metric/v2.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/runs/{runId}/batch") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "runId": _SERIALIZER.url("run_id", run_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + headers=_header_parameters, + **kwargs + ) + + +def build_delete_metrics_by_data_container_id_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + experiment_id, # type: str + data_container_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/metric/v2.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experiments/{experimentId}/containers/{dataContainerId}/deleteMetrics") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "experimentId": _SERIALIZER.url("experiment_id", experiment_id, 'str'), + "dataContainerId": _SERIALIZER.url("data_container_id", data_container_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + headers=_header_parameters, + **kwargs + ) + + +def build_delete_metrics_by_run_id_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/metric/v2.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/runs/{runId}/deleteMetrics") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "runId": _SERIALIZER.url("run_id", run_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + headers=_header_parameters, + **kwargs + ) + + +def build_get_metric_details_by_experiment_name_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + metric_id, # type: str + experiment_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experiments/{experimentName}/metrics/{metricId}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "metricId": _SERIALIZER.url("metric_id", metric_id, 'str'), + "experimentName": _SERIALIZER.url("experiment_name", experiment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + headers=_header_parameters, + **kwargs + ) + + +def build_get_metric_details_by_experiment_id_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + metric_id, # type: str + experiment_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experimentids/{experimentId}/metrics/{metricId}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "metricId": _SERIALIZER.url("metric_id", metric_id, 'str'), + "experimentId": _SERIALIZER.url("experiment_id", experiment_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + headers=_header_parameters, + **kwargs + ) + +# fmt: on +class MetricOperations(object): + """MetricOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.machinelearningservices.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def get_full_fidelity_metric( + self, + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + body=None, # type: Optional["_models.RetrieveFullFidelityMetricRequest"] + **kwargs # type: Any + ): + # type: (...) -> "_models.MetricV2" + """API to retrieve the full-fidelity sequence associated with a particular run and metricName. + + API to retrieve the full-fidelity sequence associated with a particular run and metricName. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param run_id: + :type run_id: str + :param body: + :type body: ~azure.mgmt.machinelearningservices.models.RetrieveFullFidelityMetricRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MetricV2, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.MetricV2 + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MetricV2"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if body is not None: + _json = self._serialize.body(body, 'RetrieveFullFidelityMetricRequest') + else: + _json = None + + request = build_get_full_fidelity_metric_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + run_id=run_id, + content_type=content_type, + json=_json, + template_url=self.get_full_fidelity_metric.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('MetricV2', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_full_fidelity_metric.metadata = {'url': "/metric/v2.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/runs/{runId}/full"} # type: ignore + + + @distributed_trace + def list_metric( + self, + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + body=None, # type: Optional["_models.ListMetrics"] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.PaginatedMetricDefinitionList"] + """API to list metric for a particular datacontainer and metricName. + + API to list metric for a particular datacontainer and metricName. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param run_id: + :type run_id: str + :param body: + :type body: ~azure.mgmt.machinelearningservices.models.ListMetrics + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PaginatedMetricDefinitionList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.PaginatedMetricDefinitionList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + cls = kwargs.pop('cls', None) # type: ClsType["_models.PaginatedMetricDefinitionList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + if body is not None: + _json = self._serialize.body(body, 'ListMetrics') + else: + _json = None + + request = build_list_metric_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + run_id=run_id, + content_type=content_type, + json=_json, + template_url=self.list_metric.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + if body is not None: + _json = self._serialize.body(body, 'ListMetrics') + else: + _json = None + + request = build_list_metric_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + run_id=run_id, + content_type=content_type, + json=_json, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PaginatedMetricDefinitionList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_metric.metadata = {'url': "/metric/v2.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/runs/{runId}/list"} # type: ignore + + @distributed_trace + def list_generic_resource_metrics( + self, + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + body=None, # type: Optional["_models.ListGenericResourceMetrics"] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.PaginatedMetricDefinitionList"] + """API to list workspace/subworkspace resource metrics for a particular ResourceId. + + API to list workspace/subworkspace resource metrics for a particular ResourceId. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param body: + :type body: ~azure.mgmt.machinelearningservices.models.ListGenericResourceMetrics + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PaginatedMetricDefinitionList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.PaginatedMetricDefinitionList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + cls = kwargs.pop('cls', None) # type: ClsType["_models.PaginatedMetricDefinitionList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + if body is not None: + _json = self._serialize.body(body, 'ListGenericResourceMetrics') + else: + _json = None + + request = build_list_generic_resource_metrics_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + content_type=content_type, + json=_json, + template_url=self.list_generic_resource_metrics.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + if body is not None: + _json = self._serialize.body(body, 'ListGenericResourceMetrics') + else: + _json = None + + request = build_list_generic_resource_metrics_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + content_type=content_type, + json=_json, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PaginatedMetricDefinitionList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_generic_resource_metrics.metadata = {'url': "/metric/v2.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/azuremonitor/list"} # type: ignore + + @distributed_trace + def get_sampled_metric( + self, + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + body=None, # type: Optional["_models.GetSampledMetricRequest"] + **kwargs # type: Any + ): + # type: (...) -> "_models.MetricSample" + """Stub for future action + API to retrieve samples for one or many runs to compare a given metricName + Throw if schemas don't match across metrics. + + Stub for future action + API to retrieve samples for one or many runs to compare a given metricName + Throw if schemas don't match across metrics. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param run_id: + :type run_id: str + :param body: + :type body: ~azure.mgmt.machinelearningservices.models.GetSampledMetricRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MetricSample, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.MetricSample + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MetricSample"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if body is not None: + _json = self._serialize.body(body, 'GetSampledMetricRequest') + else: + _json = None + + request = build_get_sampled_metric_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + run_id=run_id, + content_type=content_type, + json=_json, + template_url=self.get_sampled_metric.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('MetricSample', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_sampled_metric.metadata = {'url': "/metric/v2.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/runs/{runId}/sample"} # type: ignore + + + @distributed_trace + def post_run_metrics( + self, + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + body=None, # type: Optional["_models.BatchIMetricV2"] + **kwargs # type: Any + ): + # type: (...) -> "_models.PostRunMetricsResult" + """Post Metrics to a Run. + + Post Metrics to a specific Run Id. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param run_id: + :type run_id: str + :param body: + :type body: ~azure.mgmt.machinelearningservices.models.BatchIMetricV2 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PostRunMetricsResult, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.PostRunMetricsResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PostRunMetricsResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if body is not None: + _json = self._serialize.body(body, 'BatchIMetricV2') + else: + _json = None + + request = build_post_run_metrics_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + run_id=run_id, + content_type=content_type, + json=_json, + template_url=self.post_run_metrics.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 207]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('PostRunMetricsResult', pipeline_response) + + if response.status_code == 207: + deserialized = self._deserialize('PostRunMetricsResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + post_run_metrics.metadata = {'url': "/metric/v2.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/runs/{runId}/batch"} # type: ignore + + + def _delete_metrics_by_data_container_id_initial( + self, + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + experiment_id, # type: str + data_container_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Any + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_metrics_by_data_container_id_request_initial( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + experiment_id=experiment_id, + data_container_id=data_container_id, + template_url=self._delete_metrics_by_data_container_id_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('object', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _delete_metrics_by_data_container_id_initial.metadata = {'url': "/metric/v2.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experiments/{experimentId}/containers/{dataContainerId}/deleteMetrics"} # type: ignore + + + @distributed_trace + def begin_delete_metrics_by_data_container_id( + self, + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + experiment_id, # type: str + data_container_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[Any] + """API to delete metrics by data container id. + + API to delete metrics by data container id. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param experiment_id: + :type experiment_id: str + :param data_container_id: + :type data_container_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either any or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[any] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[Any] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_metrics_by_data_container_id_initial( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + experiment_id=experiment_id, + data_container_id=data_container_id, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('object', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete_metrics_by_data_container_id.metadata = {'url': "/metric/v2.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experiments/{experimentId}/containers/{dataContainerId}/deleteMetrics"} # type: ignore + + def _delete_metrics_by_run_id_initial( + self, + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Any + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_metrics_by_run_id_request_initial( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + run_id=run_id, + template_url=self._delete_metrics_by_run_id_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('object', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _delete_metrics_by_run_id_initial.metadata = {'url': "/metric/v2.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/runs/{runId}/deleteMetrics"} # type: ignore + + + @distributed_trace + def begin_delete_metrics_by_run_id( + self, + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[Any] + """API to delete metrics by run id. + + API to delete metrics by run id. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param run_id: + :type run_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either any or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[any] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[Any] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_metrics_by_run_id_initial( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + run_id=run_id, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('object', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete_metrics_by_run_id.metadata = {'url': "/metric/v2.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/runs/{runId}/deleteMetrics"} # type: ignore + + @distributed_trace + def get_metric_details_by_experiment_name( + self, + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + metric_id, # type: str + experiment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.RunMetric" + """Get Metric details. + + Get Metric details for a specific Metric Id. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param metric_id: The identifier for a Metric. + :type metric_id: str + :param experiment_name: + :type experiment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RunMetric, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.RunMetric + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RunMetric"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_metric_details_by_experiment_name_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + metric_id=metric_id, + experiment_name=experiment_name, + template_url=self.get_metric_details_by_experiment_name.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RunMetric', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_metric_details_by_experiment_name.metadata = {'url': "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experiments/{experimentName}/metrics/{metricId}"} # type: ignore + + + @distributed_trace + def get_metric_details_by_experiment_id( + self, + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + metric_id, # type: str + experiment_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.RunMetric" + """Get Metric details. + + Get Metric details for a specific Metric Id. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param metric_id: The identifier for a Metric. + :type metric_id: str + :param experiment_id: + :type experiment_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RunMetric, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.RunMetric + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RunMetric"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_metric_details_by_experiment_id_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + metric_id=metric_id, + experiment_id=experiment_id, + template_url=self.get_metric_details_by_experiment_id.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RunMetric', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_metric_details_by_experiment_id.metadata = {'url': "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experimentids/{experimentId}/metrics/{metricId}"} # type: ignore + diff --git a/.venv/lib/python3.12/site-packages/azure/ai/ml/_restclient/runhistory/operations/_run_artifacts_operations.py b/.venv/lib/python3.12/site-packages/azure/ai/ml/_restclient/runhistory/operations/_run_artifacts_operations.py new file mode 100644 index 00000000..c7dd5930 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/azure/ai/ml/_restclient/runhistory/operations/_run_artifacts_operations.py @@ -0,0 +1,1850 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_in_container_by_experiment_name_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + experiment_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + continuation_token_parameter = kwargs.pop('continuation_token_parameter', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experiments/{experimentName}/runs/{runId}/artifacts") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "runId": _SERIALIZER.url("run_id", run_id, 'str'), + "experimentName": _SERIALIZER.url("experiment_name", experiment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if continuation_token_parameter is not None: + _query_parameters['continuationToken'] = _SERIALIZER.query("continuation_token_parameter", continuation_token_parameter, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_in_container_by_experiment_id_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + experiment_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + continuation_token_parameter = kwargs.pop('continuation_token_parameter', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experimentids/{experimentId}/runs/{runId}/artifacts") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "runId": _SERIALIZER.url("run_id", run_id, 'str'), + "experimentId": _SERIALIZER.url("experiment_id", experiment_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if continuation_token_parameter is not None: + _query_parameters['continuationToken'] = _SERIALIZER.query("continuation_token_parameter", continuation_token_parameter, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_in_path_by_experiment_name_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + experiment_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + path = kwargs.pop('path', None) # type: Optional[str] + continuation_token_parameter = kwargs.pop('continuation_token_parameter', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experiments/{experimentName}/runs/{runId}/artifacts/path") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "runId": _SERIALIZER.url("run_id", run_id, 'str'), + "experimentName": _SERIALIZER.url("experiment_name", experiment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if path is not None: + _query_parameters['path'] = _SERIALIZER.query("path", path, 'str') + if continuation_token_parameter is not None: + _query_parameters['continuationToken'] = _SERIALIZER.query("continuation_token_parameter", continuation_token_parameter, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_in_path_by_experiment_id_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + experiment_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + path = kwargs.pop('path', None) # type: Optional[str] + continuation_token_parameter = kwargs.pop('continuation_token_parameter', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experimentids/{experimentId}/runs/{runId}/artifacts/path") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "runId": _SERIALIZER.url("run_id", run_id, 'str'), + "experimentId": _SERIALIZER.url("experiment_id", experiment_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if path is not None: + _query_parameters['path'] = _SERIALIZER.query("path", path, 'str') + if continuation_token_parameter is not None: + _query_parameters['continuationToken'] = _SERIALIZER.query("continuation_token_parameter", continuation_token_parameter, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_by_id_by_experiment_name_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + experiment_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + path = kwargs.pop('path', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experiments/{experimentName}/runs/{runId}/artifacts/metadata") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "runId": _SERIALIZER.url("run_id", run_id, 'str'), + "experimentName": _SERIALIZER.url("experiment_name", experiment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if path is not None: + _query_parameters['path'] = _SERIALIZER.query("path", path, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_by_id_by_experiment_id_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + experiment_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + path = kwargs.pop('path', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experimentids/{experimentId}/runs/{runId}/artifacts/metadata") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "runId": _SERIALIZER.url("run_id", run_id, 'str'), + "experimentId": _SERIALIZER.url("experiment_id", experiment_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if path is not None: + _query_parameters['path'] = _SERIALIZER.query("path", path, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_content_information_by_experiment_name_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + experiment_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + path = kwargs.pop('path', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experiments/{experimentName}/runs/{runId}/artifacts/contentinfo") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "runId": _SERIALIZER.url("run_id", run_id, 'str'), + "experimentName": _SERIALIZER.url("experiment_name", experiment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if path is not None: + _query_parameters['path'] = _SERIALIZER.query("path", path, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_content_information_by_experiment_id_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + experiment_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + path = kwargs.pop('path', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experimentids/{experimentId}/runs/{runId}/artifacts/contentinfo") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "runId": _SERIALIZER.url("run_id", run_id, 'str'), + "experimentId": _SERIALIZER.url("experiment_id", experiment_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if path is not None: + _query_parameters['path'] = _SERIALIZER.query("path", path, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_sas_uri_by_experiment_name_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + experiment_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + path = kwargs.pop('path', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experiments/{experimentName}/runs/{runId}/artifacts/artifacturi") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "runId": _SERIALIZER.url("run_id", run_id, 'str'), + "experimentName": _SERIALIZER.url("experiment_name", experiment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if path is not None: + _query_parameters['path'] = _SERIALIZER.query("path", path, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_sas_uri_by_experiment_id_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + experiment_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + path = kwargs.pop('path', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experimentids/{experimentId}/runs/{runId}/artifacts/artifacturi") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "runId": _SERIALIZER.url("run_id", run_id, 'str'), + "experimentId": _SERIALIZER.url("experiment_id", experiment_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if path is not None: + _query_parameters['path'] = _SERIALIZER.query("path", path, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_sas_by_prefix_by_experiment_name_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + experiment_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + path = kwargs.pop('path', None) # type: Optional[str] + continuation_token_parameter = kwargs.pop('continuation_token_parameter', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experiments/{experimentName}/runs/{runId}/artifacts/prefix/contentinfo") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "runId": _SERIALIZER.url("run_id", run_id, 'str'), + "experimentName": _SERIALIZER.url("experiment_name", experiment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if path is not None: + _query_parameters['path'] = _SERIALIZER.query("path", path, 'str') + if continuation_token_parameter is not None: + _query_parameters['continuationToken'] = _SERIALIZER.query("continuation_token_parameter", continuation_token_parameter, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_sas_by_prefix_by_experiment_id_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + experiment_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + path = kwargs.pop('path', None) # type: Optional[str] + continuation_token_parameter = kwargs.pop('continuation_token_parameter', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experimentids/{experimentId}/runs/{runId}/artifacts/prefix/contentinfo") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "runId": _SERIALIZER.url("run_id", run_id, 'str'), + "experimentId": _SERIALIZER.url("experiment_id", experiment_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if path is not None: + _query_parameters['path'] = _SERIALIZER.query("path", path, 'str') + if continuation_token_parameter is not None: + _query_parameters['continuationToken'] = _SERIALIZER.query("continuation_token_parameter", continuation_token_parameter, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_batch_create_empty_artifacts_by_experiment_name_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + experiment_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experiments/{experimentName}/runs/{runId}/artifacts/batch/metadata") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "runId": _SERIALIZER.url("run_id", run_id, 'str'), + "experimentName": _SERIALIZER.url("experiment_name", experiment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + headers=_header_parameters, + **kwargs + ) + + +def build_batch_create_empty_artifacts_by_experiment_id_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + experiment_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experimentids/{experimentId}/runs/{runId}/artifacts/batch/metadata") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "runId": _SERIALIZER.url("run_id", run_id, 'str'), + "experimentId": _SERIALIZER.url("experiment_id", experiment_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + headers=_header_parameters, + **kwargs + ) + +# fmt: on +class RunArtifactsOperations(object): + """RunArtifactsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.machinelearningservices.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list_in_container_by_experiment_name( + self, + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + experiment_name, # type: str + continuation_token_parameter=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.PaginatedArtifactList"] + """list_in_container_by_experiment_name. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param run_id: + :type run_id: str + :param experiment_name: + :type experiment_name: str + :param continuation_token_parameter: + :type continuation_token_parameter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PaginatedArtifactList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.PaginatedArtifactList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PaginatedArtifactList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_in_container_by_experiment_name_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + run_id=run_id, + experiment_name=experiment_name, + continuation_token_parameter=continuation_token_parameter, + template_url=self.list_in_container_by_experiment_name.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_in_container_by_experiment_name_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + run_id=run_id, + experiment_name=experiment_name, + continuation_token_parameter=continuation_token_parameter, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PaginatedArtifactList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_in_container_by_experiment_name.metadata = {'url': "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experiments/{experimentName}/runs/{runId}/artifacts"} # type: ignore + + @distributed_trace + def list_in_container_by_experiment_id( + self, + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + experiment_id, # type: str + continuation_token_parameter=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.PaginatedArtifactList"] + """list_in_container_by_experiment_id. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param run_id: + :type run_id: str + :param experiment_id: + :type experiment_id: str + :param continuation_token_parameter: + :type continuation_token_parameter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PaginatedArtifactList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.PaginatedArtifactList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PaginatedArtifactList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_in_container_by_experiment_id_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + run_id=run_id, + experiment_id=experiment_id, + continuation_token_parameter=continuation_token_parameter, + template_url=self.list_in_container_by_experiment_id.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_in_container_by_experiment_id_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + run_id=run_id, + experiment_id=experiment_id, + continuation_token_parameter=continuation_token_parameter, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PaginatedArtifactList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_in_container_by_experiment_id.metadata = {'url': "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experimentids/{experimentId}/runs/{runId}/artifacts"} # type: ignore + + @distributed_trace + def list_in_path_by_experiment_name( + self, + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + experiment_name, # type: str + path=None, # type: Optional[str] + continuation_token_parameter=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.PaginatedArtifactList"] + """list_in_path_by_experiment_name. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param run_id: + :type run_id: str + :param experiment_name: + :type experiment_name: str + :param path: + :type path: str + :param continuation_token_parameter: + :type continuation_token_parameter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PaginatedArtifactList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.PaginatedArtifactList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PaginatedArtifactList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_in_path_by_experiment_name_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + run_id=run_id, + experiment_name=experiment_name, + path=path, + continuation_token_parameter=continuation_token_parameter, + template_url=self.list_in_path_by_experiment_name.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_in_path_by_experiment_name_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + run_id=run_id, + experiment_name=experiment_name, + path=path, + continuation_token_parameter=continuation_token_parameter, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PaginatedArtifactList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_in_path_by_experiment_name.metadata = {'url': "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experiments/{experimentName}/runs/{runId}/artifacts/path"} # type: ignore + + @distributed_trace + def list_in_path_by_experiment_id( + self, + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + experiment_id, # type: str + path=None, # type: Optional[str] + continuation_token_parameter=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.PaginatedArtifactList"] + """list_in_path_by_experiment_id. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param run_id: + :type run_id: str + :param experiment_id: + :type experiment_id: str + :param path: + :type path: str + :param continuation_token_parameter: + :type continuation_token_parameter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PaginatedArtifactList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.PaginatedArtifactList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PaginatedArtifactList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_in_path_by_experiment_id_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + run_id=run_id, + experiment_id=experiment_id, + path=path, + continuation_token_parameter=continuation_token_parameter, + template_url=self.list_in_path_by_experiment_id.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_in_path_by_experiment_id_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + run_id=run_id, + experiment_id=experiment_id, + path=path, + continuation_token_parameter=continuation_token_parameter, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PaginatedArtifactList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_in_path_by_experiment_id.metadata = {'url': "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experimentids/{experimentId}/runs/{runId}/artifacts/path"} # type: ignore + + @distributed_trace + def get_by_id_by_experiment_name( + self, + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + experiment_name, # type: str + path=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "_models.Artifact" + """get_by_id_by_experiment_name. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param run_id: + :type run_id: str + :param experiment_name: + :type experiment_name: str + :param path: + :type path: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Artifact, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.Artifact + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Artifact"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_by_id_by_experiment_name_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + run_id=run_id, + experiment_name=experiment_name, + path=path, + template_url=self.get_by_id_by_experiment_name.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Artifact', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_by_id_by_experiment_name.metadata = {'url': "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experiments/{experimentName}/runs/{runId}/artifacts/metadata"} # type: ignore + + + @distributed_trace + def get_by_id_by_experiment_id( + self, + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + experiment_id, # type: str + path=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "_models.Artifact" + """get_by_id_by_experiment_id. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param run_id: + :type run_id: str + :param experiment_id: + :type experiment_id: str + :param path: + :type path: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Artifact, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.Artifact + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Artifact"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_by_id_by_experiment_id_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + run_id=run_id, + experiment_id=experiment_id, + path=path, + template_url=self.get_by_id_by_experiment_id.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Artifact', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_by_id_by_experiment_id.metadata = {'url': "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experimentids/{experimentId}/runs/{runId}/artifacts/metadata"} # type: ignore + + + @distributed_trace + def get_content_information_by_experiment_name( + self, + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + experiment_name, # type: str + path=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "_models.ArtifactContentInformation" + """get_content_information_by_experiment_name. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param run_id: + :type run_id: str + :param experiment_name: + :type experiment_name: str + :param path: + :type path: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ArtifactContentInformation, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.ArtifactContentInformation + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ArtifactContentInformation"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_content_information_by_experiment_name_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + run_id=run_id, + experiment_name=experiment_name, + path=path, + template_url=self.get_content_information_by_experiment_name.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ArtifactContentInformation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_content_information_by_experiment_name.metadata = {'url': "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experiments/{experimentName}/runs/{runId}/artifacts/contentinfo"} # type: ignore + + + @distributed_trace + def get_content_information_by_experiment_id( + self, + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + experiment_id, # type: str + path=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "_models.ArtifactContentInformation" + """get_content_information_by_experiment_id. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param run_id: + :type run_id: str + :param experiment_id: + :type experiment_id: str + :param path: + :type path: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ArtifactContentInformation, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.ArtifactContentInformation + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ArtifactContentInformation"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_content_information_by_experiment_id_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + run_id=run_id, + experiment_id=experiment_id, + path=path, + template_url=self.get_content_information_by_experiment_id.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ArtifactContentInformation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_content_information_by_experiment_id.metadata = {'url': "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experimentids/{experimentId}/runs/{runId}/artifacts/contentinfo"} # type: ignore + + + @distributed_trace + def get_sas_uri_by_experiment_name( + self, + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + experiment_name, # type: str + path=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> str + """get_sas_uri_by_experiment_name. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param run_id: + :type run_id: str + :param experiment_name: + :type experiment_name: str + :param path: + :type path: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: str, or the result of cls(response) + :rtype: str + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_sas_uri_by_experiment_name_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + run_id=run_id, + experiment_name=experiment_name, + path=path, + template_url=self.get_sas_uri_by_experiment_name.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('str', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_sas_uri_by_experiment_name.metadata = {'url': "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experiments/{experimentName}/runs/{runId}/artifacts/artifacturi"} # type: ignore + + + @distributed_trace + def get_sas_uri_by_experiment_id( + self, + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + experiment_id, # type: str + path=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> str + """get_sas_uri_by_experiment_id. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param run_id: + :type run_id: str + :param experiment_id: + :type experiment_id: str + :param path: + :type path: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: str, or the result of cls(response) + :rtype: str + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_sas_uri_by_experiment_id_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + run_id=run_id, + experiment_id=experiment_id, + path=path, + template_url=self.get_sas_uri_by_experiment_id.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('str', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_sas_uri_by_experiment_id.metadata = {'url': "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experimentids/{experimentId}/runs/{runId}/artifacts/artifacturi"} # type: ignore + + + @distributed_trace + def list_sas_by_prefix_by_experiment_name( + self, + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + experiment_name, # type: str + path=None, # type: Optional[str] + continuation_token_parameter=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.PaginatedArtifactContentInformationList"] + """list_sas_by_prefix_by_experiment_name. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param run_id: + :type run_id: str + :param experiment_name: + :type experiment_name: str + :param path: + :type path: str + :param continuation_token_parameter: + :type continuation_token_parameter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PaginatedArtifactContentInformationList or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.PaginatedArtifactContentInformationList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PaginatedArtifactContentInformationList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_sas_by_prefix_by_experiment_name_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + run_id=run_id, + experiment_name=experiment_name, + path=path, + continuation_token_parameter=continuation_token_parameter, + template_url=self.list_sas_by_prefix_by_experiment_name.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_sas_by_prefix_by_experiment_name_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + run_id=run_id, + experiment_name=experiment_name, + path=path, + continuation_token_parameter=continuation_token_parameter, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PaginatedArtifactContentInformationList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_sas_by_prefix_by_experiment_name.metadata = {'url': "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experiments/{experimentName}/runs/{runId}/artifacts/prefix/contentinfo"} # type: ignore + + @distributed_trace + def list_sas_by_prefix_by_experiment_id( + self, + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + experiment_id, # type: str + path=None, # type: Optional[str] + continuation_token_parameter=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.PaginatedArtifactContentInformationList"] + """list_sas_by_prefix_by_experiment_id. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param run_id: + :type run_id: str + :param experiment_id: + :type experiment_id: str + :param path: + :type path: str + :param continuation_token_parameter: + :type continuation_token_parameter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PaginatedArtifactContentInformationList or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.PaginatedArtifactContentInformationList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PaginatedArtifactContentInformationList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_sas_by_prefix_by_experiment_id_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + run_id=run_id, + experiment_id=experiment_id, + path=path, + continuation_token_parameter=continuation_token_parameter, + template_url=self.list_sas_by_prefix_by_experiment_id.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_sas_by_prefix_by_experiment_id_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + run_id=run_id, + experiment_id=experiment_id, + path=path, + continuation_token_parameter=continuation_token_parameter, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PaginatedArtifactContentInformationList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_sas_by_prefix_by_experiment_id.metadata = {'url': "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experimentids/{experimentId}/runs/{runId}/artifacts/prefix/contentinfo"} # type: ignore + + @distributed_trace + def batch_create_empty_artifacts_by_experiment_name( + self, + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + experiment_name, # type: str + body=None, # type: Optional["_models.ArtifactPathList"] + **kwargs # type: Any + ): + # type: (...) -> "_models.BatchArtifactContentInformationResult" + """batch_create_empty_artifacts_by_experiment_name. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param run_id: + :type run_id: str + :param experiment_name: + :type experiment_name: str + :param body: + :type body: ~azure.mgmt.machinelearningservices.models.ArtifactPathList + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BatchArtifactContentInformationResult, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.BatchArtifactContentInformationResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BatchArtifactContentInformationResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if body is not None: + _json = self._serialize.body(body, 'ArtifactPathList') + else: + _json = None + + request = build_batch_create_empty_artifacts_by_experiment_name_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + run_id=run_id, + experiment_name=experiment_name, + content_type=content_type, + json=_json, + template_url=self.batch_create_empty_artifacts_by_experiment_name.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('BatchArtifactContentInformationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + batch_create_empty_artifacts_by_experiment_name.metadata = {'url': "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experiments/{experimentName}/runs/{runId}/artifacts/batch/metadata"} # type: ignore + + + @distributed_trace + def batch_create_empty_artifacts_by_experiment_id( + self, + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + experiment_id, # type: str + body=None, # type: Optional["_models.ArtifactPathList"] + **kwargs # type: Any + ): + # type: (...) -> "_models.BatchArtifactContentInformationResult" + """batch_create_empty_artifacts_by_experiment_id. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param run_id: + :type run_id: str + :param experiment_id: + :type experiment_id: str + :param body: + :type body: ~azure.mgmt.machinelearningservices.models.ArtifactPathList + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BatchArtifactContentInformationResult, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.BatchArtifactContentInformationResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BatchArtifactContentInformationResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if body is not None: + _json = self._serialize.body(body, 'ArtifactPathList') + else: + _json = None + + request = build_batch_create_empty_artifacts_by_experiment_id_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + run_id=run_id, + experiment_id=experiment_id, + content_type=content_type, + json=_json, + template_url=self.batch_create_empty_artifacts_by_experiment_id.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('BatchArtifactContentInformationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + batch_create_empty_artifacts_by_experiment_id.metadata = {'url': "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experimentids/{experimentId}/runs/{runId}/artifacts/batch/metadata"} # type: ignore + diff --git a/.venv/lib/python3.12/site-packages/azure/ai/ml/_restclient/runhistory/operations/_run_operations.py b/.venv/lib/python3.12/site-packages/azure/ai/ml/_restclient/runhistory/operations/_run_operations.py new file mode 100644 index 00000000..c8591bff --- /dev/null +++ b/.venv/lib/python3.12/site-packages/azure/ai/ml/_restclient/runhistory/operations/_run_operations.py @@ -0,0 +1,233 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Iterable, List, Optional, TypeVar, Union + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_compute_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + compute_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + filter = kwargs.pop('filter', None) # type: Optional[str] + continuationtoken = kwargs.pop('continuationtoken', None) # type: Optional[str] + orderby = kwargs.pop('orderby', None) # type: Optional[List[str]] + sortorder = kwargs.pop('sortorder', None) # type: Optional[Union[str, "_models.SortOrderDirection"]] + top = kwargs.pop('top', None) # type: Optional[int] + count = kwargs.pop('count', None) # type: Optional[bool] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/runs") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "computeName": _SERIALIZER.url("compute_name", compute_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if filter is not None: + _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if continuationtoken is not None: + _query_parameters['$continuationtoken'] = _SERIALIZER.query("continuationtoken", continuationtoken, 'str') + if orderby is not None: + _query_parameters['$orderby'] = _SERIALIZER.query("orderby", orderby, '[str]') + if sortorder is not None: + _query_parameters['$sortorder'] = _SERIALIZER.query("sortorder", sortorder, 'str') + if top is not None: + _query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + if count is not None: + _query_parameters['$count'] = _SERIALIZER.query("count", count, 'bool') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +# fmt: on +class RunOperations(object): + """RunOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.machinelearningservices.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list_by_compute( + self, + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + compute_name, # type: str + filter=None, # type: Optional[str] + continuationtoken=None, # type: Optional[str] + orderby=None, # type: Optional[List[str]] + sortorder=None, # type: Optional[Union[str, "_models.SortOrderDirection"]] + top=None, # type: Optional[int] + count=None, # type: Optional[bool] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.PaginatedRunList"] + """list_by_compute. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param compute_name: + :type compute_name: str + :param filter: Allows for filtering the collection of resources. + The expression specified is evaluated for each resource in the collection, and only items + where the expression evaluates to true are included in the response. + :type filter: str + :param continuationtoken: The continuation token to use for getting the next set of resources. + :type continuationtoken: str + :param orderby: The list of resource properties to use for sorting the requested resources. + :type orderby: list[str] + :param sortorder: The sort order of the returned resources. Not used, specify asc or desc after + each property name in the OrderBy parameter. + :type sortorder: str or ~azure.mgmt.machinelearningservices.models.SortOrderDirection + :param top: The maximum number of items in the resource collection to be included in the + result. + If not specified, all items are returned. + :type top: int + :param count: Whether to include a count of the matching resources along with the resources + returned in the response. + :type count: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PaginatedRunList or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.PaginatedRunList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PaginatedRunList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_compute_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + compute_name=compute_name, + filter=filter, + continuationtoken=continuationtoken, + orderby=orderby, + sortorder=sortorder, + top=top, + count=count, + template_url=self.list_by_compute.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_compute_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + compute_name=compute_name, + filter=filter, + continuationtoken=continuationtoken, + orderby=orderby, + sortorder=sortorder, + top=top, + count=count, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PaginatedRunList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_compute.metadata = {'url': "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/runs"} # type: ignore diff --git a/.venv/lib/python3.12/site-packages/azure/ai/ml/_restclient/runhistory/operations/_runs_operations.py b/.venv/lib/python3.12/site-packages/azure/ai/ml/_restclient/runhistory/operations/_runs_operations.py new file mode 100644 index 00000000..a95f5652 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/azure/ai/ml/_restclient/runhistory/operations/_runs_operations.py @@ -0,0 +1,3972 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Iterable, List, Optional, TypeVar, Union + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_get_child_by_experiment_name_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + experiment_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + filter = kwargs.pop('filter', None) # type: Optional[str] + continuationtoken = kwargs.pop('continuationtoken', None) # type: Optional[str] + orderby = kwargs.pop('orderby', None) # type: Optional[List[str]] + sortorder = kwargs.pop('sortorder', None) # type: Optional[Union[str, "_models.SortOrderDirection"]] + top = kwargs.pop('top', None) # type: Optional[int] + count = kwargs.pop('count', None) # type: Optional[bool] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experiments/{experimentName}/runs/{runId}/children") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "runId": _SERIALIZER.url("run_id", run_id, 'str'), + "experimentName": _SERIALIZER.url("experiment_name", experiment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if filter is not None: + _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if continuationtoken is not None: + _query_parameters['$continuationtoken'] = _SERIALIZER.query("continuationtoken", continuationtoken, 'str') + if orderby is not None: + _query_parameters['$orderby'] = _SERIALIZER.query("orderby", orderby, '[str]') + if sortorder is not None: + _query_parameters['$sortorder'] = _SERIALIZER.query("sortorder", sortorder, 'str') + if top is not None: + _query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + if count is not None: + _query_parameters['$count'] = _SERIALIZER.query("count", count, 'bool') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_child_by_experiment_id_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + experiment_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + filter = kwargs.pop('filter', None) # type: Optional[str] + continuationtoken = kwargs.pop('continuationtoken', None) # type: Optional[str] + orderby = kwargs.pop('orderby', None) # type: Optional[List[str]] + sortorder = kwargs.pop('sortorder', None) # type: Optional[Union[str, "_models.SortOrderDirection"]] + top = kwargs.pop('top', None) # type: Optional[int] + count = kwargs.pop('count', None) # type: Optional[bool] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experimentids/{experimentId}/runs/{runId}/children") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "runId": _SERIALIZER.url("run_id", run_id, 'str'), + "experimentId": _SERIALIZER.url("experiment_id", experiment_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if filter is not None: + _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if continuationtoken is not None: + _query_parameters['$continuationtoken'] = _SERIALIZER.query("continuationtoken", continuationtoken, 'str') + if orderby is not None: + _query_parameters['$orderby'] = _SERIALIZER.query("orderby", orderby, '[str]') + if sortorder is not None: + _query_parameters['$sortorder'] = _SERIALIZER.query("sortorder", sortorder, 'str') + if top is not None: + _query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + if count is not None: + _query_parameters['$count'] = _SERIALIZER.query("count", count, 'bool') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_child_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + filter = kwargs.pop('filter', None) # type: Optional[str] + continuationtoken = kwargs.pop('continuationtoken', None) # type: Optional[str] + orderby = kwargs.pop('orderby', None) # type: Optional[List[str]] + sortorder = kwargs.pop('sortorder', None) # type: Optional[Union[str, "_models.SortOrderDirection"]] + top = kwargs.pop('top', None) # type: Optional[int] + count = kwargs.pop('count', None) # type: Optional[bool] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/runs/{runId}/children") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "runId": _SERIALIZER.url("run_id", run_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if filter is not None: + _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if continuationtoken is not None: + _query_parameters['$continuationtoken'] = _SERIALIZER.query("continuationtoken", continuationtoken, 'str') + if orderby is not None: + _query_parameters['$orderby'] = _SERIALIZER.query("orderby", orderby, '[str]') + if sortorder is not None: + _query_parameters['$sortorder'] = _SERIALIZER.query("sortorder", sortorder, 'str') + if top is not None: + _query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + if count is not None: + _query_parameters['$count'] = _SERIALIZER.query("count", count, 'bool') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_details_by_experiment_id_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + experiment_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experimentids/{experimentId}/runs/{runId}/details") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "runId": _SERIALIZER.url("run_id", run_id, 'str'), + "experimentId": _SERIALIZER.url("experiment_id", experiment_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + headers=_header_parameters, + **kwargs + ) + + +def build_get_details_by_experiment_name_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + experiment_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experiments/{experimentName}/runs/{runId}/details") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "runId": _SERIALIZER.url("run_id", run_id, 'str'), + "experimentName": _SERIALIZER.url("experiment_name", experiment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + headers=_header_parameters, + **kwargs + ) + + +def build_get_details_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/runs/{runId}/details") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "runId": _SERIALIZER.url("run_id", run_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + headers=_header_parameters, + **kwargs + ) + + +def build_get_run_data_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/rundata") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + headers=_header_parameters, + **kwargs + ) + + +def build_batch_get_run_data_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/batchrundata") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + headers=_header_parameters, + **kwargs + ) + + +def build_batch_add_or_modify_by_experiment_id_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + experiment_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experimentids/{experimentId}/batch/runs") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "experimentId": _SERIALIZER.url("experiment_id", experiment_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + headers=_header_parameters, + **kwargs + ) + + +def build_batch_add_or_modify_by_experiment_name_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + experiment_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experiments/{experimentName}/batch/runs") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "experimentName": _SERIALIZER.url("experiment_name", experiment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + headers=_header_parameters, + **kwargs + ) + + +def build_add_or_modify_by_experiment_name_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + experiment_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experiments/{experimentName}/runs/{runId}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "runId": _SERIALIZER.url("run_id", run_id, 'str', pattern=r'^[a-zA-Z0-9][\w-]{0,255}$'), + "experimentName": _SERIALIZER.url("experiment_name", experiment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + headers=_header_parameters, + **kwargs + ) + + +def build_get_by_experiment_name_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + experiment_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experiments/{experimentName}/runs/{runId}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "runId": _SERIALIZER.url("run_id", run_id, 'str'), + "experimentName": _SERIALIZER.url("experiment_name", experiment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + headers=_header_parameters, + **kwargs + ) + + +def build_add_or_modify_by_experiment_id_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + experiment_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experimentids/{experimentId}/runs/{runId}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "runId": _SERIALIZER.url("run_id", run_id, 'str', pattern=r'^[a-zA-Z0-9][\w-]{0,255}$'), + "experimentId": _SERIALIZER.url("experiment_id", experiment_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + headers=_header_parameters, + **kwargs + ) + + +def build_get_by_experiment_id_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + experiment_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experimentids/{experimentId}/runs/{runId}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "runId": _SERIALIZER.url("run_id", run_id, 'str'), + "experimentId": _SERIALIZER.url("experiment_id", experiment_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + headers=_header_parameters, + **kwargs + ) + + +def build_add_or_modify_experiment_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/runs/{runId}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "runId": _SERIALIZER.url("run_id", run_id, 'str', pattern=r'^[a-zA-Z0-9][\w-]{0,255}$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + headers=_header_parameters, + **kwargs + ) + + +def build_add_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/runs/{runId}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "runId": _SERIALIZER.url("run_id", run_id, 'str', pattern=r'^[a-zA-Z0-9][\w-]{0,255}$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + headers=_header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/runs/{runId}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "runId": _SERIALIZER.url("run_id", run_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + headers=_header_parameters, + **kwargs + ) + + +def build_delete_tags_by_experiment_id_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + experiment_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experimentids/{experimentId}/runs/{runId}/tags") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "runId": _SERIALIZER.url("run_id", run_id, 'str'), + "experimentId": _SERIALIZER.url("experiment_id", experiment_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + headers=_header_parameters, + **kwargs + ) + + +def build_modify_or_delete_tags_by_experiment_id_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + experiment_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experimentids/{experimentId}/runs/{runId}/tags") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "runId": _SERIALIZER.url("run_id", run_id, 'str'), + "experimentId": _SERIALIZER.url("experiment_id", experiment_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + headers=_header_parameters, + **kwargs + ) + + +def build_delete_tags_by_experiment_name_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + experiment_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experiments/{experimentName}/runs/{runId}/tags") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "runId": _SERIALIZER.url("run_id", run_id, 'str'), + "experimentName": _SERIALIZER.url("experiment_name", experiment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + headers=_header_parameters, + **kwargs + ) + + +def build_modify_or_delete_tags_by_experiment_name_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + experiment_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experiments/{experimentName}/runs/{runId}/tags") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "runId": _SERIALIZER.url("run_id", run_id, 'str'), + "experimentName": _SERIALIZER.url("experiment_name", experiment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + headers=_header_parameters, + **kwargs + ) + + +def build_delete_tags_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/runs/{runId}/tags") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "runId": _SERIALIZER.url("run_id", run_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + headers=_header_parameters, + **kwargs + ) + + +def build_delete_run_services_by_experiment_id_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + experiment_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experimentids/{experimentId}/runs/{runId}/services") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "runId": _SERIALIZER.url("run_id", run_id, 'str'), + "experimentId": _SERIALIZER.url("experiment_id", experiment_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + headers=_header_parameters, + **kwargs + ) + + +def build_delete_run_services_by_experiment_name_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + experiment_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experiments/{experimentName}/runs/{runId}/services") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "runId": _SERIALIZER.url("run_id", run_id, 'str'), + "experimentName": _SERIALIZER.url("experiment_name", experiment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + headers=_header_parameters, + **kwargs + ) + + +def build_delete_run_services_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/runs/{runId}/services") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "runId": _SERIALIZER.url("run_id", run_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + headers=_header_parameters, + **kwargs + ) + + +def build_add_or_modify_run_service_instances_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + node_id, # type: int + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/runs/{runId}/serviceinstances/{nodeId}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "runId": _SERIALIZER.url("run_id", run_id, 'str'), + "nodeId": _SERIALIZER.url("node_id", node_id, 'int'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + headers=_header_parameters, + **kwargs + ) + + +def build_get_run_service_instances_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + node_id, # type: int + **kwargs # type: Any +): + # type: (...) -> HttpRequest + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/runs/{runId}/serviceinstances/{nodeId}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "runId": _SERIALIZER.url("run_id", run_id, 'str'), + "nodeId": _SERIALIZER.url("node_id", node_id, 'int'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + headers=_header_parameters, + **kwargs + ) + + +def build_get_by_query_by_experiment_name_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + experiment_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experiments/{experimentName}/runs:query") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "experimentName": _SERIALIZER.url("experiment_name", experiment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + headers=_header_parameters, + **kwargs + ) + + +def build_get_by_query_by_experiment_id_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + experiment_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experimentids/{experimentId}/runs:query") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "experimentId": _SERIALIZER.url("experiment_id", experiment_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + headers=_header_parameters, + **kwargs + ) + + +def build_get_by_ids_by_experiment_id_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + experiment_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experimentids/{experimentId}/runs/runIds") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "experimentId": _SERIALIZER.url("experiment_id", experiment_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + headers=_header_parameters, + **kwargs + ) + + +def build_get_by_ids_by_experiment_name_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + experiment_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experiments/{experimentName}/runs/runIds") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "experimentName": _SERIALIZER.url("experiment_name", experiment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + headers=_header_parameters, + **kwargs + ) + + +def build_cancel_run_with_uri_by_experiment_id_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + experiment_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + cancelation_reason = kwargs.pop('cancelation_reason', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experimentids/{experimentId}/runs/{runId}/cancel") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "runId": _SERIALIZER.url("run_id", run_id, 'str'), + "experimentId": _SERIALIZER.url("experiment_id", experiment_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if cancelation_reason is not None: + _query_parameters['CancelationReason'] = _SERIALIZER.query("cancelation_reason", cancelation_reason, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_cancel_run_with_uri_by_experiment_name_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + experiment_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + cancelation_reason = kwargs.pop('cancelation_reason', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experiments/{experimentName}/runs/{runId}/cancel") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "runId": _SERIALIZER.url("run_id", run_id, 'str'), + "experimentName": _SERIALIZER.url("experiment_name", experiment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if cancelation_reason is not None: + _query_parameters['CancelationReason'] = _SERIALIZER.query("cancelation_reason", cancelation_reason, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +# fmt: on +class RunsOperations(object): # pylint: disable=too-many-public-methods + """RunsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.machinelearningservices.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def get_child_by_experiment_name( + self, + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + experiment_name, # type: str + filter=None, # type: Optional[str] + continuationtoken=None, # type: Optional[str] + orderby=None, # type: Optional[List[str]] + sortorder=None, # type: Optional[Union[str, "_models.SortOrderDirection"]] + top=None, # type: Optional[int] + count=None, # type: Optional[bool] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.PaginatedRunList"] + """get_child_by_experiment_name. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param run_id: + :type run_id: str + :param experiment_name: + :type experiment_name: str + :param filter: Allows for filtering the collection of resources. + The expression specified is evaluated for each resource in the collection, and only items + where the expression evaluates to true are included in the response. + :type filter: str + :param continuationtoken: The continuation token to use for getting the next set of resources. + :type continuationtoken: str + :param orderby: The list of resource properties to use for sorting the requested resources. + :type orderby: list[str] + :param sortorder: The sort order of the returned resources. Not used, specify asc or desc after + each property name in the OrderBy parameter. + :type sortorder: str or ~azure.mgmt.machinelearningservices.models.SortOrderDirection + :param top: The maximum number of items in the resource collection to be included in the + result. + If not specified, all items are returned. + :type top: int + :param count: Whether to include a count of the matching resources along with the resources + returned in the response. + :type count: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PaginatedRunList or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.PaginatedRunList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PaginatedRunList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_get_child_by_experiment_name_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + run_id=run_id, + experiment_name=experiment_name, + filter=filter, + continuationtoken=continuationtoken, + orderby=orderby, + sortorder=sortorder, + top=top, + count=count, + template_url=self.get_child_by_experiment_name.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_get_child_by_experiment_name_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + run_id=run_id, + experiment_name=experiment_name, + filter=filter, + continuationtoken=continuationtoken, + orderby=orderby, + sortorder=sortorder, + top=top, + count=count, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PaginatedRunList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + get_child_by_experiment_name.metadata = {'url': "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experiments/{experimentName}/runs/{runId}/children"} # type: ignore + + @distributed_trace + def get_child_by_experiment_id( + self, + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + experiment_id, # type: str + filter=None, # type: Optional[str] + continuationtoken=None, # type: Optional[str] + orderby=None, # type: Optional[List[str]] + sortorder=None, # type: Optional[Union[str, "_models.SortOrderDirection"]] + top=None, # type: Optional[int] + count=None, # type: Optional[bool] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.PaginatedRunList"] + """get_child_by_experiment_id. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param run_id: + :type run_id: str + :param experiment_id: + :type experiment_id: str + :param filter: Allows for filtering the collection of resources. + The expression specified is evaluated for each resource in the collection, and only items + where the expression evaluates to true are included in the response. + :type filter: str + :param continuationtoken: The continuation token to use for getting the next set of resources. + :type continuationtoken: str + :param orderby: The list of resource properties to use for sorting the requested resources. + :type orderby: list[str] + :param sortorder: The sort order of the returned resources. Not used, specify asc or desc after + each property name in the OrderBy parameter. + :type sortorder: str or ~azure.mgmt.machinelearningservices.models.SortOrderDirection + :param top: The maximum number of items in the resource collection to be included in the + result. + If not specified, all items are returned. + :type top: int + :param count: Whether to include a count of the matching resources along with the resources + returned in the response. + :type count: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PaginatedRunList or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.PaginatedRunList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PaginatedRunList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_get_child_by_experiment_id_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + run_id=run_id, + experiment_id=experiment_id, + filter=filter, + continuationtoken=continuationtoken, + orderby=orderby, + sortorder=sortorder, + top=top, + count=count, + template_url=self.get_child_by_experiment_id.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_get_child_by_experiment_id_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + run_id=run_id, + experiment_id=experiment_id, + filter=filter, + continuationtoken=continuationtoken, + orderby=orderby, + sortorder=sortorder, + top=top, + count=count, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PaginatedRunList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + get_child_by_experiment_id.metadata = {'url': "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experimentids/{experimentId}/runs/{runId}/children"} # type: ignore + + @distributed_trace + def get_child( + self, + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + filter=None, # type: Optional[str] + continuationtoken=None, # type: Optional[str] + orderby=None, # type: Optional[List[str]] + sortorder=None, # type: Optional[Union[str, "_models.SortOrderDirection"]] + top=None, # type: Optional[int] + count=None, # type: Optional[bool] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.PaginatedRunList"] + """get_child. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param run_id: + :type run_id: str + :param filter: Allows for filtering the collection of resources. + The expression specified is evaluated for each resource in the collection, and only items + where the expression evaluates to true are included in the response. + :type filter: str + :param continuationtoken: The continuation token to use for getting the next set of resources. + :type continuationtoken: str + :param orderby: The list of resource properties to use for sorting the requested resources. + :type orderby: list[str] + :param sortorder: The sort order of the returned resources. Not used, specify asc or desc after + each property name in the OrderBy parameter. + :type sortorder: str or ~azure.mgmt.machinelearningservices.models.SortOrderDirection + :param top: The maximum number of items in the resource collection to be included in the + result. + If not specified, all items are returned. + :type top: int + :param count: Whether to include a count of the matching resources along with the resources + returned in the response. + :type count: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PaginatedRunList or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.PaginatedRunList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PaginatedRunList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_get_child_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + run_id=run_id, + filter=filter, + continuationtoken=continuationtoken, + orderby=orderby, + sortorder=sortorder, + top=top, + count=count, + template_url=self.get_child.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_get_child_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + run_id=run_id, + filter=filter, + continuationtoken=continuationtoken, + orderby=orderby, + sortorder=sortorder, + top=top, + count=count, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PaginatedRunList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + get_child.metadata = {'url': "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/runs/{runId}/children"} # type: ignore + + @distributed_trace + def get_details_by_experiment_id( + self, + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + experiment_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.RunDetails" + """get_details_by_experiment_id. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param run_id: + :type run_id: str + :param experiment_id: + :type experiment_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RunDetails, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.RunDetails + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RunDetails"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_details_by_experiment_id_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + run_id=run_id, + experiment_id=experiment_id, + template_url=self.get_details_by_experiment_id.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RunDetails', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_details_by_experiment_id.metadata = {'url': "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experimentids/{experimentId}/runs/{runId}/details"} # type: ignore + + + @distributed_trace + def get_details_by_experiment_name( + self, + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + experiment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.RunDetails" + """get_details_by_experiment_name. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param run_id: + :type run_id: str + :param experiment_name: + :type experiment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RunDetails, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.RunDetails + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RunDetails"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_details_by_experiment_name_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + run_id=run_id, + experiment_name=experiment_name, + template_url=self.get_details_by_experiment_name.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RunDetails', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_details_by_experiment_name.metadata = {'url': "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experiments/{experimentName}/runs/{runId}/details"} # type: ignore + + + @distributed_trace + def get_details( + self, + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.RunDetails" + """get_details. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param run_id: + :type run_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RunDetails, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.RunDetails + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RunDetails"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_details_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + run_id=run_id, + template_url=self.get_details.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RunDetails', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_details.metadata = {'url': "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/runs/{runId}/details"} # type: ignore + + + @distributed_trace + def get_run_data( + self, + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + body=None, # type: Optional["_models.GetRunDataRequest"] + **kwargs # type: Any + ): + # type: (...) -> "_models.GetRunDataResult" + """get_run_data. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param body: + :type body: ~azure.mgmt.machinelearningservices.models.GetRunDataRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GetRunDataResult, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.GetRunDataResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GetRunDataResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if body is not None: + _json = self._serialize.body(body, 'GetRunDataRequest') + else: + _json = None + + request = build_get_run_data_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + content_type=content_type, + json=_json, + template_url=self.get_run_data.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('GetRunDataResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_run_data.metadata = {'url': "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/rundata"} # type: ignore + + + @distributed_trace + def batch_get_run_data( + self, + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + body=None, # type: Optional["_models.BatchRequest1"] + **kwargs # type: Any + ): + # type: (...) -> "_models.BatchResult1" + """batch_get_run_data. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param body: + :type body: ~azure.mgmt.machinelearningservices.models.BatchRequest1 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BatchResult1, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.BatchResult1 + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BatchResult1"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if body is not None: + _json = self._serialize.body(body, 'BatchRequest1') + else: + _json = None + + request = build_batch_get_run_data_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + content_type=content_type, + json=_json, + template_url=self.batch_get_run_data.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 207]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('BatchResult1', pipeline_response) + + if response.status_code == 207: + deserialized = self._deserialize('BatchResult1', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + batch_get_run_data.metadata = {'url': "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/batchrundata"} # type: ignore + + + @distributed_trace + def batch_add_or_modify_by_experiment_id( + self, + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + experiment_id, # type: str + body=None, # type: Optional["_models.BatchAddOrModifyRunRequest"] + **kwargs # type: Any + ): + # type: (...) -> "_models.BatchRunResult" + """batch_add_or_modify_by_experiment_id. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param experiment_id: + :type experiment_id: str + :param body: + :type body: ~azure.mgmt.machinelearningservices.models.BatchAddOrModifyRunRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BatchRunResult, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.BatchRunResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BatchRunResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if body is not None: + _json = self._serialize.body(body, 'BatchAddOrModifyRunRequest') + else: + _json = None + + request = build_batch_add_or_modify_by_experiment_id_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + experiment_id=experiment_id, + content_type=content_type, + json=_json, + template_url=self.batch_add_or_modify_by_experiment_id.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('BatchRunResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + batch_add_or_modify_by_experiment_id.metadata = {'url': "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experimentids/{experimentId}/batch/runs"} # type: ignore + + + @distributed_trace + def batch_add_or_modify_by_experiment_name( + self, + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + experiment_name, # type: str + body=None, # type: Optional["_models.BatchAddOrModifyRunRequest"] + **kwargs # type: Any + ): + # type: (...) -> "_models.BatchRunResult" + """batch_add_or_modify_by_experiment_name. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param experiment_name: + :type experiment_name: str + :param body: + :type body: ~azure.mgmt.machinelearningservices.models.BatchAddOrModifyRunRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BatchRunResult, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.BatchRunResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BatchRunResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if body is not None: + _json = self._serialize.body(body, 'BatchAddOrModifyRunRequest') + else: + _json = None + + request = build_batch_add_or_modify_by_experiment_name_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + experiment_name=experiment_name, + content_type=content_type, + json=_json, + template_url=self.batch_add_or_modify_by_experiment_name.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('BatchRunResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + batch_add_or_modify_by_experiment_name.metadata = {'url': "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experiments/{experimentName}/batch/runs"} # type: ignore + + + @distributed_trace + def add_or_modify_by_experiment_name( + self, + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + experiment_name, # type: str + body=None, # type: Optional["_models.CreateRun"] + **kwargs # type: Any + ): + # type: (...) -> "_models.Run" + """add_or_modify_by_experiment_name. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param run_id: + :type run_id: str + :param experiment_name: + :type experiment_name: str + :param body: + :type body: ~azure.mgmt.machinelearningservices.models.CreateRun + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Run, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.Run + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Run"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if body is not None: + _json = self._serialize.body(body, 'CreateRun') + else: + _json = None + + request = build_add_or_modify_by_experiment_name_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + run_id=run_id, + experiment_name=experiment_name, + content_type=content_type, + json=_json, + template_url=self.add_or_modify_by_experiment_name.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Run', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + add_or_modify_by_experiment_name.metadata = {'url': "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experiments/{experimentName}/runs/{runId}"} # type: ignore + + + @distributed_trace + def get_by_experiment_name( + self, + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + experiment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.Run" + """get_by_experiment_name. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param run_id: + :type run_id: str + :param experiment_name: + :type experiment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Run, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.Run + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Run"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_by_experiment_name_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + run_id=run_id, + experiment_name=experiment_name, + template_url=self.get_by_experiment_name.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Run', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_by_experiment_name.metadata = {'url': "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experiments/{experimentName}/runs/{runId}"} # type: ignore + + + @distributed_trace + def add_or_modify_by_experiment_id( + self, + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + experiment_id, # type: str + body=None, # type: Optional["_models.CreateRun"] + **kwargs # type: Any + ): + # type: (...) -> "_models.Run" + """add_or_modify_by_experiment_id. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param run_id: + :type run_id: str + :param experiment_id: + :type experiment_id: str + :param body: + :type body: ~azure.mgmt.machinelearningservices.models.CreateRun + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Run, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.Run + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Run"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if body is not None: + _json = self._serialize.body(body, 'CreateRun') + else: + _json = None + + request = build_add_or_modify_by_experiment_id_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + run_id=run_id, + experiment_id=experiment_id, + content_type=content_type, + json=_json, + template_url=self.add_or_modify_by_experiment_id.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Run', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + add_or_modify_by_experiment_id.metadata = {'url': "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experimentids/{experimentId}/runs/{runId}"} # type: ignore + + + @distributed_trace + def get_by_experiment_id( + self, + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + experiment_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.Run" + """get_by_experiment_id. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param run_id: + :type run_id: str + :param experiment_id: + :type experiment_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Run, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.Run + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Run"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_by_experiment_id_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + run_id=run_id, + experiment_id=experiment_id, + template_url=self.get_by_experiment_id.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Run', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_by_experiment_id.metadata = {'url': "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experimentids/{experimentId}/runs/{runId}"} # type: ignore + + + @distributed_trace + def add_or_modify_experiment( + self, + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + body=None, # type: Optional["_models.CreateRun"] + **kwargs # type: Any + ): + # type: (...) -> "_models.Run" + """add_or_modify_experiment. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param run_id: + :type run_id: str + :param body: + :type body: ~azure.mgmt.machinelearningservices.models.CreateRun + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Run, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.Run + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Run"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if body is not None: + _json = self._serialize.body(body, 'CreateRun') + else: + _json = None + + request = build_add_or_modify_experiment_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + run_id=run_id, + content_type=content_type, + json=_json, + template_url=self.add_or_modify_experiment.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Run', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + add_or_modify_experiment.metadata = {'url': "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/runs/{runId}"} # type: ignore + + + @distributed_trace + def add( + self, + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + body=None, # type: Optional["_models.CreateRun"] + **kwargs # type: Any + ): + # type: (...) -> "_models.Run" + """add. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param run_id: + :type run_id: str + :param body: + :type body: ~azure.mgmt.machinelearningservices.models.CreateRun + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Run, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.Run + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Run"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if body is not None: + _json = self._serialize.body(body, 'CreateRun') + else: + _json = None + + request = build_add_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + run_id=run_id, + content_type=content_type, + json=_json, + template_url=self.add.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Run', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + add.metadata = {'url': "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/runs/{runId}"} # type: ignore + + + @distributed_trace + def get( + self, + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.Run" + """get. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param run_id: + :type run_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Run, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.Run + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Run"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + run_id=run_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Run', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/runs/{runId}"} # type: ignore + + + @distributed_trace + def delete_tags_by_experiment_id( + self, + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + experiment_id, # type: str + body=None, # type: Optional[List[str]] + **kwargs # type: Any + ): + # type: (...) -> "_models.Run" + """delete_tags_by_experiment_id. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param run_id: + :type run_id: str + :param experiment_id: + :type experiment_id: str + :param body: + :type body: list[str] + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Run, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.Run + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Run"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if body is not None: + _json = self._serialize.body(body, '[str]') + else: + _json = None + + request = build_delete_tags_by_experiment_id_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + run_id=run_id, + experiment_id=experiment_id, + content_type=content_type, + json=_json, + template_url=self.delete_tags_by_experiment_id.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Run', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + delete_tags_by_experiment_id.metadata = {'url': "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experimentids/{experimentId}/runs/{runId}/tags"} # type: ignore + + + @distributed_trace + def modify_or_delete_tags_by_experiment_id( + self, + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + experiment_id, # type: str + body=None, # type: Optional["_models.DeleteOrModifyTags"] + **kwargs # type: Any + ): + # type: (...) -> "_models.Run" + """modify_or_delete_tags_by_experiment_id. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param run_id: + :type run_id: str + :param experiment_id: + :type experiment_id: str + :param body: + :type body: ~azure.mgmt.machinelearningservices.models.DeleteOrModifyTags + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Run, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.Run + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Run"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if body is not None: + _json = self._serialize.body(body, 'DeleteOrModifyTags') + else: + _json = None + + request = build_modify_or_delete_tags_by_experiment_id_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + run_id=run_id, + experiment_id=experiment_id, + content_type=content_type, + json=_json, + template_url=self.modify_or_delete_tags_by_experiment_id.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Run', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + modify_or_delete_tags_by_experiment_id.metadata = {'url': "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experimentids/{experimentId}/runs/{runId}/tags"} # type: ignore + + + @distributed_trace + def delete_tags_by_experiment_name( + self, + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + experiment_name, # type: str + body=None, # type: Optional[List[str]] + **kwargs # type: Any + ): + # type: (...) -> "_models.Run" + """delete_tags_by_experiment_name. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param run_id: + :type run_id: str + :param experiment_name: + :type experiment_name: str + :param body: + :type body: list[str] + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Run, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.Run + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Run"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if body is not None: + _json = self._serialize.body(body, '[str]') + else: + _json = None + + request = build_delete_tags_by_experiment_name_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + run_id=run_id, + experiment_name=experiment_name, + content_type=content_type, + json=_json, + template_url=self.delete_tags_by_experiment_name.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Run', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + delete_tags_by_experiment_name.metadata = {'url': "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experiments/{experimentName}/runs/{runId}/tags"} # type: ignore + + + @distributed_trace + def modify_or_delete_tags_by_experiment_name( + self, + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + experiment_name, # type: str + body=None, # type: Optional["_models.DeleteOrModifyTags"] + **kwargs # type: Any + ): + # type: (...) -> "_models.Run" + """modify_or_delete_tags_by_experiment_name. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param run_id: + :type run_id: str + :param experiment_name: + :type experiment_name: str + :param body: + :type body: ~azure.mgmt.machinelearningservices.models.DeleteOrModifyTags + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Run, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.Run + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Run"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if body is not None: + _json = self._serialize.body(body, 'DeleteOrModifyTags') + else: + _json = None + + request = build_modify_or_delete_tags_by_experiment_name_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + run_id=run_id, + experiment_name=experiment_name, + content_type=content_type, + json=_json, + template_url=self.modify_or_delete_tags_by_experiment_name.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Run', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + modify_or_delete_tags_by_experiment_name.metadata = {'url': "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experiments/{experimentName}/runs/{runId}/tags"} # type: ignore + + + @distributed_trace + def delete_tags( + self, + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + body=None, # type: Optional[List[str]] + **kwargs # type: Any + ): + # type: (...) -> "_models.Run" + """delete_tags. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param run_id: + :type run_id: str + :param body: + :type body: list[str] + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Run, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.Run + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Run"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if body is not None: + _json = self._serialize.body(body, '[str]') + else: + _json = None + + request = build_delete_tags_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + run_id=run_id, + content_type=content_type, + json=_json, + template_url=self.delete_tags.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Run', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + delete_tags.metadata = {'url': "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/runs/{runId}/tags"} # type: ignore + + + @distributed_trace + def delete_run_services_by_experiment_id( + self, + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + experiment_id, # type: str + body=None, # type: Optional["_models.DeleteRunServices"] + **kwargs # type: Any + ): + # type: (...) -> "_models.Run" + """delete_run_services_by_experiment_id. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param run_id: + :type run_id: str + :param experiment_id: + :type experiment_id: str + :param body: + :type body: ~azure.mgmt.machinelearningservices.models.DeleteRunServices + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Run, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.Run + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Run"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if body is not None: + _json = self._serialize.body(body, 'DeleteRunServices') + else: + _json = None + + request = build_delete_run_services_by_experiment_id_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + run_id=run_id, + experiment_id=experiment_id, + content_type=content_type, + json=_json, + template_url=self.delete_run_services_by_experiment_id.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Run', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + delete_run_services_by_experiment_id.metadata = {'url': "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experimentids/{experimentId}/runs/{runId}/services"} # type: ignore + + + @distributed_trace + def delete_run_services_by_experiment_name( + self, + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + experiment_name, # type: str + body=None, # type: Optional["_models.DeleteRunServices"] + **kwargs # type: Any + ): + # type: (...) -> "_models.Run" + """delete_run_services_by_experiment_name. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param run_id: + :type run_id: str + :param experiment_name: + :type experiment_name: str + :param body: + :type body: ~azure.mgmt.machinelearningservices.models.DeleteRunServices + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Run, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.Run + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Run"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if body is not None: + _json = self._serialize.body(body, 'DeleteRunServices') + else: + _json = None + + request = build_delete_run_services_by_experiment_name_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + run_id=run_id, + experiment_name=experiment_name, + content_type=content_type, + json=_json, + template_url=self.delete_run_services_by_experiment_name.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Run', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + delete_run_services_by_experiment_name.metadata = {'url': "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experiments/{experimentName}/runs/{runId}/services"} # type: ignore + + + @distributed_trace + def delete_run_services( + self, + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + body=None, # type: Optional["_models.DeleteRunServices"] + **kwargs # type: Any + ): + # type: (...) -> "_models.Run" + """delete_run_services. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param run_id: + :type run_id: str + :param body: + :type body: ~azure.mgmt.machinelearningservices.models.DeleteRunServices + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Run, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.Run + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Run"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if body is not None: + _json = self._serialize.body(body, 'DeleteRunServices') + else: + _json = None + + request = build_delete_run_services_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + run_id=run_id, + content_type=content_type, + json=_json, + template_url=self.delete_run_services.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Run', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + delete_run_services.metadata = {'url': "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/runs/{runId}/services"} # type: ignore + + + @distributed_trace + def add_or_modify_run_service_instances( + self, + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + node_id, # type: int + body=None, # type: Optional["_models.AddOrModifyRunServiceInstancesRequest"] + **kwargs # type: Any + ): + # type: (...) -> "_models.RunServiceInstances" + """add_or_modify_run_service_instances. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param run_id: + :type run_id: str + :param node_id: + :type node_id: int + :param body: + :type body: ~azure.mgmt.machinelearningservices.models.AddOrModifyRunServiceInstancesRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RunServiceInstances, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.RunServiceInstances + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RunServiceInstances"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if body is not None: + _json = self._serialize.body(body, 'AddOrModifyRunServiceInstancesRequest') + else: + _json = None + + request = build_add_or_modify_run_service_instances_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + run_id=run_id, + node_id=node_id, + content_type=content_type, + json=_json, + template_url=self.add_or_modify_run_service_instances.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RunServiceInstances', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + add_or_modify_run_service_instances.metadata = {'url': "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/runs/{runId}/serviceinstances/{nodeId}"} # type: ignore + + + @distributed_trace + def get_run_service_instances( + self, + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + node_id, # type: int + **kwargs # type: Any + ): + # type: (...) -> "_models.RunServiceInstances" + """get_run_service_instances. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param run_id: + :type run_id: str + :param node_id: + :type node_id: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RunServiceInstances, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.RunServiceInstances + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RunServiceInstances"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_run_service_instances_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + run_id=run_id, + node_id=node_id, + template_url=self.get_run_service_instances.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RunServiceInstances', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_run_service_instances.metadata = {'url': "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/runs/{runId}/serviceinstances/{nodeId}"} # type: ignore + + + @distributed_trace + def get_by_query_by_experiment_name( + self, + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + experiment_name, # type: str + body=None, # type: Optional["_models.QueryParams"] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.PaginatedRunList"] + """get_by_query_by_experiment_name. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param experiment_name: + :type experiment_name: str + :param body: + :type body: ~azure.mgmt.machinelearningservices.models.QueryParams + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PaginatedRunList or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.PaginatedRunList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + cls = kwargs.pop('cls', None) # type: ClsType["_models.PaginatedRunList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + if body is not None: + _json = self._serialize.body(body, 'QueryParams') + else: + _json = None + + request = build_get_by_query_by_experiment_name_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + experiment_name=experiment_name, + content_type=content_type, + json=_json, + template_url=self.get_by_query_by_experiment_name.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + if body is not None: + _json = self._serialize.body(body, 'QueryParams') + else: + _json = None + + request = build_get_by_query_by_experiment_name_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + experiment_name=experiment_name, + content_type=content_type, + json=_json, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PaginatedRunList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + get_by_query_by_experiment_name.metadata = {'url': "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experiments/{experimentName}/runs:query"} # type: ignore + + @distributed_trace + def get_by_query_by_experiment_id( + self, + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + experiment_id, # type: str + body=None, # type: Optional["_models.QueryParams"] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.PaginatedRunList"] + """get_by_query_by_experiment_id. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param experiment_id: + :type experiment_id: str + :param body: + :type body: ~azure.mgmt.machinelearningservices.models.QueryParams + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PaginatedRunList or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.PaginatedRunList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + cls = kwargs.pop('cls', None) # type: ClsType["_models.PaginatedRunList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + if body is not None: + _json = self._serialize.body(body, 'QueryParams') + else: + _json = None + + request = build_get_by_query_by_experiment_id_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + experiment_id=experiment_id, + content_type=content_type, + json=_json, + template_url=self.get_by_query_by_experiment_id.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + if body is not None: + _json = self._serialize.body(body, 'QueryParams') + else: + _json = None + + request = build_get_by_query_by_experiment_id_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + experiment_id=experiment_id, + content_type=content_type, + json=_json, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PaginatedRunList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + get_by_query_by_experiment_id.metadata = {'url': "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experimentids/{experimentId}/runs:query"} # type: ignore + + @distributed_trace + def get_by_ids_by_experiment_id( + self, + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + experiment_id, # type: str + body=None, # type: Optional["_models.GetRunsByIds"] + **kwargs # type: Any + ): + # type: (...) -> "_models.BatchRunResult" + """get_by_ids_by_experiment_id. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param experiment_id: + :type experiment_id: str + :param body: + :type body: ~azure.mgmt.machinelearningservices.models.GetRunsByIds + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BatchRunResult, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.BatchRunResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BatchRunResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if body is not None: + _json = self._serialize.body(body, 'GetRunsByIds') + else: + _json = None + + request = build_get_by_ids_by_experiment_id_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + experiment_id=experiment_id, + content_type=content_type, + json=_json, + template_url=self.get_by_ids_by_experiment_id.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('BatchRunResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_by_ids_by_experiment_id.metadata = {'url': "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experimentids/{experimentId}/runs/runIds"} # type: ignore + + + @distributed_trace + def get_by_ids_by_experiment_name( + self, + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + experiment_name, # type: str + body=None, # type: Optional["_models.GetRunsByIds"] + **kwargs # type: Any + ): + # type: (...) -> "_models.BatchRunResult" + """get_by_ids_by_experiment_name. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param experiment_name: + :type experiment_name: str + :param body: + :type body: ~azure.mgmt.machinelearningservices.models.GetRunsByIds + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BatchRunResult, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.BatchRunResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BatchRunResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if body is not None: + _json = self._serialize.body(body, 'GetRunsByIds') + else: + _json = None + + request = build_get_by_ids_by_experiment_name_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + experiment_name=experiment_name, + content_type=content_type, + json=_json, + template_url=self.get_by_ids_by_experiment_name.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('BatchRunResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_by_ids_by_experiment_name.metadata = {'url': "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experiments/{experimentName}/runs/runIds"} # type: ignore + + + @distributed_trace + def cancel_run_with_uri_by_experiment_id( + self, + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + experiment_id, # type: str + cancelation_reason=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "_models.Run" + """cancel_run_with_uri_by_experiment_id. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param run_id: + :type run_id: str + :param experiment_id: + :type experiment_id: str + :param cancelation_reason: + :type cancelation_reason: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Run, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.Run + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Run"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_cancel_run_with_uri_by_experiment_id_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + run_id=run_id, + experiment_id=experiment_id, + cancelation_reason=cancelation_reason, + template_url=self.cancel_run_with_uri_by_experiment_id.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Run', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + cancel_run_with_uri_by_experiment_id.metadata = {'url': "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experimentids/{experimentId}/runs/{runId}/cancel"} # type: ignore + + + @distributed_trace + def cancel_run_with_uri_by_experiment_name( + self, + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + experiment_name, # type: str + cancelation_reason=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "_models.Run" + """cancel_run_with_uri_by_experiment_name. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param run_id: + :type run_id: str + :param experiment_name: + :type experiment_name: str + :param cancelation_reason: + :type cancelation_reason: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Run, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.Run + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Run"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_cancel_run_with_uri_by_experiment_name_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + run_id=run_id, + experiment_name=experiment_name, + cancelation_reason=cancelation_reason, + template_url=self.cancel_run_with_uri_by_experiment_name.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Run', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + cancel_run_with_uri_by_experiment_name.metadata = {'url': "/history/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/experiments/{experimentName}/runs/{runId}/cancel"} # type: ignore + diff --git a/.venv/lib/python3.12/site-packages/azure/ai/ml/_restclient/runhistory/operations/_spans_operations.py b/.venv/lib/python3.12/site-packages/azure/ai/ml/_restclient/runhistory/operations/_spans_operations.py new file mode 100644 index 00000000..7245f5ed --- /dev/null +++ b/.venv/lib/python3.12/site-packages/azure/ai/ml/_restclient/runhistory/operations/_spans_operations.py @@ -0,0 +1,429 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_post_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/history/v1.0/private/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/runs/{runId}/spans") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "runId": _SERIALIZER.url("run_id", run_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + headers=_header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + continuation_token_parameter = kwargs.pop('continuation_token_parameter', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/history/v1.0/private/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/runs/{runId}/spans") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "runId": _SERIALIZER.url("run_id", run_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if continuation_token_parameter is not None: + _query_parameters['continuationToken'] = _SERIALIZER.query("continuation_token_parameter", continuation_token_parameter, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_active_request( + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + continuation_token_parameter = kwargs.pop('continuation_token_parameter', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/history/v1.0/private/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/runs/{runId}/spans/active") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "runId": _SERIALIZER.url("run_id", run_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if continuation_token_parameter is not None: + _query_parameters['continuationToken'] = _SERIALIZER.query("continuation_token_parameter", continuation_token_parameter, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +# fmt: on +class SpansOperations(object): + """SpansOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.machinelearningservices.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def post( # pylint: disable=inconsistent-return-statements + self, + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + body=None, # type: Optional["_models.RunStatusSpans"] + **kwargs # type: Any + ): + # type: (...) -> None + """post. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param run_id: + :type run_id: str + :param body: + :type body: ~azure.mgmt.machinelearningservices.models.RunStatusSpans + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if body is not None: + _json = self._serialize.body(body, 'RunStatusSpans') + else: + _json = None + + request = build_post_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + run_id=run_id, + content_type=content_type, + json=_json, + template_url=self.post.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in []: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + post.metadata = {'url': "/history/v1.0/private/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/runs/{runId}/spans"} # type: ignore + + + @distributed_trace + def list( + self, + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + continuation_token_parameter=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.PaginatedSpanDefinition1List"] + """list. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param run_id: + :type run_id: str + :param continuation_token_parameter: + :type continuation_token_parameter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PaginatedSpanDefinition1List or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.PaginatedSpanDefinition1List] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PaginatedSpanDefinition1List"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + run_id=run_id, + continuation_token_parameter=continuation_token_parameter, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + run_id=run_id, + continuation_token_parameter=continuation_token_parameter, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PaginatedSpanDefinition1List", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/history/v1.0/private/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/runs/{runId}/spans"} # type: ignore + + @distributed_trace + def get_active( + self, + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + run_id, # type: str + continuation_token_parameter=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.PaginatedSpanDefinition1List"] + """get_active. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param run_id: + :type run_id: str + :param continuation_token_parameter: + :type continuation_token_parameter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PaginatedSpanDefinition1List or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.PaginatedSpanDefinition1List] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PaginatedSpanDefinition1List"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_get_active_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + run_id=run_id, + continuation_token_parameter=continuation_token_parameter, + template_url=self.get_active.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_get_active_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + run_id=run_id, + continuation_token_parameter=continuation_token_parameter, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PaginatedSpanDefinition1List", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + get_active.metadata = {'url': "/history/v1.0/private/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/runs/{runId}/spans/active"} # type: ignore |
