GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat: Add async DynamoDB timeout and retry configuration by sebastjaeger · Pull Request #5178 · feast-dev/feast

feat: Add async DynamoDB timeout and retry configuration #5178

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Sign up for GitHub

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
franciscojavierarceo merged 7 commits into feast-dev:master from sebastjaeger:feature/add_botocore_configuration_options
Mar 24, 2025

Uh oh!

There was an error while loading. Please reload this page.

Merged

feat: Add async DynamoDB timeout and retry configuration #5178

Changes from all commits
Commits
Show all changes
7 commits
Select commit Hold shift + click to select a range
61bea08
Add async DynamoDB timeout and retry configuration
sebastjaeger Mar 21, 2025
fc42cc7
Use union sytnax
sebastjaeger Mar 21, 2025
86be5fb
Move retry configutation into top level, remove max_attempts
sebastjaeger Mar 21, 2025
3787fef
Add explicity type hint to retries dict
sebastjaeger Mar 21, 2025
88d9619
Update docstrings
sebastjaeger Mar 21, 2025
05f9eb2
Fix docstrings
sebastjaeger Mar 21, 2025
5c844b7
Update doc string, use None as retries default
sebastjaeger Mar 24, 2025
File filter
Filter by extension

Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Diff view
Diff view

There are no files selected for viewing

58 changes: 54 additions & 4 deletions 58 sdk/python/feast/infra/online_stores/dynamodb.py
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,26 @@ class DynamoDBOnlineStoreConfig(FeastConfigBaseModel):
keepalive_timeout: float = 12.0
"""Keep-alive timeout in seconds for async Dynamodb connections."""

connect_timeout: Union[int, float] = 60
"""The time in seconds until a timeout exception is thrown when attempting to make
an async connection."""

read_timeout: Union[int, float] = 60
"""The time in seconds until a timeout exception is thrown when attempting to read
from an async connection."""

total_max_retry_attempts: Union[int, None] = None
"""Maximum number of total attempts that will be made on a single request.

Maps to `retries.total_max_attempts` in botocore.config.Config.
"""

retry_mode: Union[Literal["legacy", "standard", "adaptive"], None] = None
"""The type of retry mode (aio)botocore should use.

Maps to `retries.mode` in botocore.config.Config.
"""


class DynamoDBOnlineStore(OnlineStore):
"""
Expand All @@ -99,10 +119,16 @@ class DynamoDBOnlineStore(OnlineStore):
_dynamodb_resource = None

async def initialize(self, config: RepoConfig):
online_config = config.online_store

await _get_aiodynamodb_client(
config.online_store.region,
config.online_store.max_pool_connections,
config.online_store.keepalive_timeout,
online_config.region,
online_config.max_pool_connections,
online_config.keepalive_timeout,
online_config.connect_timeout,
online_config.read_timeout,
online_config.total_max_retry_attempts,
online_config.retry_mode,
)

async def close(self):
Expand Down Expand Up @@ -280,6 +306,10 @@ async def online_write_batch_async(
online_config.region,
online_config.max_pool_connections,
online_config.keepalive_timeout,
online_config.connect_timeout,
online_config.read_timeout,
online_config.total_max_retry_attempts,
online_config.retry_mode,
)
await dynamo_write_items_async(client, table_name, items)

Expand Down Expand Up @@ -387,6 +417,10 @@ def to_tbl_resp(raw_client_response):
online_config.region,
online_config.max_pool_connections,
online_config.keepalive_timeout,
online_config.connect_timeout,
online_config.read_timeout,
online_config.total_max_retry_attempts,
online_config.retry_mode,
)
response_batches = await asyncio.gather(
*[
Expand Down Expand Up @@ -546,16 +580,32 @@ def _get_aioboto_session():


async def _get_aiodynamodb_client(
region: str, max_pool_connections: int, keepalive_timeout: float
region: str,
max_pool_connections: int,
keepalive_timeout: float,
connect_timeout: Union[int, float],
read_timeout: Union[int, float],
total_max_retry_attempts: Union[int, None],
retry_mode: Union[Literal["legacy", "standard", "adaptive"], None],
):
global _aioboto_client
if _aioboto_client is None:
logger.debug("initializing the aiobotocore dynamodb client")

retries: Dict[str, Any] = {}
if total_max_retry_attempts is not None:
retries["total_max_attempts"] = total_max_retry_attempts
if retry_mode is not None:
retries["mode"] = retry_mode

client_context = _get_aioboto_session().create_client(
"dynamodb",
region_name=region,
config=AioConfig(
max_pool_connections=max_pool_connections,
connect_timeout=connect_timeout,
read_timeout=read_timeout,
retries=retries if retries else None,
connector_args={"keepalive_timeout": keepalive_timeout},
),
)
Expand Down
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.