Skip to content

Commit

Permalink
Reserve a constant 1GB for the system
Browse files Browse the repository at this point in the history
  • Loading branch information
jmsmkn committed Jul 3, 2024
1 parent 606936f commit 486a0ac
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "sagemaker-shim"
version = "0.3.1"
version = "0.3.2"
description = "Adapts algorithms that implement the Grand Challenge inference API for running in SageMaker"
authors = ["James Meakin <[email protected]>"]
license = "Apache-2.0"
Expand Down
5 changes: 4 additions & 1 deletion sagemaker_shim/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,12 @@ async def invoke(tasks: str, file: str) -> None:
def set_memory_limits() -> None:
total_memory_bytes = psutil.virtual_memory().total

# Reserve 1GB for the system
limit = total_memory_bytes - 1_073_741_824

resource.setrlimit(
resource.RLIMIT_AS,
(int(total_memory_bytes * 0.85), int(total_memory_bytes * 0.95)),
(limit, limit),
)


Expand Down

0 comments on commit 486a0ac

Please sign in to comment.