Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Data] Ensure all tests use shared cluster in test_csv #48352

Merged
merged 1 commit into from
Oct 29, 2024
Merged
Changes from all commits
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
10 changes: 3 additions & 7 deletions python/ray/data/tests/test_csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -796,11 +796,7 @@ def test_csv_read_filter_non_csv_file(ray_start_regular_shared, tmp_path):
assert ds.to_pandas().equals(df)


# NOTE: The last test using the shared ray_start_regular_shared cluster must use the
# shutdown_only fixture so the shared cluster is shut down, otherwise the below
# test_write_datasink_ray_remote_args test, which uses a cluster_utils cluster, will
# fail with a double-init.
def test_csv_read_no_header(shutdown_only, tmp_path):
def test_csv_read_no_header(ray_start_regular_shared, tmp_path):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any ideas why it was not using the shared cluster before? i also looked at the test code but couldn't find any particular reason...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because there was a test (written three years ago) that depended on Ray getting shutdown. But that test isn't in this module anymore, and it calls ray.shutdown in the test itself anyway so there's no reason not to use shared clusters at this point

from pyarrow import csv

file_path = os.path.join(tmp_path, "test.csv")
Expand All @@ -814,7 +810,7 @@ def test_csv_read_no_header(shutdown_only, tmp_path):
assert df.equals(out_df)


def test_csv_read_with_column_type_specified(shutdown_only, tmp_path):
def test_csv_read_with_column_type_specified(ray_start_regular_shared, tmp_path):
from pyarrow import csv

file_path = os.path.join(tmp_path, "test.csv")
Expand Down Expand Up @@ -846,7 +842,7 @@ def test_csv_read_with_column_type_specified(shutdown_only, tmp_path):
Version(pa.__version__) < Version("7.0.0"),
reason="invalid_row_handler was added in pyarrow 7.0.0",
)
def test_csv_invalid_file_handler(shutdown_only, tmp_path):
def test_csv_invalid_file_handler(ray_start_regular_shared, tmp_path):
from pyarrow import csv

invalid_txt = "f1,f2\n2,3\nx\n4,5"
Expand Down
Loading