[Lambda DevX] Support for Config Hot Reloading#10
Open
lizard-boy wants to merge 3 commits intomasterfrom
Open
Conversation
There was a problem hiding this comment.
PR Summary
This PR introduces hot reloading support for Lambda Debug Mode configuration in LocalStack, allowing dynamic updates without restarting the service.
- Added file watching mechanism in
lambda_debug_mode_session.pyto detect and reload configuration changes - Implemented environment stopping after execution for debugged Lambda functions in
assignment.py - Enhanced flexibility for debugging dynamically named Lambda functions
- Improved error handling and logging for configuration loading issues
- Note: Potential performance impact due to increased frequency of environment stops
2 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings
Comment on lines
+115
to
+117
| except Exception as e: | ||
| print("Lambda Debug Mode could not access the configuration file: %s", e) | ||
| epoch_now = int(time.time()) |
There was a problem hiding this comment.
style: Use LOG.error instead of print for consistency with error handling elsewhere in the file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Motivation
Currently the configuration for Lambda Debug Mode is loaded on startup and cannot be changed until the next restart of LocalStack. This may not only be inconvenient whenever changes to the configuration may be required after startup, but also means that it is impossible for the user to provide configurations for Lambda functions for which the arn is unknown before startup. Such scenario may occur when using dynamic naming in cloud formation. Hence, these changes add initial support for the hot reloading of the Lambda Debug Mode configuration file. This is achieved by updating the config when changes are detected in the file, and stopping a lambda container after evaluation iff this is being debugged. Stopping the container after evaluation is encouraged by the difficulty/feasibility or reconfiguring the container (consider ports), and has the added benefit of unblocking the scenario of debugging the same lambda function more than once.
Changes
Testing
As the development of a testing stack for Lambdas debugging is being developed, I refer to manual testing using the Lambda Debug Mode sampled provided here: localstack-samples/localstack-pro-samples#253