From 3d17773f1061ccdd899200d6e8a2b6686d687a71 Mon Sep 17 00:00:00 2001 From: Michael Akerman Date: Mon, 22 Jul 2024 19:26:25 +0200 Subject: [PATCH] Add tests for FIX-#7346 Signed-off-by: Michael Akerman --- .../storage_formats/pandas/test_internals.py | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/modin/tests/core/storage_formats/pandas/test_internals.py b/modin/tests/core/storage_formats/pandas/test_internals.py index 4113f3ce0ed..2cf8d5843ae 100644 --- a/modin/tests/core/storage_formats/pandas/test_internals.py +++ b/modin/tests/core/storage_formats/pandas/test_internals.py @@ -2784,3 +2784,23 @@ def dataframe_test_default_property(df): match="> is not currently supported", ): pd.DataFrame([[1]]).dataframe_test_default_property + +def test_daemonic_worker_protection(): + # Test for issue #7346, wherein some operations on Dask cause a second submission of a task to + # the Dask client from the worker scope, which should not cause a new client to be created + + def submission_triggering_row_operation(row): + row_to_dict = row.to_dict() + dict_to_row = pd.Series(row_to_dict) + return dict_to_row + + df = pd.DataFrame( + { + "A": ["a", "b", "c", "d"], + "B": [1, 2, 3, 4], + "C": [1, 2, 3, 4], + "D": [1, 2, 3, 4], + } + ) + + df = df.apply(submission_triggering_row_operation, axis=1) \ No newline at end of file