ContainerImageConfig Class

Defines Image configuration settings specific to Container deployments - requires execution script and runtime.

In typical use cases, you will use the image_configuration method of the ContainerImage class to create a ContainerImageConfig object.

Initialize the config object.

Inheritance
ContainerImageConfig

Constructor

ContainerImageConfig(execution_script, runtime, conda_file=None, docker_file=None, schema_file=None, dependencies=None, enable_gpu=None, tags=None, properties=None, description=None, base_image=None, base_image_registry=None, allow_absolute_path=False, cuda_version=None)

Parameters

execution_script
str
Required

The path to local file that contains the code to run for the image.

runtime
str
Required

The runtime to use for the image. Current supported runtimes are 'spark-py' and 'python'.

conda_file
str
default value: None

The path to local file containing a conda environment definition to use for the image.

docker_file
str
default value: None

The path to local file containing additional Docker steps to run when setting up the image.

schema_file
str
default value: None

The path to local file containing a webservice schema to use when the image is deployed.

dependencies
list[str]
default value: None

A list of paths to additional files/folders that the image needs to run.

enable_gpu
bool
default value: None

Whether to enable GPU support in the image. The GPU image must be used on Microsoft Azure Services such as Azure Container Instances, Azure Machine Learning Compute, Azure Virtual Machines, and Azure Kubernetes Service. Defaults to False.

tags
dict[(str, str)]
default value: None

A dictionary of key value tags to give this image.

properties
dict[(str, str)]
default value: None

A dictionary of key value properties to give this image. These properties cannot be changed after deployment, however new key value pairs can be added.

description
str
default value: None

A description to give this image.

base_image
str
default value: None

A custom image to be used as base image. If no base image is given then the base image will be used based off of given runtime parameter.

base_image_registry
ContainerRegistry
default value: None

The image registry that contains the base image.

allow_absolute_path
bool
default value: False

Indicates whether to allow absolute path.

cuda_version
str
default value: None

The version of CUDA to install for images that need GPU support. The GPU image must be used on Microsoft Azure Services such as Azure Container Instances, Azure Machine Learning Compute, Azure Virtual Machines, and Azure Kubernetes Service. Supported versions are 9.0, 9.1, and 10.0. If 'enable_gpu' is set, this defaults to '9.1'.

execution_script
str
Required

Path to local file that contains the code to run for the image

runtime
str
Required

Which runtime to use for the image. Current supported runtimes are 'spark-py' and 'python'

conda_file
str
Required

Path to local file containing a conda environment definition to use for the image

docker_file
str
Required

Path to local file containing additional Docker steps to run when setting up the image

schema_file
str
Required

Path to local file containing a webservice schema to use when the image is deployed

dependencies
list[str]
Required

List of paths to additional files/folders that the image needs to run

enable_gpu
bool
Required

Whether or not to enable GPU support in the image. The GPU image must be used on Microsoft Azure Services such as Azure Container Instances, Azure Machine Learning Compute, Azure Virtual Machines, and Azure Kubernetes Service. Defaults to false.

tags
dict[str, str]
Required

Dictionary of key value tags to give this image

properties
dict[str, str]
Required

Dictionary of key value properties to give this image. These properties cannot be changed after deployment, however new key value pairs can be added

description
str
Required

A description to give this image

base_image
str
Required

A custom image to be used as base image. If no base image is given then the base image will be used based off of given runtime parameter.

base_image_registry
ContainerRegistry
Required

Image registry that contains the base image.

allow_absolute_path
bool
Required

Flag to allow the absolute path

cuda_version
str
Required

Version of CUDA to install for images that need GPU support. The GPU image must be used on Microsoft Azure Services such as Azure Container Instances, Azure Machine Learning Compute, Azure Virtual Machines, and Azure Kubernetes Service. Supported versions are 9.0, 9.1, and 10.0. If 'enable_gpu' is set, this defaults to '9.1'.

Methods

build_create_payload

Build the creation payload for the Container image.

create_local_debug_payload

Build the creation payload for the Container image.

validate_configuration

Check that the specified configuration values are valid.

Raises a :class:azureml.exceptions.WebserviceException` if validation fails.

build_create_payload

Build the creation payload for the Container image.

build_create_payload(workspace, name, model_ids)

Parameters

workspace
Workspace
Required

The workspace object to create the image in.

name
str
Required

The name of the image.

model_ids
list[str]
Required

A list of model IDs to package into the image.

Returns

Container image creation payload.

Return type

Exceptions

create_local_debug_payload

Build the creation payload for the Container image.

create_local_debug_payload(workspace, model_ids)

Parameters

workspace
Workspace
Required

The workspace object to create the image in.

model_ids
list[str]
Required

A list of model IDs to package into the image.

Returns

Container image creation payload.

Return type

Exceptions

validate_configuration

Check that the specified configuration values are valid.

Raises a :class:azureml.exceptions.WebserviceException` if validation fails.

validate_configuration()

Exceptions