This repository is for active development of the Azure SDK for Python. For consumers of the SDK we recommend visiting our public developer docs at https://docs.microsoft.com/python/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-python.
MIT License
4.38k
stars
2.71k
forks
source link
Setting kwarg job_name upon ml_client.batch_endpoints.invoke() does nothing #32763
But taking a look in to the source code azure/ai/ml/operations/_batch_endpoint_operations.py you can see that there is really such a kwarg, see the code snippet below.
Expected behavior
The created batch job should have a display Name "test_name" instead of a random name like "tidy_dress_xjcnyqw1".
Additional context
Setting the kwarg "params_override" like this:
params_override = [{EndpointYamlFields.BATCH_JOB_NAME: "test_name"}]
also does not achieve the desired result.
So there is no way to invoke a batch endpoint and get a job posted with a custom name. A workaround would be to set the description, for example after invoking the endpoint like this:
@distributed_trace
@monitor_with_activity(logger, "BatchEndpoint.Invoke", ActivityType.PUBLICAPI)
def invoke(
self,
endpoint_name: str,
*,
deployment_name: Optional[str] = None,
inputs: Optional[Dict[str, Input]] = None,
**kwargs,
) -> BatchJob:
"""Invokes the batch endpoint with the provided payload.
:param endpoint_name: The endpoint name.
:type endpoint_name: str
:keyword deployment_name: (Optional) The name of a specific deployment to invoke. This is optional.
By default requests are routed to any of the deployments according to the traffic rules.
:paramtype deployment_name: str
:keyword inputs: (Optional) A dictionary of existing data asset, public uri file or folder
to use with the deployment
:paramtype inputs: Dict[str, Input]
:raises ~azure.ai.ml.exceptions.ValidationException: Raised if deployment cannot be successfully validated.
Details will be provided in the error message.
:raises ~azure.ai.ml.exceptions.AssetException: Raised if BatchEndpoint assets
(e.g. Data, Code, Model, Environment) cannot be successfully validated.
Details will be provided in the error message.
:raises ~azure.ai.ml.exceptions.ModelException: Raised if BatchEndpoint model cannot be successfully validated.
Details will be provided in the error message.
:raises ~azure.ai.ml.exceptions.EmptyDirectoryError: Raised if local path provided points to an empty directory.
:return: The invoked batch deployment job.
:rtype: ~azure.ai.ml.entities.BatchJob
.. admonition:: Example:
.. literalinclude:: ../samples/ml_samples_misc.py
:start-after: [START batch_endpoint_operations_invoke]
:end-before: [END batch_endpoint_operations_invoke]
:language: python
:dedent: 8
:caption: Invoke endpoint example.
"""
outputs = kwargs.get("outputs", None)
job_name = kwargs.get("job_name", None)
params_override = kwargs.get("params_override", None) or []
Describe the bug Setting the kwarg "job_name" upon calling ml_client.batch_endpoints.invoke() does nothing.
To Reproduce Steps to reproduce the behavior:
The kwarg "job_name" is not documented: https://learn.microsoft.com/en-us/python/api/azure-ai-ml/azure.ai.ml.operations.batchendpointoperations?view=azure-python#azure-ai-ml-operations-batchendpointoperations-invoke
But taking a look in to the source code
azure/ai/ml/operations/_batch_endpoint_operations.py
you can see that there is really such a kwarg, see the code snippet below.The Azure CLI has also equivalent argument: https://learn.microsoft.com/en-us/cli/azure/ml/batch-endpoint?view=azure-cli-latest#az-ml-batch-endpoint-invoke-optional-parameters
Expected behavior The created batch job should have a display Name "test_name" instead of a random name like "tidy_dress_xjcnyqw1".
Additional context Setting the kwarg "params_override" like this:
params_override = [{EndpointYamlFields.BATCH_JOB_NAME: "test_name"}]
also does not achieve the desired result.
So there is no way to invoke a batch endpoint and get a job posted with a custom name. A workaround would be to set the description, for example after invoking the endpoint like this:
But this doesn't work as well.