From a729cbd6e3d965333b64835d012859667c072c82 Mon Sep 17 00:00:00 2001 From: mibe Date: Mon, 28 Oct 2024 12:32:52 +0000 Subject: [PATCH] #339 Improved reporting of the ITDE errors --- doc/changes/changes_3.2.0.md | 1 + .../files/notebook/utils/main_config_ui.ipynb | 18 ++++++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/doc/changes/changes_3.2.0.md b/doc/changes/changes_3.2.0.md index c860301d..5b222329 100644 --- a/doc/changes/changes_3.2.0.md +++ b/doc/changes/changes_3.2.0.md @@ -7,6 +7,7 @@ Code name: ## Refactorings * #333: Added project short tag in notebook tests +* #339: Improved error reporting when the DockerDB doesn't start properly. ## Bug Fixes diff --git a/exasol/ds/sandbox/runtime/ansible/roles/jupyter/files/notebook/utils/main_config_ui.ipynb b/exasol/ds/sandbox/runtime/ansible/roles/jupyter/files/notebook/utils/main_config_ui.ipynb index 05f20d71..ebad1b74 100644 --- a/exasol/ds/sandbox/runtime/ansible/roles/jupyter/files/notebook/utils/main_config_ui.ipynb +++ b/exasol/ds/sandbox/runtime/ansible/roles/jupyter/files/notebook/utils/main_config_ui.ipynb @@ -43,6 +43,7 @@ "from exasol.nb_connector.ai_lab_config import AILabConfig as CKey, StorageBackend\n", "from exasol.nb_connector.itde_manager import (bring_itde_up, get_itde_status, restart_itde, take_itde_down, ItdeContainerStatus)\n", "from exasol.nb_connector.connections import get_backend\n", + "from exasol_integration_test_docker_environment.lib.api.api_errors import TaskFailures, TaskRuntimeError\n", "\n", "\n", "class ITDEStatus(Enum):\n", @@ -196,6 +197,19 @@ " return get_onprem_db_config_ui(conf)\n", "\n", "\n", + "def _itde_error_message(header: str, e: Exception) -> str:\n", + " if isinstance(e, TaskRuntimeError):\n", + " if isinstance(e.__cause__, TaskFailures):\n", + " err_message = f'{e.msg} {e.__cause__}'\n", + " elif e.inner:\n", + " err_message = f'{e.msg} This was caused by {\", \".join(e.inner)}'\n", + " else:\n", + " err_message = e.msg\n", + " else:\n", + " err_message = str(e)\n", + " return f'{header}: {err_message}'\n", + "\n", + "\n", "def _get_docker_db_action_buttons(conf: Secrets, itde_exists: bool, itde_ready: bool, \n", " display_status: widgets.Widget) -> List[widgets.Button]:\n", " \"\"\"\n", @@ -220,7 +234,7 @@ " display_status.value = ITDEStatus.ready.value\n", " btn.icon = 'check'\n", " except Exception as e:\n", - " popup_message('Failed to start the Exasol Docker-DB:' + str(e))\n", + " popup_message(_itde_error_message('Failed to start the Exasol Docker-DB', e))\n", " \n", " def restart_docker_db(btn):\n", " try:\n", @@ -234,7 +248,7 @@ " display_status.value = ITDEStatus.ready.value\n", " btn.icon = 'check'\n", " except Exception as e:\n", - " popup_message('Failed to restart the Exasol Docker-DB:' + str(e))\n", + " popup_message(_itde_error_message('Failed to restart the Exasol Docker-DB:', e))\n", "\n", " if itde_ready:\n", " btn_restart = widgets.Button(description='Recreate and Start')\n",