Skip to content

Commit

Permalink
REFACTOR-#7271: Remove instance_type attribute of axis partitions (#…
Browse files Browse the repository at this point in the history
…7268)

Signed-off-by: Anatoly Myachev <anatoly.myachev@intel.com>
  • Loading branch information
anmyachev committed May 15, 2024
1 parent 51b0a78 commit 8a62c3b
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 14 deletions.
6 changes: 2 additions & 4 deletions modin/core/dataframe/base/partitioning/axis_partition.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"""Base class of an axis partition for a Modin Dataframe."""

from abc import ABC, abstractmethod
from typing import Any, Callable, Iterable, Optional, Tuple, Union
from typing import Any, Callable, Iterable, Optional, Tuple, Type, Union

from modin.logging import ClassLogger
from modin.logging.config import LogLevel
Expand Down Expand Up @@ -95,8 +95,7 @@ def apply(
pass

# Child classes must have these in order to correctly subclass.
instance_type = None
partition_type = None
partition_type: Type
_PARTITIONS_METADATA_LEN = 0

def _wrap_partitions(
Expand All @@ -119,7 +118,6 @@ def _wrap_partitions(
List of wrapped remote partition objects.
"""
assert self.partition_type is not None
assert self.instance_type is not None # type: ignore

if extract_metadata is None:
# If `_PARTITIONS_METADATA_LEN == 0` then the execution doesn't support metadata
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"""Module houses classes responsible for storing a virtual partition and applying a function to it."""

import pandas
from distributed import Future
from distributed.utils import get_ip

from modin.core.dataframe.pandas.partitioning.axis_partition import (
Expand Down Expand Up @@ -51,7 +50,6 @@ class PandasOnDaskDataframeVirtualPartition(PandasDataframeAxisPartition):
axis = None
_PARTITIONS_METADATA_LEN = 3 # (length, width, ip)
partition_type = PandasOnDaskDataframePartition
instance_type = Future

@property
def list_of_ips(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@

"""The module defines interface for a virtual partition with pandas storage format and python engine."""

import pandas

from modin.core.dataframe.pandas.partitioning.axis_partition import (
PandasDataframeAxisPartition,
)
Expand Down Expand Up @@ -48,7 +46,6 @@ class PandasOnPythonDataframeAxisPartition(PandasDataframeAxisPartition):
"""

partition_type = PandasOnPythonDataframePartition
instance_type = pandas.DataFrame


@_inherit_docstrings(PandasOnPythonDataframeAxisPartition.__init__)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@

"""Module houses classes of axis partitions implemented using Ray and cuDF."""

import cudf

from modin.core.execution.ray.common import RayWrapper

from .partition import cuDFOnRayDataframePartition
Expand All @@ -34,7 +32,6 @@ def __init__(self, partitions):
self.partitions = [obj for obj in partitions]

partition_type = cuDFOnRayDataframePartition
instance_type = cudf.DataFrame


class cuDFOnRayDataframeColumnPartition(cuDFOnRayDataframeAxisPartition):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ class PandasOnRayDataframeVirtualPartition(PandasDataframeAxisPartition):

_PARTITIONS_METADATA_LEN = 3 # (length, width, ip)
partition_type = PandasOnRayDataframePartition
instance_type = ray.ObjectRef
axis = None

# these variables are intentionally initialized at runtime (see #6023)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ class PandasOnUnidistDataframeVirtualPartition(PandasDataframeAxisPartition):

_PARTITIONS_METADATA_LEN = 3 # (length, width, ip)
partition_type = PandasOnUnidistDataframePartition
instance_type = unidist.core.base.object_ref.ObjectRef
axis = None

# these variables are intentionally initialized at runtime (see #6023)
Expand Down

0 comments on commit 8a62c3b

Please sign in to comment.