From 2f08499ec3bfff314f9f20d92c3361b1a35837da Mon Sep 17 00:00:00 2001 From: Andrew Ma <136692+ajma@users.noreply.github.com> Date: Thu, 24 Sep 2026 15:54:23 -0700 Subject: [PATCH] fix: give the attach path the same 10 minutes as session creation getOrCreate has two paths that each wait for a session to become usable, and their budgets had drifted apart. Creating a new session polls the long-running operation for up to 600s. Attaching to a session that already exists cannot use that machinery -- there is no operation handle -- so it hand-rolls a GetSession poll loop waiting for the Spark Connect endpoint to appear, and that loop allowed only 300s. Both are waiting on the same thing: a server finishing its boot. Since get_active_s8s_session_response treats CREATING as reusable, the attach path can land on a session that has not started yet and then give up at half the budget the create path would have allowed. Raise it to 600s so a caller gets the same 10 minutes either way. --- google/cloud/managed_spark_connect/session.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/google/cloud/managed_spark_connect/session.py b/google/cloud/managed_spark_connect/session.py index 4f76a49..1ac376f 100644 --- a/google/cloud/managed_spark_connect/session.py +++ b/google/cloud/managed_spark_connect/session.py @@ -500,7 +500,7 @@ def create_session_pbar(): ) def _wait_for_session_available( - self, session_name: str, timeout: int = 300 + self, session_name: str, timeout: int = 600 ) -> Session: start_time = time.time() while time.time() - start_time < timeout: