Image class

Definition

Abstract parent class for Azure Machine Learning Images.

Image(workspace, name=None, id=None, tags=None, properties=None, version=None)
Inheritance
builtins.object
Image

Parameters

workspace
Workspace

The Workspace object containing the Image to retrieve.

name
str

The name of the Image to retrieve. Will return the latest version of the Image, if it exists.

id
str

The specific ID of the Image to retrieve. (ID is ":")

tags
<xref:azureml.core.image.Image.list>

Will filter Image results based on the provided list, by either 'key' or '[key, value]'. Ex. ['key', ['key2', 'key2 value']]

properties
<xref:azureml.core.image.Image.list>

Will filter Image results based on the provided list, by either 'key' or '[key, value]'. Ex. ['key', ['key2', 'key2 value']]

version
str

When version and name are both specified, will return the specific version of the Image.

Remarks

The Image constructor retrieves a cloud representation of an Image object associated with the provided workspace. It returns an instance of a child class corresponding to the specific type of the retrieved Image object.

An Image object is used to deploy a user's Model as a Webservice. The Image object typically contains a Model, an execution script, and any dependencies needed for Model deployment. The Image class has multiple subclasses such as ContainerImage for Docker Images, as well as preview Images like FPGA.

See the ContainerImage class for an example of a class that inherits from the Image class: ContainerImage

See the following link for an overview on deploying models in Azure: https://aka.ms/azureml-how-deploy

Methods

add_properties(properties)

Add properties to the image.

add_tags(tags)

Add tags to the image.

create(workspace, name, models, image_config)

Create an image in the provided workspace.

delete()

Delete an image from it's corresponding workspace.

deserialize(workspace, image_payload)

Convert a json object into a Image object.

..remarks:


   Will fail if the provided workspace is not the workspace
   the image is registered under.
image_configuration()

Abstract method for creating an image configuration object.

list(workspace, image_name=None, model_name=None, model_id=None, tags=None, properties=None)

List the Images associated with the corresponding Workspace. Can be filtered with specific parameters.

remove_tags(tags)

Remove tags from the image.

serialize()

Convert this Image into a json serialized dictionary.

update(tags)

Update the image.

update_creation_state()

Refresh the current state of the in-memory object.

Perform an in-place update of the properties of the object based on the current state of the corresponding cloud object. Primarily useful for manual polling of creation state.

wait_for_creation(show_output=False)

Wait for the image to finish creating.

Wait for image creation to reach a terminal state. Will throw a WebserviceException if it reaches a non-successful terminal state.

add_properties(properties)

Add properties to the image.

add_properties(properties)

Parameters

properties
dict[str or str]

A dictionary of properties to add

add_tags(tags)

Add tags to the image.

add_tags(tags)

Parameters

tags
dict[str or str]

A dictionary of tags to add

create(workspace, name, models, image_config)

Create an image in the provided workspace.

create(workspace, name, models, image_config)

Parameters

workspace
workspace: azureml.core.workspace.Workspace

The workspace to associate with this image

name
str

The name to associate with this image

models
<xref:list[Model]>

A list of Model objects to package with this image. Can be an empty list

image_config
ImageConfig

The image config object to use to configure this image

Returns

The created Image object

Return type

delete()

Delete an image from it's corresponding workspace.

delete()

Remarks

Will fail if the image has been deployed to a still present webservice

deserialize(workspace, image_payload)

Convert a json object into a Image object.

..remarks:


   Will fail if the provided workspace is not the workspace
   the image is registered under.
deserialize(workspace, image_payload)

Parameters

cls
workspace
Workspace

The workspace object the Image is registered under

image_payload
dict

A json object to convert to a Image object

Returns

The Image representation of the provided json object

Return type

image_configuration()

Abstract method for creating an image configuration object.

image_configuration()

list(workspace, image_name=None, model_name=None, model_id=None, tags=None, properties=None)

List the Images associated with the corresponding Workspace. Can be filtered with specific parameters.

list(workspace, image_name=None, model_name=None, model_id=None, tags=None, properties=None)

Parameters

workspace
Workspace

The Workspace object to list the Images in.

image_name
str

Filter list to only include Images deployed with the specific image name

default value: None
model_name
str

Filter list to only include Images deployed with the specific model name

default value: None
model_id
str

Filter list to only include Images deployed with the specific model id

default value: None
tags
<xref:azureml.core.image.Image.list>

Will filter based on the provided list, by either 'key' or '[key, value]'. Ex. ['key', ['key2', 'key2 value']]

default value: None
properties
<xref:azureml.core.image.Image.list>

Will filter based on the provided list, by either 'key' or '[key, value]'. Ex. ['key', ['key2', 'key2 value']]

default value: None

Returns

A filtered list of Images in the provided Workspace

Return type

<xref:azureml.core.image.list[Images]>

remove_tags(tags)

Remove tags from the image.

remove_tags(tags)

Parameters

tags
<xref:azureml.core.image.list[str]>

A list of keys corresponding to tags to be removed

serialize()

Convert this Image into a json serialized dictionary.

serialize()

Returns

The json representation of this Image

Return type

update(tags)

Update the image.

update(tags)

Parameters

tags
dict[str or str]

A dictionary of tags to update the image with. Will overwrite any existing tags

update_creation_state()

Refresh the current state of the in-memory object.

Perform an in-place update of the properties of the object based on the current state of the corresponding cloud object. Primarily useful for manual polling of creation state.

update_creation_state()

wait_for_creation(show_output=False)

Wait for the image to finish creating.

Wait for image creation to reach a terminal state. Will throw a WebserviceException if it reaches a non-successful terminal state.

wait_for_creation(show_output=False)

Parameters

show_output
bool

Boolean option to print more verbose output

default value: False