-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Add Lambda runtime parity configuration for ulimit #7871
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
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
8a2f41b
Add argparse POC for parse_additional_flags
joe4dev a5ed008
Make parser compatible with older Python version
joe4dev 7566778
Add label argument shortcut to match Docker API
joe4dev 7e5d650
Order flags alphabetically
joe4dev c0d58c9
Re-structure Docker additional flags parser
joe4dev ed4ce7c
Add ulimit to Docker clients
joe4dev 12d2053
Simplify boolean flag parsing
joe4dev 19ece8a
Test lambda ulimits
joe4dev 1fac0b7
Add flags to run container
joe4dev 6e7734d
Fix Python version compatibility issues
joe4dev a002ab0
Skip ulimit test without Docker
joe4dev 4a29f2c
Fix stack ulimit for CI tests against pro
joe4dev 1de8682
Clarify test skip for legacy local executor
joe4dev 4301369
Add argparse custom action refactoring comment
joe4dev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import argparse | ||
import logging | ||
from typing import NoReturn, Optional | ||
|
||
LOG = logging.getLogger(__name__) | ||
|
||
|
||
class NoExitArgumentParser(argparse.ArgumentParser): | ||
"""Implements the `exit_on_error=False` behavior introduced in Python 3.9 to support older Python versions | ||
and prevents further SystemExit for other error categories. | ||
* Limitations of error categories: https://stackoverflow.com/a/67891066/6875981 | ||
* ArgumentParser subclassing example: https://stackoverflow.com/a/59072378/6875981 | ||
""" | ||
|
||
def exit(self, status: int = ..., message: Optional[str] = ...) -> NoReturn: | ||
LOG.warning(f"Error in argument parser but preventing exit: {message}") | ||
|
||
def error(self, message: str) -> NoReturn: | ||
raise NotImplementedError(f"Unsupported flag by this Docker client: {message}") |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import resource | ||
|
||
|
||
def handler(event, context): | ||
# https://docs.python.org/3/library/resource.html | ||
ulimit_names = { | ||
"RLIMIT_AS": resource.RLIMIT_AS, | ||
"RLIMIT_CORE": resource.RLIMIT_CORE, | ||
"RLIMIT_CPU": resource.RLIMIT_CPU, | ||
"RLIMIT_DATA": resource.RLIMIT_DATA, | ||
"RLIMIT_FSIZE": resource.RLIMIT_FSIZE, | ||
"RLIMIT_MEMLOCK": resource.RLIMIT_MEMLOCK, | ||
"RLIMIT_NOFILE": resource.RLIMIT_NOFILE, | ||
"RLIMIT_NPROC": resource.RLIMIT_NPROC, | ||
"RLIMIT_RSS": resource.RLIMIT_RSS, | ||
"RLIMIT_STACK": resource.RLIMIT_STACK, | ||
} | ||
return {label: resource.getrlimit(res) for label, res in ulimit_names.items()} |
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.
9E12
Learn more about bidirectional Unicode characters
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.