Skip to content

Commit

Permalink
Update files
Browse files Browse the repository at this point in the history
Add unit tests

Signed-off-by: Balaji Veeramani <[email protected]>
  • Loading branch information
bveeramani committed Aug 14, 2023
1 parent 42d0ea8 commit 304344d
Show file tree
Hide file tree
Showing 99 changed files with 688 additions and 0 deletions.
Binary file added 90880f7600acc8f1648fcb9562e21d7b9b19fa8f.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/0.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions images/10.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/100.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/1000005.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/1000006.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/1000007.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/1000009.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/1000010.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/1000021.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/1000023.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/1000025.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/1000026.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/100003.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/1000030.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/1000032.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/1000035.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/1000036.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/1000039.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/1000041.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/1000044.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/1000046.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/1000047.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/1000048.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/1000049.jpg
Binary file added images/1000050.jpg
Binary file added images/1000058.jpg
Binary file added images/1000059.jpg
Binary file added images/1000060.jpg
Binary file added images/1000061.jpg
Binary file added images/1000062.jpg
Binary file added images/1000063.jpg
Binary file added images/1000064.jpg
Binary file added images/1000066.jpg
Binary file added images/1000071.jpg
Binary file added images/1000072.jpg
Binary file added images/1000073.jpg
Binary file added images/1000078.jpg
Binary file added images/1000079.jpg
Binary file added images/1000081.jpg
Binary file added images/1000082.jpg
Binary file added images/1000083.jpg
Binary file added images/100009.jpg
Binary file added images/1000090.jpg
Binary file added images/1000093.jpg
Binary file added images/1000096.jpg
Binary file added images/1000097.jpg
Binary file added images/1000098.jpg
Binary file added images/1000099.jpg
Binary file added images/1000101.jpg
Binary file added images/1000109.jpg
Binary file added images/1000115.jpg
Binary file added images/1000116.jpg
1 change: 1 addition & 0 deletions images/1000117.jpg
Binary file added images/1000122.jpg
Binary file added images/1000125.jpg
Binary file added images/1000129.jpg
Binary file added images/1000132.jpg
Binary file added images/1000137.jpg
Binary file added images/1000140.jpg
Binary file added images/1000145.jpg
Binary file added images/1000147.jpg
Binary file added images/1000150.jpg
Binary file added images/1000155.jpg
Binary file added images/1000165.jpg
Binary file added images/1000166.jpg
Binary file added images/1000169.jpg
Binary file added images/1000170.jpg
640 changes: 640 additions & 0 deletions images/1000173.jpg

Large diffs are not rendered by default.

Binary file added images/1000175.jpg
Binary file added images/1000180.jpg
Binary file added images/1000183.jpg
Binary file added images/1000184.jpg
Binary file added images/1000185.jpg
Binary file added images/1000186.jpg
Binary file added images/1000187.jpg
Binary file added images/100019.jpg
Binary file added images/1000191.jpg
Binary file added images/1000192.jpg
Binary file added images/1000194.jpg
Binary file added images/1000197.jpg
Binary file added images/1000198.jpg
Binary file added images/10002.jpg
Binary file added images/100020.jpg
Binary file added images/100021.jpg
Binary file added images/100022.jpg
Binary file added images/100024.jpg
Binary file added images/100025.jpg
Binary file added images/100027.jpg
Binary file added images/100028.jpg
Binary file added images/10003.jpg
Binary file added images/100030.jpg
Binary file added images/100032.jpg
Binary file added images/100033.jpg
Binary file added images/10004.jpg
1 change: 1 addition & 0 deletions images/10005.jpg
Binary file added images/10016.jpg
38 changes: 38 additions & 0 deletions python/ray/data/tests/test_file_based_datasource.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import pytest
import os
import ray
from typing import Any, Callable, Dict
import pyarrow
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):
f.write(b"")


@pytest.mark.parametrize("num_rows", [0, 1])
def test_write_preserves_user_directory(num_rows, tmp_path, ray_start_regular_shared):
ds = ray.data.range(num_rows)
path = os.path.join(tmp_path, "test")
os.mkdir(path) # User-created directory

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

assert os.path.isdir(path)


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)

assert os.path.isdir(path)


if __name__ == "__main__":
import sys

sys.exit(pytest.main(["-v", __file__]))

0 comments on commit 304344d

Please sign in to comment.