Repository: modin-project/modin

Issue:
REFACTOR: add `UnidistWrapper.put` implementation



Discussion:

Resolving patch:
diff --git a/modin/core/execution/unidist/common/engine_wrapper.py b/modin/core/execution/unidist/common/engine_wrapper.py
--- a/modin/core/execution/unidist/common/engine_wrapper.py
+++ b/modin/core/execution/unidist/common/engine_wrapper.py
@@ -90,6 +90,25 @@ def materialize(cls, obj_id):
         """
         return unidist.get(obj_id)
 
+    @classmethod
+    def put(cls, data, **kwargs):
+        """
+        Put data into the object store.
+
+        Parameters
+        ----------
+        data : object
+            Data to be put.
+        **kwargs : dict
+            Additional keyword arguments (mostly for compatibility).
+
+        Returns
+        -------
+        unidist.ObjectRef
+            A reference to `data`.
+        """
+        return unidist.put(data)
+
 
 @unidist.remote
 class SignalActor:  # pragma: no cover
diff --git a/modin/core/execution/unidist/implementations/pandas_on_unidist/partitioning/partition.py b/modin/core/execution/unidist/implementations/pandas_on_unidist/partitioning/partition.py
--- a/modin/core/execution/unidist/implementations/pandas_on_unidist/partitioning/partition.py
+++ b/modin/core/execution/unidist/implementations/pandas_on_unidist/partitioning/partition.py
@@ -162,8 +162,9 @@ def wait(self):
         wait([self._data])
 
     # If unidist has not been initialized yet by Modin,
-    # unidist itself handles initialization when calling `unidist.put`.
-    _iloc = unidist.put(PandasDataframePartition._iloc)
+    # unidist itself handles initialization when calling `unidist.put`,
+    # which is called inside of `UnidistWrapper.put`.
+    _iloc = execution_wrapper.put(PandasDataframePartition._iloc)
 
     def mask(self, row_labels, col_labels):
         """
@@ -218,7 +219,7 @@ def put(cls, obj):
         PandasOnUnidistDataframePartition
             A new ``PandasOnUnidistDataframePartition`` object.
         """
-        return cls(unidist.put(obj), len(obj.index), len(obj.columns))
+        return cls(cls.execution_wrapper.put(obj), len(obj.index), len(obj.columns))
 
     @classmethod
     def preprocess_func(cls, func):
@@ -235,7 +236,7 @@ def preprocess_func(cls, func):
         unidist.ObjectRef
             A reference to `func`.
         """
-        return unidist.put(func)
+        return cls.execution_wrapper.put(func)
 
     def length(self, materialize=True):
         """
diff --git a/modin/core/execution/unidist/implementations/pandas_on_unidist/partitioning/virtual_partition.py b/modin/core/execution/unidist/implementations/pandas_on_unidist/partitioning/virtual_partition.py
--- a/modin/core/execution/unidist/implementations/pandas_on_unidist/partitioning/virtual_partition.py
+++ b/modin/core/execution/unidist/implementations/pandas_on_unidist/partitioning/virtual_partition.py
@@ -20,14 +20,16 @@
     PandasDataframeAxisPartition,
 )
 from modin.core.execution.unidist.common.utils import deserialize, wait
+from modin.core.execution.unidist.common import UnidistWrapper
 from .partition import PandasOnUnidistDataframePartition
 from modin.utils import _inherit_docstrings
 
 
 # If unidist has not been initialized yet by Modin,
-# unidist itself handles initialization when calling `unidist.put`.
-_DEPLOY_AXIS_FUNC = unidist.put(PandasDataframeAxisPartition.deploy_axis_func)
-_DRAIN = unidist.put(PandasDataframeAxisPartition.drain)
+# unidist itself handles initialization when calling `unidist.put`,
+# which is called inside of `UnidistWrapper.put`.
+_DEPLOY_AXIS_FUNC = UnidistWrapper.put(PandasDataframeAxisPartition.deploy_axis_func)
+_DRAIN = UnidistWrapper.put(PandasDataframeAxisPartition.drain)
 
 
 class PandasOnUnidistDataframeVirtualPartition(PandasDataframeAxisPartition):


Test patch: