azure.ml.component package

Subpackages

Submodules

azure.ml.component.component module

azure.ml.component.environment module

Contracts for environment override.

class azure.ml.component.environment.Conda(*, pip_requirements_file: str | Path = None, conda_file: str | Path = None, **kwargs)

Bases: object

Conda environment settings for running a component.

Note

The following example shows how to create a conda environment settings using azure.ml.component.environment.Conda class:

# Create from pip requirements file
conda = Conda(pip_requirements_file="<path-to-pip-requirements-file>")
# Create from conda yaml file
conda = Conda(conda_file="<path-to-conda-file>")

For more details of working with conda, see environment in runsettings.

class azure.ml.component.environment.Docker(*, image: str = None, file: str | Path = None, **kwargs)

Bases: object

Docker environment settings for running a component.

Note

The following example shows how to create a docker environment settings using azure.ml.component.environment.Docker class:

# Create from image
docker = Docker(image="mcr.microsoft.com/azureml/openmpi3.1.2-ubuntu18.04")
# Create from dockerfile
docker = Docker(file="<path-to-dockerfile>")

For more details of working with docker, see environment in runsettings.

class azure.ml.component.environment.Environment(*, workspace: Workspace = None, name: str = None, version: str = None, conda_file: str | PathLike = None, file: str | PathLike = None, **kwargs)

Bases: object

Configure Python environment for running components.

An Environment defines Docker, Conda and OS settings. An Environment can be initialized from a curated AML environment (For more information about curated environments, see create and manage reusable environments), or a YAML file which defines environment setting by following environment specs.

Note

The following example shows how to create an environment using azure.ml.component.environment.Environment class:

# Create from a curated environment, suppose we have a workspace as 'ws'
env = Environment(workspace=ws, name="AzureML-Designer")
# Or use a curated environment with a specific version
env = Environment(workspace=ws, name="AzureML-Designer", version="19")

# Create from a YAML file, see below YAML as an example
env = Environment(file="<path-to-YAML-file>")
# Sample environment YAML
docker:
  image:  mcr.microsoft.com/azureml/openmpi3.1.2-ubuntu18.04
conda:
  conda_dependencies:
    name: project_environment
    channels:
    - defaults
    dependencies:
    - python=3.8.10
    - pip=20.0
    - pip:
      - azureml-defaults
      - azureml-dataprep>=1.6
os: Linux
# Create from an conda YAML file, see below YAML as an example
env = Environment(conda_file="<path-to-conda-YAML-file>")
# Sample conda YAML
name: project_environment
channels:
- defaults
dependencies:
- python=3.8.10
- pip=20.0
- pip:
  - azureml-defaults
  - azureml-dataprep>=1.6

Note

If you set some keys in [‘docker’, ‘conda’, ‘os’] and some in [‘name’, ‘version’] at the same time, keys in [‘docker’, ‘conda’, ‘os’] have higher priority.

For more samples of working with environments, see environment in runsettings.

azure.ml.component.pipeline module

azure.ml.component.run module

azure.ml.component.run_settings module

Defines classes for run settings.

class azure.ml.component.run_settings.PipelineRunSettings(display_section: _RunSettingsParamSection, store: _RunSettingsStore, workspace)

Bases: RunSettings

A RunSettings aggregates the run settings of a pipeline.

property continue_on_failed_optional_input

Pipeline level continue run on failed optional input. The default value is true.

property continue_on_step_failure

Whether continue pipeline run when a step run fail.

property default_compute

Pipeline level default compute.

property default_datastore

Pipeline level default datastore.

property force_rerun

Whether enforce to rerun the pipeline.

property priority: PipelineRunSettingsPriority

Pipeline level default job’s priority in Cosmos or compute cluster.

property timeout_seconds

Pipeline level time out in seconds.

class azure.ml.component.run_settings.PipelineRunSettingsPriority(priority_section, workspace)

Bases: object

For strong type intellisense of ‘runsettings.priority.scope’.

property compute_cluster

Pipeline level default job’s priority in compute cluster.

When not specified, system default value will be used.

property scope

Pipeline level default Scope job’s priority in Cosmos.

When not specified, system default value (1000) will be used.

class azure.ml.component.run_settings.RunSettings(display_section: _RunSettingsParamSection, store: _RunSettingsStore, workspace)

Bases: WorkspaceTelemetryMixin

A RunSettings aggregates the run settings of a component.

configure(*args, **kwargs)

Configure the runsettings.

Note that this method will be replaced by a dynamic generated one at runtime with parameters that corresponds to the runsettings of the component.

get_runsettings_for_submit()

Generate pipeline runsetting data and pass it to the backend.

validate(raise_error=False, process_error=None, for_definition_validate=False, definition_validator=None, component_type=None)

Validate RunSettings parameter values for current component.

Parameters:
  • raise_error (bool) – Whether to raise exceptions on error.

  • process_error (function) – The error process function to be used.

  • for_definition_validate (bool) – If the validate is for pipeline definition validate.

  • definition_validator (azure.ml.component._component_validator.DefinitionValidator) – definition validator

  • component_type (str) – indicate current node type.

Returns:

The errors found during validation.

Return type:

builtin.list

class azure.ml.component.run_settings.SubPipelineRunSettings(display_section: _RunSettingsParamSection, store: _RunSettingsStore, workspace)

Bases: WorkspaceTelemetryMixin

A RunSettings aggregates the run settings of a sub pipeline.

configure(*args, **kwargs)

Do nothing, just for compatibility with runsetting functions.

validate(raise_error=False, process_error=None, for_definition_validate=False, definition_validator=None, component_type=None)

Do nothing, just for compatibility with runsetting functions.