mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-13 09:52:38 +00:00
Limit the docker memory to {HOST_MEM-2G}
This commit is contained in:
parent
e5561fcdb6
commit
90d655dd96
@ -15,7 +15,7 @@ import sys
|
||||
from integration_test_images import get_docker_env
|
||||
|
||||
|
||||
def random_str(length=6):
|
||||
def random_str(length: int = 6) -> str:
|
||||
alphabet = string.ascii_lowercase + string.digits
|
||||
return "".join(random.SystemRandom().choice(alphabet) for _ in range(length))
|
||||
|
||||
@ -33,6 +33,15 @@ UTILS_DIR_IN_REPO = "utils"
|
||||
DIND_INTEGRATION_TESTS_IMAGE_NAME = "clickhouse/integration-tests-runner"
|
||||
|
||||
|
||||
def physical_memory() -> int:
|
||||
try:
|
||||
# for linux
|
||||
return os.sysconf("SC_PAGE_SIZE") * os.sysconf("SC_PHYS_PAGES")
|
||||
except ValueError:
|
||||
# for MacOS
|
||||
return int(subprocess.check_output(["sysctl", "-n", "hw.memsize"]).strip())
|
||||
|
||||
|
||||
def check_args_and_update_paths(args):
|
||||
if args.clickhouse_root:
|
||||
if not os.path.isabs(args.clickhouse_root):
|
||||
@ -469,6 +478,7 @@ if __name__ == "__main__":
|
||||
cmd_base = (
|
||||
f"docker run {net} {tty} --rm --name {CONTAINER_NAME} "
|
||||
"--privileged --dns-search='.' " # since recent dns search leaks from host
|
||||
f"--memory={physical_memory() - 2 * 1024**3} "
|
||||
f"--volume={args.odbc_bridge_binary}:/clickhouse-odbc-bridge "
|
||||
f"--volume={args.binary}:/clickhouse "
|
||||
f"--volume={args.library_bridge_binary}:/clickhouse-library-bridge "
|
||||
|
Loading…
Reference in New Issue
Block a user