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] Add Datasource.on_write_start #38298

Merged
merged 18 commits into from
Aug 14, 2023
Merged
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
Prev Previous commit
Next Next commit
Update files
Appease lint

Signed-off-by: Balaji Veeramani <[email protected]>
  • Loading branch information
bveeramani committed Aug 14, 2023
commit 8532a6ad8487e67e04c496bb7f0ed12af5ec53fb
17 changes: 11 additions & 6 deletions python/ray/data/tests/test_file_based_datasource.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
import pytest
import os
import ray
from typing import Any, Callable, Dict

import pyarrow
import pytest

import ray
from ray.data.block import BlockAccessor
from ray.data.datasource import FileBasedDatasource

class MockFileBasedDatasource(FileBasedDatasource):

def _write_block(self, f: "pyarrow.NativeFile", block: BlockAccessor, **writer_args):
class MockFileBasedDatasource(FileBasedDatasource):
def _write_block(
self, f: "pyarrow.NativeFile", block: BlockAccessor, **writer_args
):
f.write(b"")


Expand All @@ -27,7 +30,9 @@ def test_write_creates_dir(tmp_path, ray_start_regular_shared):
ds = ray.data.range(1)
path = os.path.join(tmp_path, "test")

ds.write_datasource(MockFileBasedDatasource(), dataset_uuid=ds._uuid, path=path, try_create_dir=True)
ds.write_datasource(
MockFileBasedDatasource(), dataset_uuid=ds._uuid, path=path, try_create_dir=True
)

assert os.path.isdir(path)

Expand Down