Skip to content

Commit

Permalink
FEAT-modin-project#6908: Make it clearer which parameters to pass int…
Browse files Browse the repository at this point in the history
…o the engine initialization

Signed-off-by: Igoshev, Iaroslav <[email protected]>
  • Loading branch information
YarShev committed Feb 2, 2024
1 parent abbbd03 commit 5fd77f9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
8 changes: 6 additions & 2 deletions modin/core/execution/dask/common/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def _disable_warnings():
"""
from distributed import Client
client = Client()
client = Client(n_workers=<N1>, threads_per_worker=<N2>)
""",
)
num_cpus = CpuCount.get()
Expand All @@ -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
Expand Down
10 changes: 9 additions & 1 deletion modin/core/execution/ray/common/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,21 @@ def initialize_ray(
**extra_init_kw,
)
else:
init_params_str = "num_cpus=<N>"
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()
Expand Down

0 comments on commit 5fd77f9

Please sign in to comment.