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 664348c1..86173728 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 = 5.0, + wait_interval: float = 2.0, + timeout: float = 60.0, ) -> None: if not has_ipython or not func: return