From 5fd77f945787c36540cd113cf3094e1c6d4be86e Mon Sep 17 00:00:00 2001 From: "Igoshev, Iaroslav" Date: Fri, 2 Feb 2024 19:22:30 +0000 Subject: [PATCH] FEAT-#6908: Make it clearer which parameters to pass into the engine initialization Signed-off-by: Igoshev, Iaroslav --- modin/core/execution/dask/common/utils.py | 8 ++++++-- modin/core/execution/ray/common/utils.py | 10 +++++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/modin/core/execution/dask/common/utils.py b/modin/core/execution/dask/common/utils.py index 3eda2a50375..d6b0b16a83f 100644 --- a/modin/core/execution/dask/common/utils.py +++ b/modin/core/execution/dask/common/utils.py @@ -50,7 +50,7 @@ def _disable_warnings(): """ from distributed import Client - client = Client() + client = Client(n_workers=, threads_per_worker=) """, ) num_cpus = CpuCount.get() @@ -59,7 +59,11 @@ def _disable_warnings(): # when the client is initialized, environment variables are inherited with set_env(PYTHONWARNINGS="ignore::FutureWarning"): - client = Client(n_workers=num_cpus, memory_limit=worker_memory_limit) + client = Client( + n_workers=num_cpus, + threads_per_worker=1, + memory_limit=worker_memory_limit, + ) if GithubCI.get(): # set these keys to run tests that write to the mock s3 service. this seems diff --git a/modin/core/execution/ray/common/utils.py b/modin/core/execution/ray/common/utils.py index 0e79d3da0a8..b98bc019652 100644 --- a/modin/core/execution/ray/common/utils.py +++ b/modin/core/execution/ray/common/utils.py @@ -118,13 +118,21 @@ def initialize_ray( **extra_init_kw, ) else: + init_params_str = "num_cpus=" + if extra_init_kw: + init_params_str = ( + init_params_str + + ", " + + ", ".join([f"{k}={v}" for k, v in extra_init_kw.items()]) + ) # This string is intentionally formatted this way. We want it indented in # the warning message. ErrorMessage.not_initialized( "Ray", f""" import ray - ray.init({', '.join([f'{k}={v}' for k,v in extra_init_kw.items()])}) + + ray.init({init_params_str}) """, ) object_store_memory = _get_object_store_memory()