Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions modin/pandas/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -4505,16 +4505,18 @@ def set_backend(
normalized_backend = Backend.normalize(backend)
if normalized_backend != self_backend:
max_rows, max_cols = self._query_compiler._max_shape()
# Format the transfer string to be relatively short, but informative. Each
# backend is given an allowable width of 10 and the shape integers use the
# general format to use scientific notation when needed.
operation_str = switch_operation
if switch_operation is None:
desc = (
f"Transferring data from {self_backend} to {normalized_backend}"
+ f" with max estimated shape {max_rows}x{max_cols}"
)
else:
desc = (
f"Transferring data from {self_backend} to {normalized_backend} for"
+ f" '{switch_operation}' with max estimated shape {max_rows}x{max_cols}"
)
operation_str = ""
# Provide the switch_operation; and specifically only the method, so
# DataFrame.merge would become "merge"
desc = (
f"Transferring: {self_backend:>10.10} => {normalized_backend:<10.10} "
+ f" | {operation_str.split('.')[-1]:^10.10} | ~({max_rows:^5g},{max_cols:^5g})"
)

if ShowBackendSwitchProgress.get():
try:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -857,7 +857,7 @@ def test_progress_bar_shows_modin_pandas_for_general_functions(self):
desc = call_args[1]["desc"] # Get the 'desc' keyword argument

assert desc.startswith(
"Transferring data from Big_Data_Cloud to Small_Data_Local for 'modin.pandas.read_json'"
"Transferring: Big_Data_C => Small_Data | read_json | ~( 9 , 1 )"
)

def test_agg(self):
Expand Down
4 changes: 2 additions & 2 deletions modin/tests/pandas/test_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -422,10 +422,10 @@ def do_groupby(series):
@pytest.mark.parametrize(
"switch_operation,expected_output",
[
(None, "Transferring data from Python_Test to Pandas with max estimated shape"),
(None, "Transferring: Python_Tes => Pandas | | ~( 3 , 1 )"),
(
"test_operation",
"Transferring data from Python_Test to Pandas for 'test_operation' with max estimated shape",
"Transferring: Python_Tes => Pandas | test_opera | ~( 3 , 1 )",
),
],
)
Expand Down
Loading