Skip to content

Commit

Permalink
bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
gaurav274 committed Mar 30, 2023
1 parent 3a19571 commit 6ea1524
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
8 changes: 2 additions & 6 deletions eva/udfs/ndarray/open.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import numpy as np
import pandas as pd

from eva.executor.executor_utils import ExecutorError
from eva.udfs.abstract.abstract_udf import AbstractUDF


Expand All @@ -42,11 +41,8 @@ def _open(row: pd.Series) -> np.ndarray:
if path_str in self._data_cache:
data = self._data_cache[path_str]
else:
try:
data = cv2.imread(path_str)
except Exception as e:
raise ExecutorError(str(e))

data = cv2.imread(path_str)
assert data is not None, f"Failed to open file {path_str}"
self._data_cache[path_str] = data

return data
Expand Down
4 changes: 2 additions & 2 deletions test/integration_tests/test_load_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ def test_should_load_csv_in_table(self):
actual_batch.sort()

# assert the batches are equal
expected_batch = create_dummy_csv_batches()
expected_batch = next(create_dummy_csv_batches())
expected_batch.modify_column_alias("myvideocsv")
self.assertEqual(actual_batch, expected_batch)

Expand Down Expand Up @@ -448,7 +448,7 @@ def test_should_load_csv_with_columns_in_table(self):

# assert the batches are equal
select_columns = ["id", "frame_id", "video_id", "dataset_name"]
expected_batch = create_dummy_csv_batches(target_columns=select_columns)
expected_batch = next(create_dummy_csv_batches(target_columns=select_columns))
expected_batch.modify_column_alias("myvideocsv")
self.assertEqual(actual_batch, expected_batch)

Expand Down
2 changes: 1 addition & 1 deletion test/udfs/ndarray/test_open.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,5 @@ def test_open_same_path_should_use_cache(self):
mock_cv2.imread.assert_not_called()

def test_open_path_should_raise_error(self):
with self.assertRaises(ExecutorError):
with self.assertRaises(AssertionError):
self.open_instance(pd.DataFrame(["incorrect_path"]))

0 comments on commit 6ea1524

Please sign in to comment.