diff --git a/eva/udfs/udf_bootstrap_queries.py b/eva/udfs/udf_bootstrap_queries.py index 5947d7775d..805fd7399e 100644 --- a/eva/udfs/udf_bootstrap_queries.py +++ b/eva/udfs/udf_bootstrap_queries.py @@ -182,7 +182,6 @@ def init_builtin_udfs(mode="debug"): Open_udf_query, Similarity_udf_query # Disabled because required packages (eg., easy_ocr might not be preinstalled) - # YoloV5_udf_query, # face_detection_udf_query, # ocr_udf_query, # Disabled as it requires specific pytorch package @@ -196,5 +195,8 @@ def init_builtin_udfs(mode="debug"): ] ) + if mode != "minimal": + queries.extend([YoloV5_udf_query]) + for query in queries: execute_query_fetch_all(query) diff --git a/test/benchmark_tests/conftest.py b/test/benchmark_tests/conftest.py index 8f590bba5c..79f4b4fa48 100644 --- a/test/benchmark_tests/conftest.py +++ b/test/benchmark_tests/conftest.py @@ -12,7 +12,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -from test.util import load_inbuilt_udfs +from test.util import load_udfs_for_testing import pytest @@ -25,7 +25,7 @@ def setup_pytorch_tests(): CatalogManager().reset() execute_query_fetch_all("LOAD VIDEO 'data/ua_detrac/ua_detrac.mp4' INTO MyVideo;") execute_query_fetch_all("LOAD VIDEO 'data/mnist/mnist.mp4' INTO MNIST;") - load_inbuilt_udfs() + load_udfs_for_testing() from eva.udfs.udf_bootstrap_queries import YoloV5_udf_query execute_query_fetch_all(YoloV5_udf_query) diff --git a/test/integration_tests/test_array_count.py b/test/integration_tests/test_array_count.py index 50e67972e0..f8ada49c7d 100644 --- a/test/integration_tests/test_array_count.py +++ b/test/integration_tests/test_array_count.py @@ -13,7 +13,12 @@ # See the License for the specific language governing permissions and # limitations under the License. import unittest -from test.util import NUM_FRAMES, create_sample_video, file_remove, load_inbuilt_udfs +from test.util import ( + NUM_FRAMES, + create_sample_video, + file_remove, + load_udfs_for_testing, +) import pandas as pd import pytest @@ -31,7 +36,7 @@ def setUpClass(cls): video_file_path = create_sample_video(NUM_FRAMES) load_query = f"LOAD VIDEO '{video_file_path}' INTO MyVideo;" execute_query_fetch_all(load_query) - load_inbuilt_udfs() + load_udfs_for_testing(mode="minimal") @classmethod def tearDownClass(cls): diff --git a/test/integration_tests/test_create_index_executor.py b/test/integration_tests/test_create_index_executor.py index 75f69b6a82..2c0045a2e7 100644 --- a/test/integration_tests/test_create_index_executor.py +++ b/test/integration_tests/test_create_index_executor.py @@ -15,7 +15,7 @@ import os import unittest from pathlib import Path -from test.util import load_inbuilt_udfs +from test.util import load_udfs_for_testing import faiss import numpy as np @@ -53,8 +53,7 @@ def setUpClass(cls): # Reset catalog. CatalogManager().reset() - - load_inbuilt_udfs() + load_udfs_for_testing(mode="minimal") # Create feature vector table and raw input table. feat1 = np.array([[0, 0, 0]]).astype(np.float32) diff --git a/test/integration_tests/test_delete_executor.py b/test/integration_tests/test_delete_executor.py index 820154192f..8749bfc41d 100644 --- a/test/integration_tests/test_delete_executor.py +++ b/test/integration_tests/test_delete_executor.py @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. import unittest -from test.util import file_remove, load_inbuilt_udfs +from test.util import file_remove, load_udfs_for_testing import numpy as np import pytest @@ -32,8 +32,7 @@ def setUp(self): # Reset catalog. CatalogManager().reset() - - load_inbuilt_udfs() + load_udfs_for_testing(mode="minimal") create_table_query = """ CREATE TABLE IF NOT EXISTS testDeleteOne diff --git a/test/integration_tests/test_explain_executor.py b/test/integration_tests/test_explain_executor.py index 4e3de498e3..3fa4e434b4 100644 --- a/test/integration_tests/test_explain_executor.py +++ b/test/integration_tests/test_explain_executor.py @@ -13,7 +13,12 @@ # See the License for the specific language governing permissions and # limitations under the License. import unittest -from test.util import create_sample_video, create_table, file_remove, load_inbuilt_udfs +from test.util import ( + create_sample_video, + create_table, + file_remove, + load_udfs_for_testing, +) import pytest @@ -39,7 +44,7 @@ def setUpClass(cls): video_file_path = create_sample_video(NUM_FRAMES) load_query = f"LOAD VIDEO '{video_file_path}' INTO MyVideo;" execute_query_fetch_all(load_query) - load_inbuilt_udfs() + load_udfs_for_testing(mode="minimal") cls.table1 = create_table("table1", 100, 3) cls.table2 = create_table("table2", 500, 3) cls.table3 = create_table("table3", 1000, 3) diff --git a/test/integration_tests/test_insert_executor.py b/test/integration_tests/test_insert_executor.py index 111fc32a57..855ed30593 100644 --- a/test/integration_tests/test_insert_executor.py +++ b/test/integration_tests/test_insert_executor.py @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. import unittest -from test.util import create_sample_video, file_remove, load_inbuilt_udfs +from test.util import create_sample_video, file_remove, load_udfs_for_testing import numpy as np import pandas as pd @@ -37,8 +37,7 @@ def setUp(self): ); """ execute_query_fetch_all(query) - - load_inbuilt_udfs() + load_udfs_for_testing(mode="minimal") def tearDown(self): file_remove("dummy.avi") diff --git a/test/integration_tests/test_mat_executor.py b/test/integration_tests/test_mat_executor.py index 5b15aa5836..05d213087d 100644 --- a/test/integration_tests/test_mat_executor.py +++ b/test/integration_tests/test_mat_executor.py @@ -17,7 +17,7 @@ DummyObjectDetector, create_sample_video, file_remove, - load_inbuilt_udfs, + load_udfs_for_testing, ) import pandas as pd @@ -42,10 +42,7 @@ def setUpClass(cls): execute_query_fetch_all(load_query) ua_detrac = f"{EVA_ROOT_DIR}/data/ua_detrac/ua_detrac.mp4" execute_query_fetch_all(f"LOAD VIDEO '{ua_detrac}' INTO UATRAC;") - load_inbuilt_udfs() - from eva.udfs.udf_bootstrap_queries import YoloV5_udf_query - - execute_query_fetch_all(YoloV5_udf_query) + load_udfs_for_testing() @classmethod def tearDownClass(cls): diff --git a/test/integration_tests/test_open.py b/test/integration_tests/test_open.py index 7dca132b2e..9d3ed7def1 100644 --- a/test/integration_tests/test_open.py +++ b/test/integration_tests/test_open.py @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. import unittest -from test.util import create_sample_image, file_remove, load_inbuilt_udfs +from test.util import create_sample_image, file_remove, load_udfs_for_testing import numpy as np import pandas as pd @@ -32,7 +32,7 @@ def setUp(self): CatalogManager().reset() ConfigurationManager() # Load built-in UDFs. - load_inbuilt_udfs() + load_udfs_for_testing(mode="minimal") # Insert image path. self.img_path = create_sample_image() diff --git a/test/integration_tests/test_optimizer_rules.py b/test/integration_tests/test_optimizer_rules.py index 4c5d75791f..72247fca48 100644 --- a/test/integration_tests/test_optimizer_rules.py +++ b/test/integration_tests/test_optimizer_rules.py @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. import unittest -from test.util import get_physical_query_plan, load_inbuilt_udfs +from test.util import get_physical_query_plan, load_udfs_for_testing import pytest from mock import MagicMock, patch @@ -42,7 +42,7 @@ def setUpClass(cls): ua_detrac = f"{EVA_ROOT_DIR}/data/ua_detrac/ua_detrac.mp4" execute_query_fetch_all(f"LOAD VIDEO '{ua_detrac}' INTO MyVideo;") execute_query_fetch_all(f"LOAD VIDEO '{ua_detrac}' INTO MyVideo2;") - load_inbuilt_udfs() + load_udfs_for_testing(mode="minimal") @classmethod def tearDownClass(cls): diff --git a/test/integration_tests/test_pytorch.py b/test/integration_tests/test_pytorch.py index b084e12efa..4256ad6a50 100644 --- a/test/integration_tests/test_pytorch.py +++ b/test/integration_tests/test_pytorch.py @@ -15,7 +15,7 @@ import os import unittest from test.markers import windows_skip_marker -from test.util import file_remove, load_inbuilt_udfs +from test.util import file_remove, load_udfs_for_testing import cv2 import numpy as np @@ -50,10 +50,7 @@ def setUpClass(cls): execute_query_fetch_all(f"LOAD VIDEO '{asl_actions}' INTO Asl_actions;") execute_query_fetch_all(f"LOAD IMAGE '{meme1}' INTO MemeImages;") execute_query_fetch_all(f"LOAD IMAGE '{meme2}' INTO MemeImages;") - load_inbuilt_udfs() - from eva.udfs.udf_bootstrap_queries import YoloV5_udf_query - - execute_query_fetch_all(YoloV5_udf_query) + load_udfs_for_testing() @classmethod def tearDownClass(cls): diff --git a/test/integration_tests/test_select_executor.py b/test/integration_tests/test_select_executor.py index bd779449c8..ce1beced6e 100644 --- a/test/integration_tests/test_select_executor.py +++ b/test/integration_tests/test_select_executor.py @@ -20,7 +20,7 @@ create_table, file_remove, get_logical_query_plan, - load_inbuilt_udfs, + load_udfs_for_testing, ) import numpy as np @@ -48,10 +48,7 @@ def setUpClass(cls): ua_detrac = f"{EVA_ROOT_DIR}/data/ua_detrac/ua_detrac.mp4" load_query = f"LOAD VIDEO '{ua_detrac}' INTO DETRAC;" execute_query_fetch_all(load_query) - load_inbuilt_udfs() - from eva.udfs.udf_bootstrap_queries import YoloV5_udf_query - - execute_query_fetch_all(YoloV5_udf_query) + load_udfs_for_testing() cls.table1 = create_table("table1", 100, 3) cls.table2 = create_table("table2", 500, 3) cls.table3 = create_table("table3", 1000, 3) diff --git a/test/integration_tests/test_similarity.py b/test/integration_tests/test_similarity.py index 65e1b2b3ad..d2dc39725c 100644 --- a/test/integration_tests/test_similarity.py +++ b/test/integration_tests/test_similarity.py @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. import unittest -from test.util import create_sample_image, load_inbuilt_udfs +from test.util import create_sample_image, load_udfs_for_testing import numpy as np import pandas as pd @@ -31,7 +31,7 @@ def setUp(self): CatalogManager().reset() # Prepare needed UDFs and data_col. - load_inbuilt_udfs() + load_udfs_for_testing(mode="minimal") self.img_path = create_sample_image() # Create base comparison table. diff --git a/test/optimizer/rules/test_rules.py b/test/optimizer/rules/test_rules.py index f6b31f9474..9fe80a6d39 100644 --- a/test/optimizer/rules/test_rules.py +++ b/test/optimizer/rules/test_rules.py @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. import unittest -from test.util import create_sample_video, load_inbuilt_udfs +from test.util import create_sample_video, load_udfs_for_testing import pytest from mock import MagicMock, patch @@ -84,7 +84,7 @@ def setUpClass(cls): video_file_path = create_sample_video() load_query = f"LOAD VIDEO '{video_file_path}' INTO MyVideo;" execute_query_fetch_all(load_query) - load_inbuilt_udfs() + load_udfs_for_testing(mode="minimal") @classmethod def tearDownClass(cls): diff --git a/test/util.py b/test/util.py index ba677c1fea..10f59e30a3 100644 --- a/test/util.py +++ b/test/util.py @@ -416,8 +416,9 @@ def create_dummy_4d_batches( yield Batch(df) -def load_inbuilt_udfs(): - mode = ConfigurationManager().get_value("core", "mode") +def load_udfs_for_testing(mode="debug"): + # DEBUG OR RELEASE MODE: ALL UDFs + # MINIMAL MODE: NO YOLO init_builtin_udfs(mode=mode)