Skip to content

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

Description

@andrew-rietz
  • 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'

Metadata

Metadata

Assignees

No one assigned

    Labels

    BatchClientThis issue points to a problem in the data-plane of the library.Service AttentionWorkflow: This issue is responsible by Azure service team.customer-reportedIssues that are reported by GitHub users external to the Azure organization.needs-team-attentionWorkflow: This issue needs attention from Azure service team or SDK teamquestionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions