Add Lambda runtime parity configuration for ulimit#7871
Conversation
f249eb4 to
5ff046c
Compare
|
|
||
| if args.envs: | ||
| for env in args.envs: | ||
| lhs, _, rhs = env.partition("=") |
There was a problem hiding this comment.
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.
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.
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.
Same as for the other PR, why wouldn't it be applicable?
There was a problem hiding this comment.
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.
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
ulimitconfigurable for Lambda as an opt-in option and refactors the Docker flags parser:ulimitconfigurable throughLAMBDA_DOCKER_FLAGS=--ulimit nofile=1024:1024 --ulimit nproc=735:735 --ulimit core=-1:-1ulimitNoExitArgumentParserprevents the parser from exiting (default behavior for interactive CLI).