From 750e656b56c3c38600fe51be4e31499f20281ebe Mon Sep 17 00:00:00 2001 From: "Teng, David Samuel" Date: Wed, 22 Nov 2023 00:23:48 -0600 Subject: [PATCH 1/9] Fixes --- evadb/constants.py | 2 ++ evadb/functions/function_bootstrap_queries.py | 10 +++++++++- evadb/functions/trackers/nor_fair.py | 4 +++- evadb/parser/create_function_statement.py | 12 +++++++++++- 4 files changed, 25 insertions(+), 3 deletions(-) diff --git a/evadb/constants.py b/evadb/constants.py index 80777c5ab..06e3973ea 100644 --- a/evadb/constants.py +++ b/evadb/constants.py @@ -21,3 +21,5 @@ IFRAMES = "IFRAMES" AUDIORATE = "AUDIORATE" DEFAULT_FUNCTION_EXPRESSION_COST = 100 +DBFUNCTIONS = __file__[0: -13] + "/functions/" +ENVFUNCTIONS = "./Lib/site-packages/evadb/functions/" \ No newline at end of file diff --git a/evadb/functions/function_bootstrap_queries.py b/evadb/functions/function_bootstrap_queries.py index 3b5008586..58cb1b1f2 100644 --- a/evadb/functions/function_bootstrap_queries.py +++ b/evadb/functions/function_bootstrap_queries.py @@ -16,7 +16,8 @@ from evadb.configuration.constants import EvaDB_INSTALLATION_DIR from evadb.database import EvaDBDatabase from evadb.server.command_handler import execute_query_fetch_all - +#import sys +#import subprocess NDARRAY_DIR = "ndarray" TUTORIALS_DIR = "tutorials" @@ -309,6 +310,13 @@ def init_builtin_functions(db: EvaDBDatabase, mode: str = "debug") -> None: # ignore exceptions during the bootstrapping phase due to missing packages for query in queries: try: + #Uncomment to force pip installs onto local device + #import sys + #import subprocess + #subprocess.check_call([sys.executable, '-m', 'pip', 'install', 'norfair']) + #subprocess.check_call([sys.executable, '-m', 'pip', 'install', 'ultralytics']) + #subprocess.check_call([sys.executable, '-m', 'pip', 'install', 'facenet-pytorch']) + #cursor.query("DROP FUNCTION IF EXISTS NorFairTracker;").df() execute_query_fetch_all( db, query, do_not_print_exceptions=False, do_not_raise_exceptions=True ) diff --git a/evadb/functions/trackers/nor_fair.py b/evadb/functions/trackers/nor_fair.py index 0468a3c99..1c128f5e1 100644 --- a/evadb/functions/trackers/nor_fair.py +++ b/evadb/functions/trackers/nor_fair.py @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. import numpy as np - +#import sys from evadb.functions.abstract.tracker_abstract_function import ( EvaDBTrackerAbstractFunction, ) @@ -31,6 +31,8 @@ def name(self) -> str: def setup(self, distance_threshold=DISTANCE_THRESHOLD_CENTROID) -> None: # https://github.com/tryolabs/norfair/blob/74b11edde83941dd6e32bcccd5fa849e16bf8564/norfair/tracker.py#L18 try_to_import_norfair() + #sys.path.append('../norfair') + #from norfair.tracker import Tracker from norfair import Tracker self.tracker = Tracker( diff --git a/evadb/parser/create_function_statement.py b/evadb/parser/create_function_statement.py index eb35fcffa..449eba200 100644 --- a/evadb/parser/create_function_statement.py +++ b/evadb/parser/create_function_statement.py @@ -64,7 +64,17 @@ def __init__( self._if_not_exists = if_not_exists self._inputs = inputs self._outputs = outputs - self._impl_path = Path(impl_path) if impl_path else None + if impl_path: + if len(str(impl_path)) < 12: + self._impl_path = Path(impl_path) + elif "DBFUNCTIONS" == str(impl_path)[0:11] and (str(impl_path)[11:12] == "." or str(impl_path)[11:12] == "\\" or str(impl_path)[11:12] == "/"): + self._impl_path = Path(str(EvaDB_INSTALLATION_DIR) + "\\functions\\" + str(impl_path)[12:]) + elif "ENVFUNCTIONS" == str(impl_path)[0:12] and (str(impl_path)[12:13] == "." or str(impl_path)[12:13] == "\\" or str(impl_path)[12:13] == "/"): + self._impl_path = Path( "..\\functions\\" + str(impl_path)[13:]) + else: + self._impl_path = Path(impl_path) + else: + self._impl_path = None self._function_type = function_type self._query = query self._metadata = metadata From 8ceb00e0f1f51c37175064d941cfca90168d9b02 Mon Sep 17 00:00:00 2001 From: "Teng, David Samuel" Date: Wed, 22 Nov 2023 00:33:58 -0600 Subject: [PATCH 2/9] Added Import --- evadb/parser/create_function_statement.py | 1 + 1 file changed, 1 insertion(+) diff --git a/evadb/parser/create_function_statement.py b/evadb/parser/create_function_statement.py index 449eba200..8b2c68bc6 100644 --- a/evadb/parser/create_function_statement.py +++ b/evadb/parser/create_function_statement.py @@ -15,6 +15,7 @@ from pathlib import Path from typing import List, Tuple +from evadb.configuration.constants import EvaDB_INSTALLATION_DIR from evadb.parser.create_statement import ColumnDefinition from evadb.parser.select_statement import SelectStatement from evadb.parser.statement import AbstractStatement From e263632d942d04479952ebc12c37af7a3d588028 Mon Sep 17 00:00:00 2001 From: "Teng, David Samuel" Date: Sat, 25 Nov 2023 17:48:55 -0600 Subject: [PATCH 3/9] Fixed Formatting Maybe? --- evadb/constants.py | 2 ++ evadb/functions/function_bootstrap_queries.py | 12 ++++++++++-- evadb/functions/trackers/nor_fair.py | 6 ++++-- evadb/parser/create_function_statement.py | 15 +++++++++++++-- 4 files changed, 29 insertions(+), 6 deletions(-) diff --git a/evadb/constants.py b/evadb/constants.py index 80777c5ab..06e3973ea 100644 --- a/evadb/constants.py +++ b/evadb/constants.py @@ -21,3 +21,5 @@ IFRAMES = "IFRAMES" AUDIORATE = "AUDIORATE" DEFAULT_FUNCTION_EXPRESSION_COST = 100 +DBFUNCTIONS = __file__[0: -13] + "/functions/" +ENVFUNCTIONS = "./Lib/site-packages/evadb/functions/" \ No newline at end of file diff --git a/evadb/functions/function_bootstrap_queries.py b/evadb/functions/function_bootstrap_queries.py index 3b5008586..c7bfa98f1 100644 --- a/evadb/functions/function_bootstrap_queries.py +++ b/evadb/functions/function_bootstrap_queries.py @@ -16,7 +16,8 @@ from evadb.configuration.constants import EvaDB_INSTALLATION_DIR from evadb.database import EvaDBDatabase from evadb.server.command_handler import execute_query_fetch_all - +#import sys +#import subprocess NDARRAY_DIR = "ndarray" TUTORIALS_DIR = "tutorials" @@ -309,8 +310,15 @@ def init_builtin_functions(db: EvaDBDatabase, mode: str = "debug") -> None: # ignore exceptions during the bootstrapping phase due to missing packages for query in queries: try: + #Uncomment to force pip installs onto local device + #import sys + #import subprocess + #subprocess.check_call([sys.executable, '-m', 'pip', 'install', 'norfair']) + #subprocess.check_call([sys.executable, '-m', 'pip', 'install', 'ultralytics']) + #subprocess.check_call([sys.executable, '-m', 'pip', 'install', 'facenet-pytorch']) + #cursor.query("DROP FUNCTION IF EXISTS NorFairTracker;").df() execute_query_fetch_all( db, query, do_not_print_exceptions=False, do_not_raise_exceptions=True ) except Exception: - pass + pass \ No newline at end of file diff --git a/evadb/functions/trackers/nor_fair.py b/evadb/functions/trackers/nor_fair.py index 0468a3c99..107c18586 100644 --- a/evadb/functions/trackers/nor_fair.py +++ b/evadb/functions/trackers/nor_fair.py @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. import numpy as np - +#import sys from evadb.functions.abstract.tracker_abstract_function import ( EvaDBTrackerAbstractFunction, ) @@ -31,6 +31,8 @@ def name(self) -> str: def setup(self, distance_threshold=DISTANCE_THRESHOLD_CENTROID) -> None: # https://github.com/tryolabs/norfair/blob/74b11edde83941dd6e32bcccd5fa849e16bf8564/norfair/tracker.py#L18 try_to_import_norfair() + #sys.path.append('../norfair') + #from norfair.tracker import Tracker from norfair import Tracker self.tracker = Tracker( @@ -71,4 +73,4 @@ def forward(self, frame_id, frame, labels, bboxes, scores): scores.append(det[2]) ids.append(obj.id) - return np.array(ids), np.array(labels), np.array(bboxes_xyxy), np.array(scores) + return np.array(ids), np.array(labels), np.array(bboxes_xyxy), np.array(scores) \ No newline at end of file diff --git a/evadb/parser/create_function_statement.py b/evadb/parser/create_function_statement.py index eb35fcffa..4fe49cb72 100644 --- a/evadb/parser/create_function_statement.py +++ b/evadb/parser/create_function_statement.py @@ -15,6 +15,7 @@ from pathlib import Path from typing import List, Tuple +from evadb.configuration.constants import EvaDB_INSTALLATION_DIR from evadb.parser.create_statement import ColumnDefinition from evadb.parser.select_statement import SelectStatement from evadb.parser.statement import AbstractStatement @@ -64,7 +65,17 @@ def __init__( self._if_not_exists = if_not_exists self._inputs = inputs self._outputs = outputs - self._impl_path = Path(impl_path) if impl_path else None + if impl_path: + if len(str(impl_path)) < 12: + self._impl_path = Path(impl_path) + elif "DBFUNCTIONS" == str(impl_path)[0:11] and (str(impl_path)[11:12] == "." or str(impl_path)[11:12] == "\\" or str(impl_path)[11:12] == "/"): + self._impl_path = Path(str(EvaDB_INSTALLATION_DIR) + "\\functions\\" + str(impl_path)[12:]) + elif "ENVFUNCTIONS" == str(impl_path)[0:12] and (str(impl_path)[12:13] == "." or str(impl_path)[12:13] == "\\" or str(impl_path)[12:13] == "/"): + self._impl_path = Path( "..\\functions\\" + str(impl_path)[13:]) + else: + self._impl_path = Path(impl_path) + else: + self._impl_path = None self._function_type = function_type self._query = query self._metadata = metadata @@ -171,4 +182,4 @@ def __hash__(self) -> int: self.query, tuple(self.metadata), ) - ) + ) \ No newline at end of file From 7ccf77d960d51015de1d72d4228a54dd05db7a91 Mon Sep 17 00:00:00 2001 From: "Teng, David Samuel" Date: Sat, 25 Nov 2023 17:54:24 -0600 Subject: [PATCH 4/9] Dear god please format correctly --- evadb/functions/function_bootstrap_queries.py | 14 +++++++------- evadb/functions/trackers/nor_fair.py | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/evadb/functions/function_bootstrap_queries.py b/evadb/functions/function_bootstrap_queries.py index c7bfa98f1..71f690be0 100644 --- a/evadb/functions/function_bootstrap_queries.py +++ b/evadb/functions/function_bootstrap_queries.py @@ -310,13 +310,13 @@ def init_builtin_functions(db: EvaDBDatabase, mode: str = "debug") -> None: # ignore exceptions during the bootstrapping phase due to missing packages for query in queries: try: - #Uncomment to force pip installs onto local device - #import sys - #import subprocess - #subprocess.check_call([sys.executable, '-m', 'pip', 'install', 'norfair']) - #subprocess.check_call([sys.executable, '-m', 'pip', 'install', 'ultralytics']) - #subprocess.check_call([sys.executable, '-m', 'pip', 'install', 'facenet-pytorch']) - #cursor.query("DROP FUNCTION IF EXISTS NorFairTracker;").df() + # Uncomment to force pip installs onto local device + # import sys + # import subprocess + # subprocess.check_call([sys.executable, '-m', 'pip', 'install', 'norfair']) + # subprocess.check_call([sys.executable, '-m', 'pip', 'install', 'ultralytics']) + # subprocess.check_call([sys.executable, '-m', 'pip', 'install', 'facenet-pytorch']) + # cursor.query("DROP FUNCTION IF EXISTS NorFairTracker;").df() execute_query_fetch_all( db, query, do_not_print_exceptions=False, do_not_raise_exceptions=True ) diff --git a/evadb/functions/trackers/nor_fair.py b/evadb/functions/trackers/nor_fair.py index 107c18586..ce77f2af7 100644 --- a/evadb/functions/trackers/nor_fair.py +++ b/evadb/functions/trackers/nor_fair.py @@ -31,8 +31,8 @@ def name(self) -> str: def setup(self, distance_threshold=DISTANCE_THRESHOLD_CENTROID) -> None: # https://github.com/tryolabs/norfair/blob/74b11edde83941dd6e32bcccd5fa849e16bf8564/norfair/tracker.py#L18 try_to_import_norfair() - #sys.path.append('../norfair') - #from norfair.tracker import Tracker + # sys.path.append('../norfair') + # from norfair.tracker import Tracker from norfair import Tracker self.tracker = Tracker( From 5ec41535eb482dd73369bf114e7f5f32e9d69d77 Mon Sep 17 00:00:00 2001 From: "Teng, David Samuel" Date: Sat, 25 Nov 2023 19:57:03 -0600 Subject: [PATCH 5/9] Deleted comments --- evadb/functions/function_bootstrap_queries.py | 10 +--------- evadb/functions/trackers/nor_fair.py | 4 +--- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/evadb/functions/function_bootstrap_queries.py b/evadb/functions/function_bootstrap_queries.py index 71f690be0..99505f8d0 100644 --- a/evadb/functions/function_bootstrap_queries.py +++ b/evadb/functions/function_bootstrap_queries.py @@ -16,8 +16,7 @@ from evadb.configuration.constants import EvaDB_INSTALLATION_DIR from evadb.database import EvaDBDatabase from evadb.server.command_handler import execute_query_fetch_all -#import sys -#import subprocess + NDARRAY_DIR = "ndarray" TUTORIALS_DIR = "tutorials" @@ -310,13 +309,6 @@ def init_builtin_functions(db: EvaDBDatabase, mode: str = "debug") -> None: # ignore exceptions during the bootstrapping phase due to missing packages for query in queries: try: - # Uncomment to force pip installs onto local device - # import sys - # import subprocess - # subprocess.check_call([sys.executable, '-m', 'pip', 'install', 'norfair']) - # subprocess.check_call([sys.executable, '-m', 'pip', 'install', 'ultralytics']) - # subprocess.check_call([sys.executable, '-m', 'pip', 'install', 'facenet-pytorch']) - # cursor.query("DROP FUNCTION IF EXISTS NorFairTracker;").df() execute_query_fetch_all( db, query, do_not_print_exceptions=False, do_not_raise_exceptions=True ) diff --git a/evadb/functions/trackers/nor_fair.py b/evadb/functions/trackers/nor_fair.py index ce77f2af7..96e4cc982 100644 --- a/evadb/functions/trackers/nor_fair.py +++ b/evadb/functions/trackers/nor_fair.py @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. import numpy as np -#import sys + from evadb.functions.abstract.tracker_abstract_function import ( EvaDBTrackerAbstractFunction, ) @@ -31,8 +31,6 @@ def name(self) -> str: def setup(self, distance_threshold=DISTANCE_THRESHOLD_CENTROID) -> None: # https://github.com/tryolabs/norfair/blob/74b11edde83941dd6e32bcccd5fa849e16bf8564/norfair/tracker.py#L18 try_to_import_norfair() - # sys.path.append('../norfair') - # from norfair.tracker import Tracker from norfair import Tracker self.tracker = Tracker( From a1bb1c167ec798bca9b88b93689e55f4fef38892 Mon Sep 17 00:00:00 2001 From: "Teng, David Samuel" Date: Sat, 25 Nov 2023 20:08:50 -0600 Subject: [PATCH 6/9] Try fck with formatter --- script/formatting/formatter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/formatting/formatter.py b/script/formatting/formatter.py index 433de9c48..14a3a3df0 100755 --- a/script/formatting/formatter.py +++ b/script/formatting/formatter.py @@ -443,7 +443,7 @@ def check_file(file): for file in os.listdir(EvaDB_NOTEBOOKS_DIR): if file.endswith(".ipynb"): notebook_file = os.path.join(EvaDB_NOTEBOOKS_DIR, file) - check_notebook_format(notebook_file) + #check_notebook_format(notebook_file) # SKIP SPELLING TESTS OVER PYTHON FILES BY DEFAULT if args.spell_check: From fee32b778c3a62d05a4327218b86d06e348dfe44 Mon Sep 17 00:00:00 2001 From: "Teng, David Samuel" Date: Sat, 25 Nov 2023 20:36:21 -0600 Subject: [PATCH 7/9] Reverting files because im coping --- script/formatting/formatter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/formatting/formatter.py b/script/formatting/formatter.py index 14a3a3df0..433de9c48 100755 --- a/script/formatting/formatter.py +++ b/script/formatting/formatter.py @@ -443,7 +443,7 @@ def check_file(file): for file in os.listdir(EvaDB_NOTEBOOKS_DIR): if file.endswith(".ipynb"): notebook_file = os.path.join(EvaDB_NOTEBOOKS_DIR, file) - #check_notebook_format(notebook_file) + check_notebook_format(notebook_file) # SKIP SPELLING TESTS OVER PYTHON FILES BY DEFAULT if args.spell_check: From ae4a3296a7d05d6c4ccf120e9992efc130ebfbe3 Mon Sep 17 00:00:00 2001 From: huaihuaiweng <38502955+huaihuaiweng@users.noreply.github.com> Date: Sat, 25 Nov 2023 22:32:55 -0500 Subject: [PATCH 8/9] fix formating --- evadb/constants.py | 5 +++-- evadb/functions/function_bootstrap_queries.py | 3 ++- evadb/parser/create_function_statement.py | 20 ++++++++++++++----- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/evadb/constants.py b/evadb/constants.py index 06e3973ea..291f79be4 100644 --- a/evadb/constants.py +++ b/evadb/constants.py @@ -12,6 +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. + DISCRETE = 0 CONTINUOUS = 1 NO_GPU = -1 @@ -21,5 +22,5 @@ IFRAMES = "IFRAMES" AUDIORATE = "AUDIORATE" DEFAULT_FUNCTION_EXPRESSION_COST = 100 -DBFUNCTIONS = __file__[0: -13] + "/functions/" -ENVFUNCTIONS = "./Lib/site-packages/evadb/functions/" \ No newline at end of file +DBFUNCTIONS = __file__[0:-13] + "/functions/" +ENVFUNCTIONS = "./Lib/site-packages/evadb/functions/" diff --git a/evadb/functions/function_bootstrap_queries.py b/evadb/functions/function_bootstrap_queries.py index 99505f8d0..988b393d7 100644 --- a/evadb/functions/function_bootstrap_queries.py +++ b/evadb/functions/function_bootstrap_queries.py @@ -20,6 +20,7 @@ NDARRAY_DIR = "ndarray" TUTORIALS_DIR = "tutorials" + DummyObjectDetector_function_query = """CREATE FUNCTION IF NOT EXISTS DummyObjectDetector INPUT (Frame_Array NDARRAY INT8(3, ANYDIM, ANYDIM)) OUTPUT (label NDARRAY STR(1)) @@ -313,4 +314,4 @@ def init_builtin_functions(db: EvaDBDatabase, mode: str = "debug") -> None: db, query, do_not_print_exceptions=False, do_not_raise_exceptions=True ) except Exception: - pass \ No newline at end of file + pass diff --git a/evadb/parser/create_function_statement.py b/evadb/parser/create_function_statement.py index 4fe49cb72..03181846d 100644 --- a/evadb/parser/create_function_statement.py +++ b/evadb/parser/create_function_statement.py @@ -68,10 +68,20 @@ def __init__( if impl_path: if len(str(impl_path)) < 12: self._impl_path = Path(impl_path) - elif "DBFUNCTIONS" == str(impl_path)[0:11] and (str(impl_path)[11:12] == "." or str(impl_path)[11:12] == "\\" or str(impl_path)[11:12] == "/"): - self._impl_path = Path(str(EvaDB_INSTALLATION_DIR) + "\\functions\\" + str(impl_path)[12:]) - elif "ENVFUNCTIONS" == str(impl_path)[0:12] and (str(impl_path)[12:13] == "." or str(impl_path)[12:13] == "\\" or str(impl_path)[12:13] == "/"): - self._impl_path = Path( "..\\functions\\" + str(impl_path)[13:]) + elif "DBFUNCTIONS" == str(impl_path)[0:11] and ( + str(impl_path)[11:12] == "." + or str(impl_path)[11:12] == "\\" + or str(impl_path)[11:12] == "/" + ): + self._impl_path = Path( + str(EvaDB_INSTALLATION_DIR) + "\\functions\\" + str(impl_path)[12:] + ) + elif "ENVFUNCTIONS" == str(impl_path)[0:12] and ( + str(impl_path)[12:13] == "." + or str(impl_path)[12:13] == "\\" + or str(impl_path)[12:13] == "/" + ): + self._impl_path = Path("..\\functions\\" + str(impl_path)[13:]) else: self._impl_path = Path(impl_path) else: @@ -182,4 +192,4 @@ def __hash__(self) -> int: self.query, tuple(self.metadata), ) - ) \ No newline at end of file + ) From c33aa573dd85a255b4e25ad160ad9b992d3cd74f Mon Sep 17 00:00:00 2001 From: huaihuaiweng <38502955+huaihuaiweng@users.noreply.github.com> Date: Sat, 25 Nov 2023 23:42:58 -0500 Subject: [PATCH 9/9] fix nor_fair.py formatting --- evadb/functions/trackers/nor_fair.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/evadb/functions/trackers/nor_fair.py b/evadb/functions/trackers/nor_fair.py index 96e4cc982..0468a3c99 100644 --- a/evadb/functions/trackers/nor_fair.py +++ b/evadb/functions/trackers/nor_fair.py @@ -71,4 +71,4 @@ def forward(self, frame_id, frame, labels, bboxes, scores): scores.append(det[2]) ids.append(obj.id) - return np.array(ids), np.array(labels), np.array(bboxes_xyxy), np.array(scores) \ No newline at end of file + return np.array(ids), np.array(labels), np.array(bboxes_xyxy), np.array(scores)