Skip to content

Commit

Permalink
Use the new namespace of the nb connector [run-notebook-tests]
Browse files Browse the repository at this point in the history
  • Loading branch information
ahsimb committed Feb 9, 2024
1 parent 4ccfe1d commit 81823c2
Show file tree
Hide file tree
Showing 25 changed files with 53 additions and 52 deletions.
1 change: 1 addition & 0 deletions doc/changes/changes_0.2.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@ Version: 0.2.0
* #170: Renaming the section name "Set up" to "Setup".
* #182: Renaming the secret store global variable from "sb_config" to "ai_lab_config".
* #169: Renaming the default database schema from "IDA" to "AI_LAB".
* #188: Start using the new namespace of the notebook-connector 0.2.7.
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
"outputs": [],
"source": [
"import pyexasol\n",
"from exasol.connections import open_pyexasol_connection"
"from exasol.nb_connector.connections import open_pyexasol_connection"
],
"metadata": {
"collapsed": false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"outputs": [],
"source": [
"from exasol import github, bfs_utils, cloud_storage\n",
"from exasol.connections import open_bucketfs_connection, open_pyexasol_connection\n",
"from exasol.nb_connector.connections import open_bucketfs_connection, open_pyexasol_connection\n",
"\n",
"jar_local_path = github.retrieve_jar(github.Project.CLOUD_STORAGE_EXTENSION, use_local_cache=True)\n",
"bfs_bucket = open_bucketfs_connection(ai_lab_config)\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
"outputs": [],
"source": [
"from sklearn.model_selection import train_test_split\n",
"from exasol.connections import open_pyexasol_connection\n",
"from exasol.nb_connector.connections import open_pyexasol_connection\n",
"\n",
"# Split the data into train and test sets\n",
"df_train, df_test = train_test_split(df, test_size=0.2)\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
"outputs": [],
"source": [
"from sklearn.model_selection import train_test_split\n",
"from exasol.connections import open_pyexasol_connection\n",
"from exasol.nb_connector.connections import open_pyexasol_connection\n",
"\n",
"# Split the data into train and test sets\n",
"df_train, df_test = train_test_split(df, test_size=0.2)\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@
"metadata": {},
"outputs": [],
"source": [
"from exasol.connections import open_pyexasol_connection\n",
"from exasol.nb_connector.connections import open_pyexasol_connection\n",
"from stopwatch import Stopwatch\n",
"\n",
"stopwatch = Stopwatch()\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
"metadata": {},
"outputs": [],
"source": [
"from exasol.sagemaker_extension_wrapper import initialize_sme_extension\n",
"from exasol.nb_connector.sagemaker_extension_wrapper import initialize_sme_extension\n",
"\n",
"initialize_sme_extension(ai_lab_config)"
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"metadata": {},
"outputs": [],
"source": [
"from exasol.utils import upward_file_search\n",
"from exasol.nb_connector.utils import upward_file_search\n",
"\n",
"# This NB may be running from various locations in the NB hierarchy.\n",
"# Need to search for other supporting NBs from the current directory upwards.\n",
Expand All @@ -35,8 +35,8 @@
"from enum import Enum\n",
"import ipywidgets as widgets\n",
"\n",
"from exasol.secret_store import Secrets\n",
"from exasol.ai_lab_config import AILabConfig as CKey\n",
"from exasol.nb_connector.secret_store import Secrets\n",
"from exasol.nb_connector.ai_lab_config import AILabConfig as CKey\n",
"\n",
"\n",
"def get_sme_config_ui(conf: Secrets) -> widgets.Widget:\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"metadata": {},
"outputs": [],
"source": [
"from exasol.connections import open_pyexasol_connection, get_udf_bucket_path\n",
"from exasol.nb_connector.connections import open_pyexasol_connection, get_udf_bucket_path\n",
"from stopwatch import Stopwatch\n",
"\n",
"target_column = 'RINGS'\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"metadata": {},
"outputs": [],
"source": [
"from exasol.connections import open_pyexasol_connection, get_udf_bucket_path\n",
"from exasol.nb_connector.connections import open_pyexasol_connection, get_udf_bucket_path\n",
"from stopwatch import Stopwatch\n",
"\n",
"target_column = 'CLASS'\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"outputs": [],
"source": [
"import textwrap\n",
"from exasol.connections import open_pyexasol_connection\n",
"from exasol.nb_connector.connections import open_pyexasol_connection\n",
"from stopwatch import Stopwatch\n",
"\n",
"stopwatch = Stopwatch()\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"metadata": {},
"outputs": [],
"source": [
"from exasol.connections import open_pyexasol_connection\n",
"from exasol.nb_connector.connections import open_pyexasol_connection\n",
"from sklearn.model_selection import train_test_split\n",
"from stopwatch import Stopwatch\n",
"\n",
Expand Down Expand Up @@ -198,7 +198,7 @@
"outputs": [],
"source": [
"import pickle\n",
"from exasol.connections import open_bucketfs_connection\n",
"from exasol.nb_connector.connections import open_bucketfs_connection\n",
"\n",
"MODEL_FILE = 'abalone_svm_model.pkl'\n",
"\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"metadata": {},
"outputs": [],
"source": [
"from exasol.connections import open_pyexasol_connection\n",
"from exasol.nb_connector.connections import open_pyexasol_connection\n",
"from stopwatch import Stopwatch\n",
"\n",
"stopwatch = Stopwatch()\n",
Expand Down Expand Up @@ -144,7 +144,7 @@
"outputs": [],
"source": [
"import pickle\n",
"from exasol.connections import open_bucketfs_connection\n",
"from exasol.nb_connector.connections import open_bucketfs_connection\n",
"\n",
"MODEL_FILE = 'telescope_tree_model.pkl'\n",
"\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
},
"outputs": [],
"source": [
"from exasol.transformers_extension_wrapper import initialize_te_extension\n",
"from exasol.nb_connector.transformers_extension_wrapper import initialize_te_extension\n",
"\n",
"initialize_te_extension(ai_lab_config)"
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@
"metadata": {},
"outputs": [],
"source": [
"from exasol.connections import open_pyexasol_connection\n",
"from exasol.language_container_activation import get_activation_sql\n",
"from exasol.nb_connector.connections import open_pyexasol_connection\n",
"from exasol.nb_connector.language_container_activation import get_activation_sql\n",
"\n",
"# We will be creating a new database session every time we call the model.\n",
"# We will have to activate the language container for each of these sessions.\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"metadata": {},
"outputs": [],
"source": [
"from exasol.secret_store import Secrets\n",
"from exasol.nb_connector.secret_store import Secrets\n",
"\n",
"\n",
"def load_huggingface_model_udf(conf: Secrets, model_name: str) -> None:\n",
Expand All @@ -47,9 +47,9 @@
" model_name - Name of the model at Huggingface hub, e.g. facebook/nllb-moe-54b.\n",
" \"\"\"\n",
"\n",
" from exasol.connections import open_pyexasol_connection\n",
" from exasol.language_container_activation import get_activation_sql\n",
" from exasol.ai_lab_config import AILabConfig as CKey\n",
" from exasol.nb_connector.connections import open_pyexasol_connection\n",
" from exasol.nb_connector.language_container_activation import get_activation_sql\n",
" from exasol.nb_connector.ai_lab_config import AILabConfig as CKey\n",
"\n",
" sql = f\"\"\"\n",
" SELECT {conf.get(CKey.db_schema)}.TE_MODEL_DOWNLOADER_UDF(\n",
Expand Down Expand Up @@ -93,8 +93,8 @@
"\n",
" from pathlib import Path\n",
" import re\n",
" from exasol.transformers_extension_wrapper import upload_model\n",
" from exasol.ai_lab_config import AILabConfig as CKey\n",
" from exasol.nb_connector.transformers_extension_wrapper import upload_model\n",
" from exasol.nb_connector.ai_lab_config import AILabConfig as CKey\n",
"\n",
" # Make a name for the model sub-directory\n",
" sub_dir = re.sub(r\"[/\\\\?%*:|\\\"<>\\x7F\\x00-\\x1F]\", \"-\", model_name)\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"metadata": {},
"outputs": [],
"source": [
"from exasol.utils import upward_file_search\n",
"from exasol.nb_connector.utils import upward_file_search\n",
"\n",
"# This NB may be running from various locations in the NB hierarchy.\n",
"# Need to search for other supporting NBs from the current directory upwards.\n",
Expand All @@ -34,8 +34,8 @@
"source": [
"import ipywidgets as widgets\n",
"\n",
"from exasol.secret_store import Secrets\n",
"from exasol.ai_lab_config import AILabConfig as CKey\n",
"from exasol.nb_connector.secret_store import Secrets\n",
"from exasol.nb_connector.ai_lab_config import AILabConfig as CKey\n",
"\n",
"\n",
"def get_te_config_ui(conf: Secrets) -> widgets.Widget:\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"metadata": {},
"outputs": [],
"source": [
"from exasol.utils import upward_file_search\n",
"from exasol.nb_connector.utils import upward_file_search\n",
"\n",
"# This NB may be running from various locations in the NB hierarchy.\n",
"# Need to search for the styles NB from the current directory upwards.\n",
Expand All @@ -37,7 +37,7 @@
"from pathlib import Path\n",
"import ipywidgets as widgets\n",
"\n",
"from exasol.secret_store import Secrets\n",
"from exasol.nb_connector.secret_store import Secrets\n",
"\n",
"\n",
"def get_access_store_ui(root_dir: str = '.') -> widgets.Widget:\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"metadata": {},
"outputs": [],
"source": [
"from exasol.utils import upward_file_search\n",
"from exasol.nb_connector.utils import upward_file_search\n",
"\n",
"# This NB may be running from various locations in the NB hierarchy.\n",
"# Need to search for the styles NB from the current directory upwards.\n",
Expand All @@ -36,8 +36,8 @@
"from itertools import chain\n",
"import ipywidgets as widgets\n",
"\n",
"from exasol.secret_store import Secrets\n",
"from exasol.ai_lab_config import AILabConfig as CKey\n",
"from exasol.nb_connector.secret_store import Secrets\n",
"from exasol.nb_connector.ai_lab_config import AILabConfig as CKey\n",
"\n",
"\n",
"def get_generic_config_ui(conf: Secrets, \n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
"metadata": {},
"outputs": [],
"source": [
"from exasol.connections import open_sqlalchemy_connection\n",
"from exasol.language_container_activation import get_activation_sql\n",
"from exasol.nb_connector.connections import open_sqlalchemy_connection\n",
"from exasol.nb_connector.language_container_activation import get_activation_sql\n",
"\n",
"engine = open_sqlalchemy_connection(ai_lab_config)\n",
"\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"metadata": {},
"outputs": [],
"source": [
"from exasol.utils import upward_file_search\n",
"from exasol.nb_connector.utils import upward_file_search\n",
"\n",
"# This NB may be running from various locations in the NB hierarchy.\n",
"# Need to search for other supporting NBs from the current directory upwards.\n",
Expand All @@ -35,12 +35,12 @@
"outputs": [],
"source": [
"from typing import List\n",
"from exasol.secret_store import Secrets\n",
"from exasol.ai_lab_config import AILabConfig as CKey\n",
"from exasol.nb_connector.secret_store import Secrets\n",
"from exasol.nb_connector.ai_lab_config import AILabConfig as CKey\n",
"import ipywidgets as widgets\n",
"\n",
"from exasol.ai_lab_config import AILabConfig as CKey\n",
"from exasol.itde_manager import (bring_itde_up, is_itde_running, start_itde, take_itde_down)\n",
"from exasol.nb_connector.ai_lab_config import AILabConfig as CKey\n",
"from exasol.nb_connector.itde_manager import (bring_itde_up, is_itde_running, start_itde, take_itde_down)\n",
"\n",
"\n",
"class ITDEStatus(Enum):\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ sqlalchemy_exasol==4.6.3
stopwatch.py==2.0.1
boto3==1.26.163
--extra-index-url https://download.pytorch.org/whl/cpu
git+https://github.com/exasol/[email protected].6
git+https://github.com/exasol/[email protected].7
6 changes: 3 additions & 3 deletions test/notebooks/nbtest_itde.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from exasol.secret_store import Secrets
from exasol.itde_manager import (
from exasol.nb_connector.secret_store import Secrets
from exasol.nb_connector.itde_manager import (
bring_itde_up,
take_itde_down
)
from exasol.connections import open_pyexasol_connection
from exasol.nb_connector.connections import open_pyexasol_connection


def test_itde(tmp_path):
Expand Down
8 changes: 4 additions & 4 deletions test/notebooks/nbtest_sagemaker.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
import textwrap

import pytest
from exasol.secret_store import Secrets
from exasol.ai_lab_config import AILabConfig as CKey
from exasol.nb_connector.secret_store import Secrets
from exasol.nb_connector.ai_lab_config import AILabConfig as CKey

from notebook_test_utils import (access_to_temp_secret_store, run_notebook, uploading_hack)

Expand Down Expand Up @@ -150,8 +150,8 @@ def get_job_polling_hack() -> Tuple[str, str]:
textwrap.dedent("""
def continuous_job_polling():
import time
from exasol.connections import open_pyexasol_connection
from exasol.language_container_activation import get_activation_sql
from exasol.nb_connector.connections import open_pyexasol_connection
from exasol.nb_connector.language_container_activation import get_activation_sql
sql = f'EXECUTE SCRIPT {ai_lab_config.db_schema}."SME_POLL_SAGEMAKER_AUTOPILOT_JOB_STATUS"(' \
f"'{ai_lab_config.JOB_NAME}'," \
Expand Down
8 changes: 4 additions & 4 deletions test/notebooks/notebook_test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
from nbclient import NotebookClient
import requests

from exasol.secret_store import Secrets
from exasol.ai_lab_config import AILabConfig as CKey
from exasol.itde_manager import (
from exasol.nb_connector.secret_store import Secrets
from exasol.nb_connector.ai_lab_config import AILabConfig as CKey
from exasol.nb_connector.itde_manager import (
bring_itde_up,
take_itde_down
)
Expand Down Expand Up @@ -77,7 +77,7 @@ def run_notebook(notebook_file: str, store_file: str, store_password: str,
init_code = f'''
def init_notebook_test():
from pathlib import Path
from exasol.secret_store import Secrets
from exasol.nb_connector.secret_store import Secrets
global ai_lab_config
ai_lab_config = Secrets(Path("{store_file}"), "{store_password}")
init_notebook_test()
Expand Down

0 comments on commit 81823c2

Please sign in to comment.