Skip to content

Commit

Permalink
add retry to efs apis on throttling
Browse files Browse the repository at this point in the history
  • Loading branch information
rpmcginty committed Feb 2, 2024
1 parent 4514b1d commit 9c25071
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ assignees: ''
### Environment Details
#### Desktop (please complete the following information):
- **OS**: [e.g. iOS]
- **GCS Version** [e.g. 0.0.1 or commit ID]
- **Code Version** [e.g. 0.0.1 or commit ID]
- **Python Version** [e.g. python 3.9.16]
8 changes: 7 additions & 1 deletion src/aibs_informatics_aws_utils/efs/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@
from pathlib import Path
from typing import TYPE_CHECKING, Dict, List, Optional, Union

from aibs_informatics_core.utils.decorators import retry
from aibs_informatics_core.utils.tools.dicttools import remove_null_values
from botocore.exceptions import ClientError

from aibs_informatics_aws_utils.core import AWSService
from aibs_informatics_aws_utils.core import AWSService, client_error_code_check

if TYPE_CHECKING: # pragma: no cover
from mypy_boto3_efs.type_defs import (
Expand All @@ -40,7 +42,10 @@

StrPath = Union[Path, str]

throttling_exception_callback = lambda ex: client_error_code_check(ex, "ThrottlingException")


@retry(ClientError, [throttling_exception_callback])
def list_efs_file_systems(
file_system_id: Optional[str] = None,
name: Optional[str] = None,
Expand Down Expand Up @@ -111,6 +116,7 @@ def get_efs_file_system(
return file_systems[0]


@retry(ClientError, [throttling_exception_callback])
def list_efs_access_points(
access_point_id: Optional[str] = None,
access_point_name: Optional[str] = None,
Expand Down

0 comments on commit 9c25071

Please sign in to comment.