Repository: modin-project/modin

Issue:
Make it clearer which parameters to pass into the engine initialization regarding number of workers
We have the following warnings when initalizing an engine.

**Ray**

```bash
UserWarning: Ray execution environment not yet initialized. Initializing...
To remove this warning, run the following python code before doing dataframe operations:
import ray

ray.init()
```

**Dask**

```bash
UserWarning: Dask execution environment not yet initialized. Initializing...
To remove this warning, run the following python code before doing dataframe operations:
from distributed import Client

client = Client()
```

By default, Ray and Dask use all available cores to create workers for parallel computation but it is not always beneficial to spawn the number of workers equal to the number of CPUs. We should make it clearer which parameters to pass into the engine initialization regarding a number of workers to spawn. It would be especially useful for Dask, which creates both worker threads and processes by default.


Discussion:

Resolving patch:
diff --git a/modin/core/execution/dask/common/utils.py b/modin/core/execution/dask/common/utils.py
--- a/modin/core/execution/dask/common/utils.py
+++ b/modin/core/execution/dask/common/utils.py
@@ -24,7 +24,6 @@
     NPartitions,
 )
 from modin.core.execution.utils import set_env
-from modin.error_message import ErrorMessage
 
 
 def initialize_dask():
@@ -44,15 +43,6 @@ def _disable_warnings():
     except ValueError:
         from distributed import Client
 
-        # The indentation here is intentional, we want the code to be indented.
-        ErrorMessage.not_initialized(
-            "Dask",
-            """
-    from distributed import Client
-
-    client = Client()
-""",
-        )
         num_cpus = CpuCount.get()
         memory_limit = Memory.get()
         worker_memory_limit = memory_limit // num_cpus if memory_limit else "auto"
diff --git a/modin/core/execution/ray/common/utils.py b/modin/core/execution/ray/common/utils.py
--- a/modin/core/execution/ray/common/utils.py
+++ b/modin/core/execution/ray/common/utils.py
@@ -118,15 +118,6 @@ def initialize_ray(
                 **extra_init_kw,
             )
         else:
-            # 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()])})
-""",
-            )
             object_store_memory = _get_object_store_memory()
             ray_init_kwargs = {
                 "num_cpus": CpuCount.get(),
diff --git a/modin/core/execution/unidist/common/utils.py b/modin/core/execution/unidist/common/utils.py
--- a/modin/core/execution/unidist/common/utils.py
+++ b/modin/core/execution/unidist/common/utils.py
@@ -17,7 +17,6 @@
 import unidist.config as unidist_cfg
 
 import modin.config as modin_cfg
-from modin.error_message import ErrorMessage
 
 from .engine_wrapper import UnidistWrapper
 
@@ -36,15 +35,6 @@ def initialize_unidist():
         modin_cfg.CpuCount.subscribe(
             lambda cpu_count: unidist_cfg.CpuCount.put(cpu_count.get())
         )
-        # This string is intentionally formatted this way. We want it indented in
-        # the warning message.
-        ErrorMessage.not_initialized(
-            "unidist",
-            """
-            import unidist
-            unidist.init()
-            """,
-        )
         unidist_cfg.MpiRuntimeEnv.put(
             {"env_vars": {"PYTHONWARNINGS": "ignore::FutureWarning"}}
         )


Test patch: