azure_ml_sdk.utils.asset_manager

Classes

AssetManager

Manage Azure Machine Learning assets for experiments.

Module Contents

class azure_ml_sdk.utils.asset_manager.AssetManager(ml_client: azure.ai.ml.MLClient, config_dir: str)

Manage Azure Machine Learning assets for experiments.

ml_client
config_dir
asset_manager_map
_check_existing_asset(asset_type: str, name: str, version: str | None = 'latest')

Check if an asset exists in the workspace.

Parameters:
  • asset_type (str) – The type of the asset.

  • name (str) – The name of the asset.

  • version (str, optional) – The version of the asset. Defaults to “latest”.

Raises:

ValueError – If the asset or version does not exist.

_build_environment_from_config(name: str)

Build an environment from a config file.

Parameters:

name (str) – The name of the environment.

_build_compute_from_config(name: str)

Build a compute from a configuration file.

Parameters:

name (str) – The name of the compute.

check_environment(name: str, version: str = 'latest', build: bool = False)

Check an existing environment in the workspace or build a new one from a config.

Parameters:
  • name (str) – The name of the environment.

  • version (str, optional) – The version of the environment. Defaults to ‘latest’.

  • build (bool, optional) – If true, builds a new environment using a configuration file. Defaults to False.

Raises:

ValueError – If the specified environment or version does not exist.

check_compute(name: str, build: bool = False)

Check an existing compute in the workspace or build a new one from a config.

Parameters:
  • name (str) – The name of the compute

  • build (bool, optional) – If true, build a new compute using a configuration file. Defaults to False.

Raises:

ValueError – If the specified compute does not exist.

check_model(name: str, version: str = 'latest')

Check an existing model in the workspace.

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

  • version (str) – The version of the model. Defaults to ‘latest’.

Raises:

ValueError – If the specified model or version does not exist.

check_dataset(name: str, version: str = 'latest')

Check an existing dataset in the workspace.

Parameters:
  • name (str) – The name of the dataset.

  • version (str, optional) – The version of the model. Defaults to ‘latest’.

Raises:

ValueError – If the specified dataset or version does not exist.

validate_assets(assets_dict: dict, build_env: bool, build_compute: bool)

Validate a list of assets. Build new ones from config if demanded.

Parameters:
  • assets_dict (dict) – The dictionary of assets.

  • build_env (bool) – If True, build environments from config file.

  • build_compute (bool) – If True, build computes from config file.