Skip to content

Commit

Permalink
fix(bug): fix the TimeoutError in Python 3.11 and add CI for Python==…
Browse files Browse the repository at this point in the history
…3.11.

The bug is described in #79
  • Loading branch information
idocx committed Oct 7, 2024
1 parent 63dc41b commit b46f013
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
timeout-minutes: 60
strategy:
matrix:
python-version: ["3.10"]
python-version: ["3.10", "3.11"]
services:
rabbitmq:
image: "rabbitmq:3.9"
Expand Down
16 changes: 11 additions & 5 deletions alab_management/resource_manager/resource_requester.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,18 @@ class RequestCanceledError(Exception):
"""Request Canceled Error."""


class CombinedTimeoutError(TimeoutError, concurrent.futures.TimeoutError):
"""
Combined TimeoutError.
# considering concurrent.futures.TimeoutError and TimeoutError becomes the same
# from Python 3.11. We should determine the base class of this exception.
if isinstance(concurrent.futures.TimeoutError, TimeoutError):
CombinedTimeoutError = TimeoutError
else:

If you catch either TimeoutError or concurrent.futures.TimeoutError, this will catch both.
"""
class CombinedTimeoutError(TimeoutError, concurrent.futures.TimeoutError):
"""
Combined TimeoutError.
If you catch either TimeoutError or concurrent.futures.TimeoutError, this will catch both.
"""


class DeviceRequest(BaseModel):
Expand Down

0 comments on commit b46f013

Please sign in to comment.