From 61a72a0270d5f48ff3d2b959a5637ef73b3d9d62 Mon Sep 17 00:00:00 2001 From: Daniel Treiman Date: Tue, 5 Jul 2022 18:41:41 -0700 Subject: [PATCH] Fixes flaky test - assign random dates before converting DF to a dask dataframe, otherwise the map is lazy-evaluated. (#2232) Co-authored-by: Daniel Treiman --- tests/ludwig/data/test_split.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/ludwig/data/test_split.py b/tests/ludwig/data/test_split.py index 34eff8085c1..4d663cfd7a3 100644 --- a/tests/ludwig/data/test_split.py +++ b/tests/ludwig/data/test_split.py @@ -168,8 +168,6 @@ def test_datetime_split(df_engine): npartitions = 10 df = pd.DataFrame(np.random.randint(0, 100, size=(nrows, 3)), columns=["A", "B", "C"]) - if isinstance(df_engine, DaskEngine): - df = df_engine.df_lib.from_pandas(df, npartitions=npartitions) def random_date(*args, **kwargs): start = datetime.strptime("1/1/1990 1:30 PM", "%m/%d/%Y %I:%M %p") @@ -181,6 +179,9 @@ def random_date(*args, **kwargs): df["date_col"] = df["C"].map(random_date) + if isinstance(df_engine, DaskEngine): + df = df_engine.df_lib.from_pandas(df, npartitions=npartitions) + probs = (0.7, 0.1, 0.2) split_params = { "type": "datetime",