Skip to content

Commit fc6ecff

Browse files
authored
Merge branch 'main' into upgrade-ray-2.30
2 parents a1e6f3c + aece852 commit fc6ecff

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

awswrangler/athena/_spark.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ def create_spark_session(
9494
default_executor_dpu_size: int = 1,
9595
additional_configs: dict[str, Any] | None = None,
9696
spark_properties: dict[str, Any] | None = None,
97+
notebook_version: str | None = None,
9798
idle_timeout: int = 15,
9899
boto3_session: boto3.Session | None = None,
99100
) -> str:
@@ -116,8 +117,11 @@ def create_spark_session(
116117
spark_properties: Dict[str, Any], optional
117118
Contains SparkProperties in the form of key-value pairs.Specifies custom jar files and Spark properties
118119
for use cases like cluster encryption, table formats, and general Spark tuning.
120+
notebook_version: str, optional
121+
The notebook version. This value is supplied automatically for notebook sessions in the Athena console and is not required for programmatic session access.
122+
The only valid notebook version is Athena notebook version 1. If you specify a value for NotebookVersion, you must also specify a value for NotebookId
119123
idle_timeout : int, optional
120-
The idle timeout in minutes for the session. The default is 15.
124+
The idle timeout in minutes for the session. The default is 15.
121125
boto3_session : boto3.Session(), optional
122126
Boto3 Session. The default boto3 session will be used if boto3_session receive None.
123127
@@ -142,10 +146,13 @@ def create_spark_session(
142146
engine_configuration["AdditionalConfigs"] = additional_configs
143147
if spark_properties:
144148
engine_configuration["SparkProperties"] = spark_properties
149+
kwargs: Any = {"SessionIdleTimeoutInMinutes": idle_timeout}
150+
if notebook_version:
151+
kwargs["NotebookVersion"] = notebook_version
145152
response = client_athena.start_session(
146153
WorkGroup=workgroup,
147154
EngineConfiguration=engine_configuration,
148-
SessionIdleTimeoutInMinutes=idle_timeout,
155+
**kwargs,
149156
)
150157
_logger.info("Session info:\n%s", response)
151158
session_id: str = response["SessionId"]
@@ -166,6 +173,7 @@ def run_spark_calculation(
166173
default_executor_dpu_size: int = 1,
167174
additional_configs: dict[str, Any] | None = None,
168175
spark_properties: dict[str, Any] | None = None,
176+
notebook_version: str | None = None,
169177
idle_timeout: int = 15,
170178
boto3_session: boto3.Session | None = None,
171179
) -> dict[str, Any]:
@@ -192,6 +200,9 @@ def run_spark_calculation(
192200
spark_properties: Dict[str, Any], optional
193201
Contains SparkProperties in the form of key-value pairs.Specifies custom jar files and Spark properties
194202
for use cases like cluster encryption, table formats, and general Spark tuning.
203+
notebook_version: str, optional
204+
The notebook version. This value is supplied automatically for notebook sessions in the Athena console and is not required for programmatic session access.
205+
The only valid notebook version is Athena notebook version 1. If you specify a value for NotebookVersion, you must also specify a value for NotebookId
195206
idle_timeout : int, optional
196207
The idle timeout in minutes for the session. The default is 15.
197208
boto3_session : boto3.Session(), optional
@@ -221,6 +232,7 @@ def run_spark_calculation(
221232
default_executor_dpu_size=default_executor_dpu_size,
222233
additional_configs=additional_configs,
223234
spark_properties=spark_properties,
235+
notebook_version=notebook_version,
224236
idle_timeout=idle_timeout,
225237
boto3_session=boto3_session,
226238
)

0 commit comments

Comments
 (0)