From 0312c7aa29305e8885987db10ac4f35ddc9886ec Mon Sep 17 00:00:00 2001 From: xzdandy Date: Tue, 15 Aug 2023 05:45:14 -0400 Subject: [PATCH 1/4] Revert "Revert "Fix benchmark documentation (#931)"" This reverts commit 84efe77618158cf010a80db8af4721b517ac582a. --- docs/source/benchmarks/text_summarization.rst | 26 +++++++++---------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/docs/source/benchmarks/text_summarization.rst b/docs/source/benchmarks/text_summarization.rst index 07ba86e455..8fc6c67624 100644 --- a/docs/source/benchmarks/text_summarization.rst +++ b/docs/source/benchmarks/text_summarization.rst @@ -1,11 +1,11 @@ Text summarization benchmark ==== -In this benchmark, we compare the performance of text summarization between EvaDB and MindsDB on `CNN-DailyMail News `. +In this benchmark, we compare the performance of text summarization between EvaDB and MindsDB on `CNN-DailyMail News `_. 1. Prepare dataset ---- -.. code-block: bash +.. code-block:: bash cd benchmark/text_summarization bash download_dataset.sh @@ -17,7 +17,7 @@ In this benchmark, we compare the performance of text summarization between EvaD Install ray in your EvaDB virtual environment. ``pip install "ray>=1.13.0,<2.5.0"`` -.. code-block: bash +.. code-block:: bash cd benchmark/text_summarization python text_summarization_with_evadb.py @@ -26,12 +26,10 @@ In this benchmark, we compare the performance of text summarization between EvaD 3. Using MindsDB to summarize the CNN DailyMail News ---- -.. _sqlite database: - Prepare sqlite database for MindsDB **** -.. code-block: bash +.. code-block:: bash sqlite3 cnn_news_test.db > .mode csv @@ -41,7 +39,7 @@ Prepare sqlite database for MindsDB Install MindsDB **** -Follow the `Setup for Source Code via pip ` to install mindsdb. +Follow the `Setup for Source Code via pip `_ to install mindsdb. .. note:: @@ -49,16 +47,16 @@ Follow the `Setup for Source Code via pip Date: Sun, 20 Aug 2023 10:48:25 -0400 Subject: [PATCH 2/4] update ci test --- .circleci/config.yml | 61 ++++--------------- .../test_native_executor.py | 43 +++++++------ 2 files changed, 36 insertions(+), 68 deletions(-) rename test/{integration_tests => third_party_tests}/test_native_executor.py (86%) diff --git a/.circleci/config.yml b/.circleci/config.yml index 7dc4df19f1..4d619e4e58 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -52,10 +52,6 @@ workflows: v: "3.10" mode: "TEST" ray: "ENABLED" - - Postgres: - name: "Test | v3.10 | Linux | Postgres" - v: "3.10" - mode: "TEST" # Ray does not work on 3.11 # https://github.com/ray-project/ray/issues/33232 # - Linux: @@ -64,6 +60,14 @@ workflows: # mode: "TEST" # ray: "ENABLED" ################################ + ### INTEGRATIONS + ################################ + ################################ + - Postgres: + name: "Test Integration - Postgres | v3.10 | Linux" + v: "3.10" + mode: "INTEGRATION" + ################################ ### NOTEBOOKS ################################ ################################ @@ -218,16 +222,9 @@ jobs: docker: # https://circleci.com/docs/circleci-images#language-image-variants DATABASE_URL: postgresql://postgres:password@localhost:5432/evadb - image: "cimg/python:<< parameters.v >>" - environment: - PGHOST: localhost - PGUSER: postgres - PGPASSWORD: password - PGDATABASE: evadb - DATABASE_URL: postgresql://postgres:password@localhost:5432/evadb - POSTGRES_DB: evadb - image: "cimg/postgres:14.8" environment: - POSTGRES_USER: postgres + POSTGRES_USER: eva POSTGRES_PASSWORD: password POSTGRES_DB: evadb steps: @@ -239,13 +236,13 @@ jobs: - v1-model_cache-{{ checksum "setup.py" }} - run: - name: install dockerize + name: Install dockerize command: wget https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz && sudo tar -C /usr/local/bin -xzvf dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz && rm dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz environment: DOCKERIZE_VERSION: v0.6.1 - run: - name: Wait for db to run + name: Wait for DB to run command : dockerize -wait tcp://localhost:5432 -timeout 1m - run: @@ -257,42 +254,10 @@ jobs: pip install ".[dev]" - run: - name: Update the evadb yml file to postgres backend. + name: Run integration tests command: | source test_evadb/bin/activate - python -c "import yaml;f = open('evadb/evadb.yml', 'r+');config_obj = yaml.load(f, Loader=yaml.FullLoader);config_obj['core']['catalog_database_uri'] = 'postgresql://postgres:password@localhost:5432/evadb';f.seek(0);f.write(yaml.dump(config_obj));f.truncate();" - pip install ".[postgres]" - - # Install qdrant only on versions < 3.11 - - when: - condition: - not: - equal: [ "3.11", << parameters.v >> ] - steps: - - run: - name: Install Qdrant - command: | - source test_evadb/bin/activate - pip install ".[qdrant]" - - - run: - name: Test and upload coverage report to coveralls - no_output_timeout: 30m # 30 minute timeout - command: | - source test_evadb/bin/activate - bash script/test/test.sh -m "<< parameters.mode >>" - - # Enable cache save conditionally (to avoid empty cache in Notebooks) - - when: - condition: - equal: [ TEST, << parameters.mode >> ] - steps: - - save_cache: - key: v1-model_cache-{{ checksum "setup.py" }} - paths: - - /home/circleci/.cache/huggingface/ - - /home/circleci/.cache/torch/ - - /home/circleci/.cache/gpt4all/ + PYTHONPATH="." python -m pytest test/third_party_tests/test_native_executor.py -k test_should_run_simple_query_in_postgres Windows: executor: win/default diff --git a/test/integration_tests/test_native_executor.py b/test/third_party_tests/test_native_executor.py similarity index 86% rename from test/integration_tests/test_native_executor.py rename to test/third_party_tests/test_native_executor.py index 2139c388a6..e2a619a1c3 100644 --- a/test/integration_tests/test_native_executor.py +++ b/test/third_party_tests/test_native_executor.py @@ -30,26 +30,11 @@ def setUp(self): def tearDown(self): shutdown_ray() - def test_should_run_simple_query_in_sqlalchemy(self): - # Create database. - params = { - "user": "eva", - "password": "password", - "host": "127.0.0.1", - "port": "5432", - "database": "test", - } - query = """CREATE DATABASE postgres_data - WITH ENGINE = "postgres", - PARAMETERS = {};""".format( - params - ) - execute_query_fetch_all(self.evadb, query) - + def _simple_execute(self): # Create table. execute_query_fetch_all( self.evadb, - """USE postgres_data { + """USE test_data_source { CREATE TABLE test_table ( name VARCHAR(10), age INT, @@ -59,7 +44,7 @@ def test_should_run_simple_query_in_sqlalchemy(self): ) execute_query_fetch_all( self.evadb, - """USE postgres_data { + """USE test_data_source { INSERT INTO test_table ( name, age, comment ) VALUES ( @@ -72,7 +57,7 @@ def test_should_run_simple_query_in_sqlalchemy(self): # Select. res_batch = execute_query_fetch_all( self.evadb, - """USE postgres_data { + """USE test_data_source { SELECT * FROM test_table } """, @@ -85,8 +70,26 @@ def test_should_run_simple_query_in_sqlalchemy(self): # DROP table. execute_query_fetch_all( self.evadb, - """USE postgres_data { + """USE test_data_source { DROP TABLE test_table } """, ) + + def test_should_run_simple_query_in_postgres(self): + # Create database. + params = { + "user": "eva", + "password": "password", + "host": "localhost", + "port": "5432", + "database": "evadb", + } + query = """CREATE DATABASE test_data_source + WITH ENGINE = "postgres", + PARAMETERS = {};""".format( + params + ) + execute_query_fetch_all(self.evadb, query) + + self._simple_execute() From c5191fe9486b20d4d4154c6a727abbd239bfb2dd Mon Sep 17 00:00:00 2001 From: Jiashen Cao Date: Sun, 20 Aug 2023 11:01:19 -0400 Subject: [PATCH 3/4] fix install path --- evadb/third_party/databases/interface.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/evadb/third_party/databases/interface.py b/evadb/third_party/databases/interface.py index 3210043342..4f285adcec 100644 --- a/evadb/third_party/databases/interface.py +++ b/evadb/third_party/databases/interface.py @@ -49,7 +49,9 @@ def dynamic_install(handler_dir): INSTALL_CACHE.append(handler_dir) - req_file = os.path.join(handler_dir, "requirements.txt") + req_file = os.path.join( + "evadb", "third_party", "databases", handler_dir, "requirements.txt" + ) if os.path.isfile(req_file): with open(req_file) as f: for package in f.read().splitlines(): From b239d43c43bbf91579df9eb17a02c507e5a66aea Mon Sep 17 00:00:00 2001 From: Jiashen Cao Date: Mon, 21 Aug 2023 13:16:47 -0400 Subject: [PATCH 4/4] ignore third party integration test in normal setting --- script/test/test.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/script/test/test.sh b/script/test/test.sh index 3cd8ceb300..f61aafcf0b 100644 --- a/script/test/test.sh +++ b/script/test/test.sh @@ -76,7 +76,7 @@ then # Non-Windows if [[ "$OSTYPE" != "msys" ]]; then - PYTHONPATH=./ pytest test/ --durations=20 --cov-report term-missing:skip-covered --cov-config=.coveragerc --cov-context=test --cov=evadb/ --capture=sys --tb=short -v -rsf --log-level=WARNING -m "not benchmark" + PYTHONPATH=./ pytest test/ --durations=20 --cov-report term-missing:skip-covered --cov-config=.coveragerc --cov-context=test --cov=evadb/ --capture=sys --tb=short -v -rsf --log-level=WARNING -m "not benchmark" --ignore=test/third_party_tests test_code=$? if [ "$test_code" != "0" ]; then @@ -87,7 +87,7 @@ then fi # Windows -- no need for coverage report else - PYTHONPATH=./ python -m pytest -p no:cov test/ -m "not benchmark" + PYTHONPATH=./ python -m pytest -p no:cov test/ -m "not benchmark" --ignore=test/third_party_tests test_code=$? if [ "$test_code" != "0" ]; then