Skip to content

Commit 83d7369

Browse files
committed
FEAT-#7647 Shorten the hybrid progress bar text
- Make it fixed width - Format row/col estimates with general formatting and limit to 6 characters - Trim the operation name if needed, prefer the method over the object
1 parent fd2fb44 commit 83d7369

File tree

3 files changed

+14
-12
lines changed

3 files changed

+14
-12
lines changed

modin/pandas/base.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4505,16 +4505,18 @@ def set_backend(
45054505
normalized_backend = Backend.normalize(backend)
45064506
if normalized_backend != self_backend:
45074507
max_rows, max_cols = self._query_compiler._max_shape()
4508+
# Format the transfer string to be relatively short, but informative. Each
4509+
# backend is given an allowable width of 10 and the shape integers use the
4510+
# general format to use scientific notation when needed.
4511+
operation_str = switch_operation
45084512
if switch_operation is None:
4509-
desc = (
4510-
f"Transferring data from {self_backend} to {normalized_backend}"
4511-
+ f" with max estimated shape {max_rows}x{max_cols}"
4512-
)
4513-
else:
4514-
desc = (
4515-
f"Transferring data from {self_backend} to {normalized_backend} for"
4516-
+ f" '{switch_operation}' with max estimated shape {max_rows}x{max_cols}"
4517-
)
4513+
operation_str = ""
4514+
# Provide the switch_operation; and specifically only the method, so
4515+
# DataFrame.merge would become "merge"
4516+
desc = (
4517+
f"Transferring: {self_backend:>10.10} => {normalized_backend:<10.10} "
4518+
+ f" | {operation_str.split('.')[-1]:^10.10} | ~({max_rows:^5g},{max_cols:^5g})"
4519+
)
45184520

45194521
if ShowBackendSwitchProgress.get():
45204522
try:

modin/tests/pandas/native_df_interoperability/test_compiler_caster.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -857,7 +857,7 @@ def test_progress_bar_shows_modin_pandas_for_general_functions(self):
857857
desc = call_args[1]["desc"] # Get the 'desc' keyword argument
858858

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

863863
def test_agg(self):

modin/tests/pandas/test_backend.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -422,10 +422,10 @@ def do_groupby(series):
422422
@pytest.mark.parametrize(
423423
"switch_operation,expected_output",
424424
[
425-
(None, "Transferring data from Python_Test to Pandas with max estimated shape"),
425+
(None, "Transferring: Python_Tes => Pandas | | ~( 3 , 1 )"),
426426
(
427427
"test_operation",
428-
"Transferring data from Python_Test to Pandas for 'test_operation' with max estimated shape",
428+
"Transferring: Python_Tes => Pandas | test_opera | ~( 3 , 1 )",
429429
),
430430
],
431431
)

0 commit comments

Comments
 (0)