Skip to content

💥 Enable lambda worker async configure callback#1604

Open
jmaeagle99 wants to merge 4 commits into
mainfrom
lambda-s3
Open

💥 Enable lambda worker async configure callback#1604
jmaeagle99 wants to merge 4 commits into
mainfrom
lambda-s3

Conversation

@jmaeagle99

Copy link
Copy Markdown
Contributor

What was changed

  • Allow lambda worker's run_worker function to accept async configure callbacks. The callback now supports synchronous functions, async functions, and async generators (or equivalently, @asynccontextmanager-decorated functions). The async generator form acts as a context manager: setup runs before the yield, and teardown runs after the worker has stopped.
  • The configure callback is now invoked within an asyncio event loop so it can make async calls.
  • 💥 The configure callback is now called per-invocation of the lambda worker instead of just once at startup. Configuration errors now surface as Lambda invocation errors rather than at cold start.

Why?

Support configurations that require async calls and resources that must stay alive across the worker's lifetime, such as the S3 driver client.

Checklist

  1. How was this tested: Unit tests
  2. Any docs updates needed? No

@jmaeagle99 jmaeagle99 requested a review from a team as a code owner June 15, 2026 20:58

@Sushisource Sushisource left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few minor things. Thanks!

Comment thread temporalio/contrib/aws/lambda_worker/_run_worker.py
Comment thread temporalio/contrib/aws/lambda_worker/_run_worker.py Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants