Repository: modin-project/modin

Issue:
REFACTOR: move SignalActor from utils.py into task_wrapper.py
Initial [suggestion](https://github.com/modin-project/modin/pull/3575#discussion_r754039953).

The new location for the class will better match based on the file description (file docstring).



Discussion:

Resolving patch:
diff --git a/modin/core/execution/ray/common/task_wrapper.py b/modin/core/execution/ray/common/task_wrapper.py
--- a/modin/core/execution/ray/common/task_wrapper.py
+++ b/modin/core/execution/ray/common/task_wrapper.py
@@ -17,6 +17,8 @@
 To be used as a piece of building a Ray-based engine.
 """
 
+import asyncio
+
 import ray
 
 
@@ -80,3 +82,54 @@ def materialize(cls, obj_id):
             Whatever was identified by `obj_id`.
         """
         return ray.get(obj_id)
+
+
+@ray.remote
+class SignalActor:  # pragma: no cover
+    """
+    Help synchronize across tasks and actors on cluster.
+
+    For details see: https://docs.ray.io/en/latest/advanced.html?highlight=signalactor#multi-node-synchronization-using-an-actor
+
+    Parameters
+    ----------
+    event_count : int
+        Number of events required for synchronization.
+    """
+
+    def __init__(self, event_count: int):
+        self.events = [asyncio.Event() for _ in range(event_count)]
+
+    def send(self, event_idx: int):
+        """
+        Indicate that event with `event_idx` has occured.
+
+        Parameters
+        ----------
+        event_idx : int
+        """
+        self.events[event_idx].set()
+
+    async def wait(self, event_idx: int):
+        """
+        Wait until event with `event_idx` has occured.
+
+        Parameters
+        ----------
+        event_idx : int
+        """
+        await self.events[event_idx].wait()
+
+    def is_set(self, event_idx: int) -> bool:
+        """
+        Check that event with `event_idx` had occured or not.
+
+        Parameters
+        ----------
+        event_idx : int
+
+        Returns
+        -------
+        bool
+        """
+        return self.events[event_idx].is_set()
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
@@ -17,7 +17,6 @@
 import sys
 import psutil
 import warnings
-import asyncio
 
 import ray
 
@@ -206,54 +205,3 @@ def initialize_ray(
         NPartitions._put(num_gpus)
     else:
         NPartitions._put(num_cpus)
-
-
-@ray.remote
-class SignalActor:  # pragma: no cover
-    """
-    Help synchronize across tasks and actors on cluster.
-
-    For details see: https://docs.ray.io/en/latest/advanced.html?highlight=signalactor#multi-node-synchronization-using-an-actor
-
-    Parameters
-    ----------
-    event_count : int
-        Number of events required for synchronization.
-    """
-
-    def __init__(self, event_count: int):
-        self.events = [asyncio.Event() for _ in range(event_count)]
-
-    def send(self, event_idx: int):
-        """
-        Indicate that event with `event_idx` has occured.
-
-        Parameters
-        ----------
-        event_idx : int
-        """
-        self.events[event_idx].set()
-
-    async def wait(self, event_idx: int):
-        """
-        Wait until event with `event_idx` has occured.
-
-        Parameters
-        ----------
-        event_idx : int
-        """
-        await self.events[event_idx].wait()
-
-    def is_set(self, event_idx: int) -> bool:
-        """
-        Check that event with `event_idx` had occured or not.
-
-        Parameters
-        ----------
-        event_idx : int
-
-        Returns
-        -------
-        bool
-        """
-        return self.events[event_idx].is_set()
diff --git a/modin/core/execution/ray/generic/io/io.py b/modin/core/execution/ray/generic/io/io.py
--- a/modin/core/execution/ray/generic/io/io.py
+++ b/modin/core/execution/ray/generic/io/io.py
@@ -18,7 +18,7 @@
 import pandas
 
 from modin.core.io import BaseIO
-from modin.core.execution.ray.common.utils import SignalActor
+from modin.core.execution.ray.common.task_wrapper import SignalActor
 import ray
 
 


Test patch: