-
Notifications
You must be signed in to change notification settings - Fork 1
Replace LambdaContext class with a Proto and a dataclass #54
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
| cognito_identity=cognito_identity_dict, | ||
| epoch_deadline_time_in_ms=int( | ||
| return { | ||
| "invoke_id": "test-invoke-12345", |
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.
per review here, https://github.com/aws/aws-durable-execution-sdk-python-testing/pull/54/files
this is a class, not a dict.
maybe make a lightweight dataclass here just for the Testing Lib that incorporate the protocol?
from sdk import LambdaContext as LambdaContextProtocol
@dataclass
class LambdaContext(LambdaContextProtocol):
aws_request_id: str
log_group_name: str | None = None
log_stream_name: str | None = None
function_name: str | None = None
memory_limit_in_mb: str | None = None
function_version: str | None = None
invoked_function_arn: str | None = None
tenant_id: str | None = None
client_context: object | None = None
identity: object | None = None
def get_remaining_time_in_millis(self) -> int:
return 0 # Implementation needed
def log(self, msg: str) -> None:
print(msg) # Implementation needed
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.
Edit: Clarified offline. Will use class instead.
Signed-off-by: Astraea Sinclair <quinsclr@amazon.com>
Replaces previous uses of LambdaContext with a dataclass that implements the proto from sdk repo.
Dependencies
If this PR requires testing against a specific branch of the Python Language SDK (e.g., for unreleased changes), uncomment and specify the branch below. Otherwise, leave commented to use the main branch.
PYTHON_LANGUAGE_SDK_BRANCH: lambda-ctx
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.