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
Add Lambda runtime parity configuration for ulimit #7871
Conversation
f249eb4
to
5ff046c
Compare
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.
LGTM!
|
||
if args.envs: | ||
for env in args.envs: | ||
lhs, _, rhs = env.partition("=") |
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.
it seems we are doing this partitioning in some cases. We could define an argparse custom action for it https://docs.python.org/3/library/argparse.html#action , like demonstrated here: https://www.geeksforgeeks.org/python-key-value-pair-using-argparse/ (was the first link for it but it demonstrates what's possible).
Just a thought, nothing urgent.
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.
Fully agree 👍
I saw it but just tackled the main argument parsing in the first iteration. This looks like a low-hanging fruit though.
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.
Just added a comment for now. A quick test revealed that more tests and refinements are needed to ensure equivalent parsing, especially given some flag-specific logic.
@pytest.mark.skipif( | ||
not use_docker(), | ||
reason="Monkeypatching of Docker flags not applicable if run locally", | ||
) |
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.
Same as for the other PR, why wouldn't it be applicable?
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.
Monkeypatching works but Docker-flags are not used with the local executor in the old lambda provider because no new Docker container is started. Hence, DOCKER flags are not applicable and Docker tests with the local executor fail.
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.
I clarified the reason and added a new is_old_local_executor() util. This needs to be extended to the new local executor replacement (i.e., the self-managed workers) because they do not spawn new containers either.
The list of optional argument is becoming hard to maintain when using implicit ordering. Explicit key/value pairs make the usage of `parse_additional_flags` much clearer and easier.
We don't need to offer a no-privileged flag. Hence, we can simplify parsing of a boolean flag while maintaining compatibility for Python 3.7
* Use Typings for older Python version * Convert TypedDict into dataclass
Requires more testing to ensure consistent behavior (e.g., with multiple arguments, empty arguments, and combinations).
62ee45d
to
4301369
Compare
Addresses #6942
This PR makes
ulimit
configurable for Lambda as an opt-in option and refactors the Docker flags parser:ulimit
configurable throughLAMBDA_DOCKER_FLAGS=--ulimit nofile=1024:1024 --ulimit nproc=735:735 --ulimit core=-1:-1
ulimit
NoExitArgumentParser
prevents the parser from exiting (default behavior for interactive CLI).