Skip to content

Commit

Permalink
Added notebook test
Browse files Browse the repository at this point in the history
  • Loading branch information
tomuben committed Jul 12, 2024
1 parent e518cde commit 0278227
Show file tree
Hide file tree
Showing 5 changed files with 230 additions and 1,711 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,39 +23,10 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": null,
"id": "e70ad0a9-7042-4fe8-814b-5c586b9bee6d",
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "e04d36f4f245412cba260a28c1831118",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Output()"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "28e8d00f3a9f4a2687c56750c5ff4762",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Box(children=(Box(children=(Label(value='Configuration Store', layout=Layout(border_bottom='solid 1px', border…"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"outputs": [],
"source": [
"%run ../utils/access_store_ui.ipynb\n",
"display(get_access_store_ui('../'))"
Expand All @@ -72,59 +43,50 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": null,
"id": "224345da-f14e-4a45-bf8a-07e3ba0870dc",
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "6c363a2a8a9d4c89a661c698c5d329f8",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Output()"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"outputs": [],
"source": [
"%run ./utils/slc_ui.ipynb"
]
},
{
"cell_type": "markdown",
"id": "395d6f4f-6e06-45e3-a9a7-54dc94e73332",
"metadata": {},
"source": [
"## Instantiate SLCT Manager\n",
"\n",
"We create an instance of the SlctManager class from the notebook connector"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "9f42c7c6-0297-4cb4-bedf-d3a2a58e69fc",
"metadata": {},
"outputs": [],
"source": [
"from exasol.nb_connector.slct_manager import SlctManager\n",
"slct_manager = SlctManager(ai_lab_config)"
]
},
{
"cell_type": "markdown",
"id": "178b59e9-8f46-43b1-b4f8-9cd6d6bf5076",
"metadata": {},
"source": [
"# Configure the Flavor path\n",
"### Choose the flavor source"
"# Configure the Script-Languages directory\n",
"### Choose the source"
]
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": null,
"id": "0f8caa77-35a0-403d-af96-e5f8056ba489",
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "0794fd907a2449b4be40e4f59ca0ff1a",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Box(children=(Box(children=(Label(value='Flavor choice', layout=Layout(border_bottom='solid 1px', border_left=…"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"outputs": [],
"source": [
"display(get_slc_source_selection_ui(ai_lab_config))"
]
Expand All @@ -140,25 +102,10 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": null,
"id": "56e16540-5f4b-4d5c-8c83-d34c1217eb00",
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "30fbb9a2d7a449f89ad18f605be32a96",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Box(children=(Box(children=(Label(value='Existing script-languages directory', layout=Layout(border_bottom='so…"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"outputs": [],
"source": [
"display(get_existing_slc_ui(ai_lab_config))"
]
Expand All @@ -174,20 +121,10 @@
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": null,
"id": "7d84889f-7c3a-4f69-9bf1-c193481867af",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"None"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"outputs": [],
"source": [
"display(get_slc_target_dir_ui(ai_lab_config))"
]
Expand All @@ -202,31 +139,13 @@
},
{
"cell_type": "code",
"execution_count": 16,
"execution_count": null,
"id": "31132726-9827-4c9b-8fb8-0884d2f36e67",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Ready\n"
]
}
],
"outputs": [],
"source": [
"from pathlib import Path\n",
"slc_dir = Path(ai_lab_config.get(slc_target_dir_store_key))\n",
"if clone_slc_repo(ai_lab_config):\n",
" from git import Repo\n",
" \n",
" if not slc_dir.is_dir():\n",
" print (f\"Cloning into {slc_dir}...\")\n",
" repo = Repo.clone_from(\"https://github.com/exasol/script-languages-release\", slc_dir)\n",
" print (\"Fetching submodules...\")\n",
" repo.submodule_update(recursive=True)\n",
" else:\n",
" print(f\"Directory '{slc_dir}' already exists. Skipping cloning....\")\n",
" slct_manager.clone_slc_repo()\n",
"print(\"Ready\")"
]
},
Expand All @@ -240,38 +159,30 @@
},
{
"cell_type": "code",
"execution_count": 17,
"execution_count": null,
"id": "bb6b26b9-cb24-4b66-85c9-e15a0c92ff2c",
"metadata": {
"scrolled": true
},
"outputs": [
{
"data": {
"text/plain": [
"<exasol.nb_connector.secret_store.Secrets at 0x7e6ad1a29840>"
]
},
"execution_count": 17,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"if not slct_manager.check_slc_repo_complete():\n",
" popup_message(f\"The script-languages repository does not fullfill requirements.\")\n"
]
},
{
"cell_type": "markdown",
"id": "21840146-28bd-413f-a9ce-cd22b17939b2",
"metadata": {},
"source": [
"flavor_base_dir = Path(slc_dir) / \"flavors\"\n",
"flavor_dirs = [flavor_dir.name for flavor_dir in flavor_base_dir.iterdir() if flavor_dir.is_dir()]\n",
"required_flavor = \"template-Exasol-all-python-3.10\"\n",
"filtered_flavors = [flavor for flavor in flavor_dirs if str(flavor) == required_flavor]\n",
"if len(filtered_flavors) == 0:\n",
" popup_message(f\"The script-languages repository at '{slc_dir}' does not contain flavor '{required_flavor}'\")\n",
"assert len(filtered_flavors) == 1\n",
"ai_lab_config.save(slc_source_flavor_store_key, str(required_flavor))"
"## Finish\n",
"Now you can continue with [Using a script-languages-container](./using_a_script_languages_container.ipynb) "
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "64f9a4c4-f370-4f68-8b9b-291dcdf32125",
"id": "7c78e2ab-5050-4b8e-acda-f11bf8a1f178",
"metadata": {},
"outputs": [],
"source": []
Expand Down
Loading

0 comments on commit 0278227

Please sign in to comment.