Azure / Azure/azure-sdk-for-python

Issue with local endpoints when invoke

Open
#40,631 7 comments 0 reactions 1 assignee Assigned to @achauhan-scc View on GitHub
bug Client customer-reported Machine Learning needs-team-attention Service Attention
Dominant language
Python
Stars
5.6k
Forks
3.4k
Avg merge
1d 21h
Merged PRs (30d)
193

Description

I have an azure machine learning managed online deployment. I'm working fully locally for now and I see that there is an error when using only local. Let's have for this example no endpoints and no deployments created in azure ml.

When I try to invoke the local endpoint using the `OnlineEndpointOperations` (MLClient.online_endpoints). I get an error because it tries to validate the deployment name.

https://github.com/Azure/azure-sdk-for-python/blob/acc0d4a782f785c552080a14adc889b58c04c077/sdk/ml/azure-ai-ml/azure/ai/ml/operations/_online_endpoint_operations.py#L337

- I see an easy fix for this as only validate the deployment name if it's an online endpoint and not doing it if local=True.

The correct solution would be fixing the function `_validate_deployment_name` to accept the `local=local` as parameter. The problem here is that inside this function there is no easy way to get the deployments_list for local unless the `_LocalDeploymentHelper` is instantiated.

Now in the code I have I have a monkey patch in order to skip the validation and then I can do the invoke like this:
```python
online_endpoints_operator = ml_client.online_endpoints
if local_deploy:
online_endpoints_operator._validate_deployment_name = (
lambda *args, **kwargs: True
)
online_endpoints_operator.invoke(
endpoint_name=endpoint_name,
deployment_name=deployment_name,
local=local_deploy,
request_file=f"{model_score_path}/{model_sample_input}",
)
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.