ITADN

BatchErrorException.error is an HTTPError that has no attribute 'code'

#47784Openandrew-rietz 创建于 2026-07-01
A
andrew-rietzcommented
- **Package Name**: azure-batch - **Package Version**: 14.2.0 - **Operating System**: python:3.10-slim-bookworm - **Python Version**: 3.10 **Describe the bug** The azure batch sdk is not handling an internal data type correctly, resulting in an unhandled exception that returns a `<unprintable BatchErrorException object>` to the caller. It looks like the code is expecting the `BatchErrorException` or `BatchErrorException.error` to have specific attributes. Those attributes don't exist resulting in an unhandled exception. It seems like the tasks -- or at least some of the tasks -- are making it through and being scheduled in the appropriate jobs **To Reproduce** Happens intermittently. The same set of tasks can be submitted, sometimes resulting in an error, other times succeeding without issue. **Additional context** ``` Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/azure/batch/custom/patch.py", line 79, in _bulk_add_tasks add_collection_response = self._original_add_collection( File "/usr/local/lib/python3.10/site-packages/azure/batch/operations/_task_operations.py", line 344, in add_collection raise models.BatchErrorException(self._deserialize, response) azure.batch.models._models_py3.BatchErrorException: <unprintable BatchErrorException object> During handling of the above exception, another exception occurred: Traceback (most recent call last): # <omitted> response: "TaskAddCollectionResult" = self.batch_client.task.add_collection( File "/usr/local/lib/python3.10/site-packages/azure/batch/custom/patch.py", line 275, in bulk_add_collection task_workflow_manager.task_collection_thread_handler(results_queue) File "/usr/local/lib/python3.10/site-packages/azure/batch/custom/patch.py", line 169, in task_collection_thread_handler self._bulk_add_tasks(results_queue, chunk_tasks_to_add) File "/usr/local/lib/python3.10/site-packages/azure/batch/custom/patch.py", line 90, in _bulk_add_tasks if e.error.code == "RequestBodyTooLarge": # pylint: disable=no-member AttributeError: 'HTTPError' object has no attribute 'code' ```
0 条评论