From 2b309976eba7b668f9b53f6785ae913704b1b651 Mon Sep 17 00:00:00 2001 From: Kevin Smith Date: Tue, 4 Nov 2025 15:17:52 -0600 Subject: [PATCH 1/5] Add debugging --- singlestoredb/notebook/_portal.py | 1 + 1 file changed, 1 insertion(+) diff --git a/singlestoredb/notebook/_portal.py b/singlestoredb/notebook/_portal.py index 664348c1..e1c4575f 100644 --- a/singlestoredb/notebook/_portal.py +++ b/singlestoredb/notebook/_portal.py @@ -250,6 +250,7 @@ def connection( raise RuntimeError('workspace is not active') id = w.id + print(w, default_database) self._call_javascript( 'changeConnection', [id, default_database], From 282f0649e788c456619b48d53e2a1caefe33e7ac Mon Sep 17 00:00:00 2001 From: Kevin Smith Date: Wed, 5 Nov 2025 08:20:55 -0600 Subject: [PATCH 2/5] Increase USE WORKSPACE timeout --- singlestoredb/notebook/_portal.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/singlestoredb/notebook/_portal.py b/singlestoredb/notebook/_portal.py index e1c4575f..5b33dce4 100644 --- a/singlestoredb/notebook/_portal.py +++ b/singlestoredb/notebook/_portal.py @@ -57,7 +57,7 @@ def _call_javascript( wait_on_condition: Optional[Callable[[], bool]] = None, timeout_message: str = 'timed out waiting on condition', wait_interval: float = 0.2, - timeout: float = 5.0, + timeout: float = 20.0, ) -> None: if not has_ipython or not func: return @@ -250,7 +250,6 @@ def connection( raise RuntimeError('workspace is not active') id = w.id - print(w, default_database) self._call_javascript( 'changeConnection', [id, default_database], From b7f3a2e0cfa38e72a005de015aa404ec18c371f4 Mon Sep 17 00:00:00 2001 From: Kevin Smith Date: Wed, 5 Nov 2025 08:34:54 -0600 Subject: [PATCH 3/5] Increase USE WORKSPACE timeout --- singlestoredb/notebook/_portal.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/singlestoredb/notebook/_portal.py b/singlestoredb/notebook/_portal.py index 5b33dce4..9ba93c72 100644 --- a/singlestoredb/notebook/_portal.py +++ b/singlestoredb/notebook/_portal.py @@ -56,8 +56,8 @@ def _call_javascript( args: Optional[List[Any]] = None, wait_on_condition: Optional[Callable[[], bool]] = None, timeout_message: str = 'timed out waiting on condition', - wait_interval: float = 0.2, - timeout: float = 20.0, + wait_interval: float = 0.5, + timeout: float = 60.0, ) -> None: if not has_ipython or not func: return From 95007975eae6de0f74a6044d3e539a5027fcb6ea Mon Sep 17 00:00:00 2001 From: Kevin Smith Date: Wed, 5 Nov 2025 08:52:10 -0600 Subject: [PATCH 4/5] Increase USE WORKSPACE timeout --- singlestoredb/notebook/_portal.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/singlestoredb/notebook/_portal.py b/singlestoredb/notebook/_portal.py index 9ba93c72..95e0e589 100644 --- a/singlestoredb/notebook/_portal.py +++ b/singlestoredb/notebook/_portal.py @@ -56,7 +56,7 @@ def _call_javascript( args: Optional[List[Any]] = None, wait_on_condition: Optional[Callable[[], bool]] = None, timeout_message: str = 'timed out waiting on condition', - wait_interval: float = 0.5, + wait_interval: float = 1.0, timeout: float = 60.0, ) -> None: if not has_ipython or not func: From f3c8e737fbbcaae94b892459a6a924864b5afbd3 Mon Sep 17 00:00:00 2001 From: Kevin Smith Date: Wed, 5 Nov 2025 09:30:04 -0600 Subject: [PATCH 5/5] Do not raise exception on timeout --- singlestoredb/fusion/handlers/workspace.py | 55 ++++++++++++---------- singlestoredb/notebook/_portal.py | 2 +- 2 files changed, 31 insertions(+), 26 deletions(-) diff --git a/singlestoredb/fusion/handlers/workspace.py b/singlestoredb/fusion/handlers/workspace.py index 083d265c..24870fd6 100644 --- a/singlestoredb/fusion/handlers/workspace.py +++ b/singlestoredb/fusion/handlers/workspace.py @@ -107,32 +107,37 @@ def run(self, params: Dict[str, Any]) -> Optional[FusionSQLResult]: workspace_id = workspace.id - # Set workspace and database - if params.get('with_database'): - if params.get('in_group'): - # Use 3-element tuple: (workspace_group_id, workspace_name_or_id, - # database) - portal.connection = ( # type: ignore[assignment] - workspace_group.id, - workspace_name or workspace_id, - params['with_database'], - ) - else: - # Use 2-element tuple: (workspace_name_or_id, database) - portal.connection = ( - workspace_name or workspace_id, - params['with_database'], - ) - else: - if params.get('in_group'): - # Use 2-element tuple: (workspace_group_id, workspace_name_or_id) - portal.workspace = ( # type: ignore[assignment] - workspace_group.id, - workspace_name or workspace_id, - ) + try: + # Set workspace and database + if params.get('with_database'): + if params.get('in_group'): + # Use 3-element tuple: (workspace_group_id, workspace_name_or_id, + # database) + portal.connection = ( # type: ignore[assignment] + workspace_group.id, + workspace_name or workspace_id, + params['with_database'], + ) + else: + # Use 2-element tuple: (workspace_name_or_id, database) + portal.connection = ( + workspace_name or workspace_id, + params['with_database'], + ) else: - # Use string: workspace_name_or_id - portal.workspace = workspace_name or workspace_id + if params.get('in_group'): + # Use 2-element tuple: (workspace_group_id, workspace_name_or_id) + portal.workspace = ( # type: ignore[assignment] + workspace_group.id, + workspace_name or workspace_id, + ) + else: + # Use string: workspace_name_or_id + portal.workspace = workspace_name or workspace_id + + except RuntimeError as exc: + if 'timeout' not in str(exc): + raise return None diff --git a/singlestoredb/notebook/_portal.py b/singlestoredb/notebook/_portal.py index 95e0e589..86173728 100644 --- a/singlestoredb/notebook/_portal.py +++ b/singlestoredb/notebook/_portal.py @@ -56,7 +56,7 @@ def _call_javascript( args: Optional[List[Any]] = None, wait_on_condition: Optional[Callable[[], bool]] = None, timeout_message: str = 'timed out waiting on condition', - wait_interval: float = 1.0, + wait_interval: float = 2.0, timeout: float = 60.0, ) -> None: if not has_ipython or not func: