-
Notifications
You must be signed in to change notification settings - Fork 5
feat(sdk): add support for custom boto3 client #182
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.
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
Conversation
| if TYPE_CHECKING: | ||
| from collections.abc import Callable, MutableMapping | ||
|
|
||
| import boto3 # type: ignore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might need to import boto3-stubs as development dependencies to remove ignores like this.
| def durable_execution( | ||
| func: Callable[[Any, DurableContext], Any], | ||
| func: Callable[[Any, DurableContext], Any] | None = None, | ||
| *, | ||
| boto3_client: boto3.client | None = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mypy isn't running in strict mode in this project, so I'm not adding overload methods. I don't think we need them, but let me know what you think.
|
Adding the message from the PR here because CI is broken: This PR adds support for passing a custom boto3 Lambda client to the import boto3
from botocore.config import Config
from aws_durable_execution_sdk_python import durable_execution, DurableContext
custom_lambda_client = boto3.client(
'lambda',
config=Config(
retries={'max_attempts': 5, 'mode': 'adaptive'},
connect_timeout=10,
read_timeout=60,
)
)
@durable_execution(boto3_client=custom_lambda_client)
def handler(event: dict, context: DurableContext) -> dict:
return {"status": "success"} |
|
Closed and reopened to trigger new build |
ghost
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Leo for the PR! Exactly what I had in mind.
@yaythomas your call if we want to include in launch.
closes #181
Summary
This PR adds support for passing a custom boto3 Lambda client to the @durable_execution decorator via a new boto3_client parameter. This allows users to customize the client configuration for checkpoint and state management operations.
@durable_execution(boto3_client=custom_lambda_client)
def handler(event: dict, context: DurableContext) -> dict:
return {"status": "success"}