Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to create updated version of component in Azure ML Registry #37464

Open
bastbu opened this issue Sep 19, 2024 · 1 comment
Open

Unable to create updated version of component in Azure ML Registry #37464

bastbu opened this issue Sep 19, 2024 · 1 comment
Labels
Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. Machine Learning needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Attention Workflow: This issue is responsible by Azure service team.

Comments

@bastbu
Copy link

bastbu commented Sep 19, 2024

  • Package Name: azure-ai-ml
  • Package Version: 1.19.0
  • Operating System: Dev Container (Ubuntu)
  • Python Version: Python 3.11.10

Describe the bug

When creating the same component in an AML Registry twice (the second time with an updated version and code, but the same environment), the update of such a component fails.

The following error message gets thrown:

Exception: ValueError: No value for given attribute
Stack:
  
  [REDACTED]
  
    _ = client.components.create_or_update(component)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/workspaces/.venv/lib/python3.11/site-packages/azure/ai/ml/_telemetry/activity.py", line 372, in wrapper
    return_value = f(*args, **kwargs)
                   ^^^^^^^^^^^^^^^^^^
  File "/workspaces/.venv/lib/python3.11/site-packages/azure/ai/ml/operations/_component_operations.py", line 619, in create_or_update
    self._resolve_arm_id_or_upload_dependencies(component)
  File "/workspaces/.venv/lib/python3.11/site-packages/azure/ai/ml/operations/_component_operations.py", line 795, in _resolve_arm_id_or_upload_dependencies
    self._resolve_dependencies_for_component(component, resolver)
  File "/workspaces/.venv/lib/python3.11/site-packages/azure/ai/ml/operations/_component_operations.py", line 823, in _resolve_dependencies_for_component
    self._try_resolve_environment_for_component(
  File "/workspaces/.venv/lib/python3.11/site-packages/azure/ai/ml/operations/_component_operations.py", line 783, in _try_resolve_environment_for_component
    parent.environment = resolver(parent.environment, azureml_type=AzureMLResourceType.ENVIRONMENT)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/workspaces/.venv/lib/python3.11/site-packages/azure/ai/ml/operations/_operation_orchestrator.py", line 240, in get_asset_arm_id
    result = self._get_environment_arm_id(asset, register_asset=register_asset)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/workspaces/.venv/lib/python3.11/site-packages/azure/ai/ml/operations/_operation_orchestrator.py", line 318, in _get_environment_arm_id
    env_response = self._environments.create_or_update(environment)  # type: ignore[attr-defined]
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/workspaces/.venv/lib/python3.11/site-packages/azure/ai/ml/_telemetry/activity.py", line 292, in wrapper
    return f(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^
  File "/workspaces/.venv/lib/python3.11/site-packages/azure/ai/ml/operations/_environment_operations.py", line 205, in create_or_update
    raise ex
  File "/workspaces/.venv/lib/python3.11/site-packages/azure/ai/ml/operations/_environment_operations.py", line 172, in create_or_update
    environment = _check_and_upload_env_build_context(
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/workspaces/.venv/lib/python3.11/site-packages/azure/ai/ml/_artifacts/_artifact_utilities.py", line 538, in _check_and_upload_env_build_context
    uploaded_artifact = _upload_to_datastore(
                        ^^^^^^^^^^^^^^^^^^^^^
  File "/workspaces/.venv/lib/python3.11/site-packages/azure/ai/ml/_artifacts/_artifact_utilities.py", line 384, in _upload_to_datastore
    artifact = upload_artifact(
               ^^^^^^^^^^^^^^^^
  File "/workspaces/.venv/lib/python3.11/site-packages/azure/ai/ml/_artifacts/_artifact_utilities.py", line 240, in upload_artifact
    datastore_info = get_datastore_info(datastore_operation, datastore_name)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/workspaces/.venv/lib/python3.11/site-packages/azure/ai/ml/_artifacts/_artifact_utilities.py", line 99, in get_datastore_info
    datastore = operations.get(name) if name else operations.get_default()
                ^^^^^^^^^^^^^^^^^^^^
  File "/workspaces/.venv/lib/python3.11/site-packages/azure/ai/ml/_telemetry/activity.py", line 292, in wrapper
    return f(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^
  File "/workspaces/.venv/lib/python3.11/site-packages/azure/ai/ml/operations/_datastore_operations.py", line 155, in get
    datastore_resource = self._operation.get(
                         ^^^^^^^^^^^^^^^^^^^^
  File "/workspaces/.venv/lib/python3.11/site-packages/azure/core/tracing/decorator.py", line 94, in wrapper_use_tracer
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/workspaces/.venv/lib/python3.11/site-packages/azure/ai/ml/_restclient/v2024_07_01_preview/operations/_datastores_operations.py", line 496, in get
    request = build_get_request(
              ^^^^^^^^^^^^^^^^^^
  File "/workspaces/.venv/lib/python3.11/site-packages/azure/ai/ml/_restclient/v2024_07_01_preview/operations/_datastores_operations.py", line 147, in build_get_request
    "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$'),
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/workspaces/.venv/lib/python3.11/site-packages/msrest/serialization.py", line 652, in url
    output = self.serialize_data(data, data_type, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/workspaces/.venv/lib/python3.11/site-packages/msrest/serialization.py", line 760, in serialize_data
    raise ValueError("No value for given attribute")

To Reproduce

Use the following component definition:

$schema: https://azuremlschemas.azureedge.net/latest/commandComponent.schema.json
type: command

name: <anything>

inputs:
  <...>

code: ./code
environment:
  build:
    path: ./environment
    dockerfile_path: Dockerfile

command: >-
  python main.py <...>

We use the following code to create a component:

from azure.ai.ml import load_component

component = load_component(<path-to-component>)
_ = client.components.create_or_update(component)

where client is an instance of MLClient that is configured to point to a registry.

Steps to reproduce the behavior:

  1. Upload a component
  2. Change the code and component version, upload the component again.
  3. The attached error message gets thrown.

Attempted workaround

We currently work around this by setting the environment name and version in the CommandComponent, as the properties are public and mutable, i.e.

component.environment.name = component.name
component.environment.version = component.version

With this the component creation is successful, but we get the following warning, which indicates that something is off:

Warning: the provided asset name '<component_name>' will not be used for anonymous registration

Is this workaround appropriate or do you have another suggestion?

Expected behavior

We should be able to upload new component versions into the Azure ML Registry.

@github-actions github-actions bot added Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. Machine Learning needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Attention Workflow: This issue is responsible by Azure service team. labels Sep 19, 2024
Copy link

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @Azure/azure-ml-sdk @azureml-github.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. Machine Learning needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Attention Workflow: This issue is responsible by Azure service team.
Projects
None yet
Development

No branches or pull requests

1 participant