azure_ml_sdk.services.deployment.endpoint

Classes

OnlineDeployment

Class for defining deployments to be used in online endpoints.

OnlineEndpoint

Class for creating or updating online endpoints on Azure Machine Learning.

OnlineEndpointManager

Class for managing online endpoints on Azure Machine Learning.

Module Contents

class azure_ml_sdk.services.deployment.endpoint.OnlineDeployment(ml_client: azure.ai.ml.MLClient, name: str, endpoint_name: str, config: dict | None = {})

Class for defining deployments to be used in online endpoints.

ml_client
name
endpoint_name
property status: str | None

Returns the provisioning state of an online deployment.

property id: str | None

Returns the id of the online deployment.

get() azure.ai.ml.entities.ManagedOnlineDeployment | None

Return the online deployment object.

Raises:

ValueError – If the online deployment is not found in the online endpoint.

Returns:

The online deployment object.

Return type:

Optional[ManagedOnlineDeployment]

get_logs(lines: int = 100) str

Retrieve the logs from the online deployment.

Parameters:

lines (int) – The maximum number of lines to tail. Defaults to 100 lines.

Returns:

the logs of the online deployment.

Return type:

str

set(model: str | None = None, environment: str | None = None, scoring_folder: str | None = None, scoring_script: str | None = None, instance_type: str | None = 'STANDARD_E4S_V3', instance_count: int | None = 1) None

Configure the online deployment.

Parameters:
  • model (str) – The name of the registered model in the workspace.

  • environment (str) – The name of the registered environment in the workspace.

  • scoring_folder (str) – The path to the folder containing the scoring script.

  • scoring_script (str) – The name of the scroring script (.py).

  • instance_type (str) – The name name of the compute instance.

  • instance_count (int) – The number of instances to deploy. Defaults to 1.

class azure_ml_sdk.services.deployment.endpoint.OnlineEndpoint(ml_client: azure.ai.ml.MLClient, name: str)

Class for creating or updating online endpoints on Azure Machine Learning.

ml_client
name
property status: str | None

Return the provisioning state of the online endpoint.

property scoring_uri: str | None

Return the scoring uri of the online endpoint.

property keys: str | None

Return the authentication key of the online endpoint.

property id: str | None

Return the id of the online endpoint.

get() azure.ai.ml.entities.ManagedOnlineEndpoint | None

_summary_.

Raises:

ResourceNotFoundError – _description_

Returns:

_description_

Return type:

Optional[ManagedOnlineEndpoint]

invoke(deployment_name: str, request_file: str) None

Invoke the online endpoint with a payload in a json request file.

Parameters:
  • deployment_name (str) – The name of the online deployment to invoke.

  • request_file (str) – The path to a json file containing the request.

list_deployments() List[str]

List all deployments of the online endpoint.

Returns:

List of the names of the deployments of the online endpoint.

Return type:

List[str]

get_deployment(deployment_name: str) OnlineDeployment | None

Get a deployment of the online endpoint.

Raises:

ValueError – If the deployment is not found in the online endpoint.

Parameters:

deployment_name (str) – The name of the deployment.

Returns:

The online deployment, if it exists.

Return type:

Optional[OnlineDeployment]

create_or_update_deployment(deployment_name: str, config: dict | None = {}) OnlineDeployment

Create a deployment in the online Endpoint.

Parameters:
  • deployment_name (str) – The name of the deployment to create or update.

  • config (dict) – The dictionary containing the deployment configuration.

Raises:

ResourceNotFoundError – if the endpoint is not found in the workspace.

delete_deployment(deployment_name: str) None

Delete a deployment from an online endpoint.

Parameters:

deployment_name (str) – The name of the deployment.

Raises:

ValueError – If the deployment is not found in the online endpoint.

class azure_ml_sdk.services.deployment.endpoint.OnlineEndpointManager(ml_client: azure.ai.ml.MLClient)

Class for managing online endpoints on Azure Machine Learning.

ml_client
list_endpoints() List[str]

List all online endpoints in the workspace.

Returns:

A list of the names of the endpoints of the workspace.

create_endpoint(endpoint_name: str, description: str, auth_mode: str = 'key') OnlineEndpoint

Create an online endpoint in the workspace.

Parameters:
  • endpoint_name (str) – name of the endpoint.

  • description (str) – description of the endpoint.

  • auth_mode (str) – Authentication mode. Possible values: ‘aml_token’, ‘key’. Defaults to ‘key’.

delete_endpoint(endpoint_name: str) None

Delete an online endpoint in the workspace.

Parameters:

endpoint_name (str) – name of the endpoint.

get_endpoint(endpoint_name: str) OnlineEndpoint

Get an online endpoint (if deployed).

Returns:

The online endpoint instance.

Return type:

OnlineEndpoint