I am using Azure CLI as follows to create an ML environment:
az ml environment create --name $(AML_ENVIRONMENT_NAME) --version $(AML_ENVIRONMENT_VERSION) --resource-group $(RESOURCE_GROUP) --workspace-name $(WORKSPACE_NAME) --image $(AML_ENVIRONMENT_BASE_IMAGE) --conda-file $(AML_ENVIRONMENT_CONDA_SPEC)
This works fine, except two problems:
If conda specification is not changed from the previous one, the image ("environment") is not built. The new environment is yet visible in ML Studio "Environments" view, but it says "Not built".
Even when the image is built, the Environment class seems not to use it, but a new build is started. The code that I use to get the environment is as follows:
from azureml.core import Experiment
env = Environment.get(ws, name=env_name, version=env_version)
So, this call does give me the env, but makes it by triggering a new build with a version name like "Autosave_2022-xx-xxT...". Then it takes half an hour or so to create that new image. Why it cannot just use the image that is already built? If I print the env
it prints the wanted env name and version (e.g. 3), but when I look at the pipeline job, the actual environment version is that "Autosave..." one.
This "Autosave"-strangeness started to happen when I started to create environment with Azure CLI. Before that, I created the environment with Environment.from_docker_image()
call and never had this problem.
See the screenshots below.