Azure / Azure/azure-sdk-for-python
list_jobs fails for both BatchEndpointOperations and BatchDeploymentOperations
- Dominant language
- Python
- Stars
- 5.6k
- Forks
- 3.4k
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 193
Description
- **Package Name**: azure-ai-ml
- **Package Version**: 1.30.0
- **Operating System**: macOS 26.2 Tahoe
- **Python Version**: 3.12.10
**Describe the bug**
The `list_jobs` method for both `BatchEndpointOperations` and `BatchDeploymentOperations` seems to always fail with an invalid request error.
**To Reproduce**
```python
import os
from azure.ai.ml import MLClient
from azure.identity import AzureCliCredential
if __name__ == "__main__":
ml_client = MLClient(
credential=AzureCliCredential(),
subscription_id=os.environ["AZURE_SUBSCRIPTION_ID"],
resource_group_name=os.environ["AZURE_RESOURCE_GROUP"],
workspace_name=os.environ["AZURE_ML_WORKSPACE"],
enable_telemetry=False,
)
jobs = ml_client.batch_endpoints.list_jobs(endpoint_name="my-endpoint")
print(list(jobs))
```
**Expected behavior**
Function returns an iterator of BatchJobs [per doc for BatchEndpointOperations](https://learn.microsoft.com/en-us/python/api/azure-ai-ml/azure.ai.ml.operations.batchendpointoperations?view=azure-python#azure-ai-ml-operations-batchendpointoperations-list-jobs) and [doc for BatchDeploymentOperations](https://learn.microsoft.com/en-us/python/api/azure-ai-ml/azure.ai.ml.operations.batchdeploymentoperations?view=azure-python#azure-ai-ml-operations-batchdeploymentoperations-list-jobs)
**~~Screenshots~~ Output**
```shell
Class DeploymentTemplateOperations: This is an experimental class, and may change at any time. Please see https://aka.ms/azuremlexperimental for more information.
Traceback (most recent call last):
File "/Users/person/Library/Application Support/uv/python/cpython-3.12.10-macos-x86_64-none/lib/python3.12/runpy.py", line 198, in _run_module_as_main
return _run_code(code, main_globals, None,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/person/Library/Application Support/uv/python/cpython-3.12.10-macos-x86_64-none/lib/python3.12/runpy.py", line 88, in _run_code
exec(code, run_globals)
File "/Users/person/.vscode/extensions/ms-python.debugpy-2025.19.2026012701-darwin-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/__main__.py", line 71, in
cli.main()
File "/Users/person/.vscode/extensions/ms-python.debugpy-2025.19.2026012701-darwin-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 508, in main
run()
File "/Users/person/.vscode/extensions/ms-python.debugpy-2025.19.2026012701-darwin-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 358, in run_file
runpy.run_path(target, run_name="__main__")
File "/Users/person/.vscode/extensions/ms-python.debugpy-2025.19.2026012701-darwin-x64/bundled/libs/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 310, in run_path
return _run_module_code(code, init_globals, run_name, pkg_name=pkg_name, script_name=fname)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/person/.vscode/extensions/ms-python.debugpy-2025.19.2026012701-darwin-x64/bundled/libs/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 127, in _run_module_code
_run_code(code, mod_globals, init_globals, mod_name, mod_spec, pkg_name, script_name)
File "/Users/person/.vscode/extensions/ms-python.debugpy-2025.19.2026012701-darwin-x64/bundled/libs/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 118, in _run_code
exec(code, run_globals)
File "/Users/person/code/pipelines/check_job.py", line 22, in
jobs = ml_client.batch_endpoints.list_jobs(endpoint_name=ENDPOINT_NAME)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/person/code/.venv/lib/python3.12/site-packages/azure/core/tracing/decorator.py", line 119, in wrapper_use_tracer
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/Users/person/code/.venv/lib/python3.12/site-packages/azure/ai/ml/_telemetry/activity.py", line 288, in wrapper
return f(*args, **kwargs)
^^^^^^^^^^^^^^^^^^
File "/Users/person/code/.venv/lib/python3.12/site-packages/azure/ai/ml/operations/_batch_endpoint_operations.py", line 439, in list_jobs
return list(result)
^^^^^^^^^^^^
File "/Users/person/code/.venv/lib/python3.12/site-packages/azure/core/paging.py", line 136, in __next__
return next(self._page_iterator)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/person/code/.venv/lib/python3.12/site-packages/azure/core/paging.py", line 82, in __next__
self._response = self._get_next(self.continuation_token)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/person/code/.venv/lib/python3.12/site-packages/azure/ai/ml/_restclient/v2020_09_01_dataplanepreview/operations/_batch_job_endpoint_operations.py", line 276, in get_next
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
azure.core.exceptions.HttpResponseError: Operation returned an invalid status 'Invalid Request Uri. Format error!'
Content: {
"error": {
"code": "UserError",
"severity": null,
"message": "Invalid Request Uri. Format error!",
"messageFormat": "Invalid Request Uri. {detailMessage}",
"messageParameters": {
"detailMessage": "Format error!"
},
"referenceCode": null,
"detailsUri": null,
"target": null,
"details": [],
"innerError": {
"code": "BadArgument",
"innerError": {
"code": "ArgumentInvalid",
"innerError": {
"code": "InvalidRequestUri",
"innerError": null
}
}
},
"debugInfo": null,
"additionalInfo": null
},
"correlation": {
"operation": "7ee657ffcdbcee19e2d3244890778d5a",
"request": "4660ff8161351202"
},
"environment": "eastus2",
"location": "eastus2",
"time": "2026-02-16T11:13:15.1908436+00:00",
"componentName": "Designer-MiddleTier-Service",
"statusCode": 400
}
```
**Additional context**
[`JobOperations.list`](https://learn.microsoft.com/en-us/python/api/azure-ai-ml/azure.ai.ml.operations.joboperations?view=azure-python#azure-ai-ml-operations-joboperations-list) works fine - though of course this lists all jobs in the workspace, so requires user to filter.
Contributor guide
Assessment
This issue has not been assessed yet.