dataproc-spark-connect 1.0.0rc2__py2.py3-none-any.whl → 1.0.0rc3__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {dataproc_spark_connect-1.0.0rc2.dist-info → dataproc_spark_connect-1.0.0rc3.dist-info}/METADATA +1 -1
- {dataproc_spark_connect-1.0.0rc2.dist-info → dataproc_spark_connect-1.0.0rc3.dist-info}/RECORD +6 -6
- google/cloud/dataproc_spark_connect/session.py +52 -3
- {dataproc_spark_connect-1.0.0rc2.dist-info → dataproc_spark_connect-1.0.0rc3.dist-info}/WHEEL +0 -0
- {dataproc_spark_connect-1.0.0rc2.dist-info → dataproc_spark_connect-1.0.0rc3.dist-info}/licenses/LICENSE +0 -0
- {dataproc_spark_connect-1.0.0rc2.dist-info → dataproc_spark_connect-1.0.0rc3.dist-info}/top_level.txt +0 -0
{dataproc_spark_connect-1.0.0rc2.dist-info → dataproc_spark_connect-1.0.0rc3.dist-info}/RECORD
RENAMED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
dataproc_spark_connect-1.0.
|
|
1
|
+
dataproc_spark_connect-1.0.0rc3.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
2
2
|
google/cloud/dataproc_spark_connect/__init__.py,sha256=dIqHNWVWWrSuRf26x11kX5e9yMKSHCtmI_GBj1-FDdE,1101
|
|
3
3
|
google/cloud/dataproc_spark_connect/environment.py,sha256=l1wWiHMHtBQ9YonE-kHTpaZlN9vLE4fyJSTn7RZP6kA,2503
|
|
4
4
|
google/cloud/dataproc_spark_connect/exceptions.py,sha256=WF-qdzgdofRwILCriIkjjsmjObZfF0P3Ecg4lv-Hmec,968
|
|
5
5
|
google/cloud/dataproc_spark_connect/pypi_artifacts.py,sha256=gd-VMwiVP-EJuPp9Vf9Shx8pqps3oSKp0hBcSSZQS-A,1575
|
|
6
|
-
google/cloud/dataproc_spark_connect/session.py,sha256=
|
|
6
|
+
google/cloud/dataproc_spark_connect/session.py,sha256=u2QxRLn84EMdpFnv9pI6Y7F8OFQ2mqCllb6AsLd73eo,42402
|
|
7
7
|
google/cloud/dataproc_spark_connect/client/__init__.py,sha256=6hCNSsgYlie6GuVpc5gjFsPnyeMTScTpXSPYqp1fplY,615
|
|
8
8
|
google/cloud/dataproc_spark_connect/client/core.py,sha256=GRc4OCTBvIvdagjxOPoDO22vLtt8xDSerdREMRDeUBY,4659
|
|
9
9
|
google/cloud/dataproc_spark_connect/client/proxy.py,sha256=qUZXvVY1yn934vE6nlO495XUZ53AUx9O74a9ozkGI9U,8976
|
|
10
|
-
dataproc_spark_connect-1.0.
|
|
11
|
-
dataproc_spark_connect-1.0.
|
|
12
|
-
dataproc_spark_connect-1.0.
|
|
13
|
-
dataproc_spark_connect-1.0.
|
|
10
|
+
dataproc_spark_connect-1.0.0rc3.dist-info/METADATA,sha256=yUMy-S__bGisjsxduDg_VmJzF3ZKqCybaNUwn5DMymo,3468
|
|
11
|
+
dataproc_spark_connect-1.0.0rc3.dist-info/WHEEL,sha256=JNWh1Fm1UdwIQV075glCn4MVuCRs0sotJIq-J6rbxCU,109
|
|
12
|
+
dataproc_spark_connect-1.0.0rc3.dist-info/top_level.txt,sha256=_1QvSJIhFAGfxb79D6DhB7SUw2X6T4rwnz_LLrbcD3c,7
|
|
13
|
+
dataproc_spark_connect-1.0.0rc3.dist-info/RECORD,,
|
|
@@ -24,6 +24,7 @@ import threading
|
|
|
24
24
|
import time
|
|
25
25
|
import uuid
|
|
26
26
|
import tqdm
|
|
27
|
+
from packaging import version
|
|
27
28
|
from tqdm import tqdm as cli_tqdm
|
|
28
29
|
from tqdm.notebook import tqdm as notebook_tqdm
|
|
29
30
|
from types import MethodType
|
|
@@ -106,6 +107,7 @@ class DataprocSparkSession(SparkSession):
|
|
|
106
107
|
"""
|
|
107
108
|
|
|
108
109
|
_DEFAULT_RUNTIME_VERSION = "3.0"
|
|
110
|
+
_MIN_RUNTIME_VERSION = "3.0"
|
|
109
111
|
|
|
110
112
|
_active_s8s_session_uuid: ClassVar[Optional[str]] = None
|
|
111
113
|
_project_id = None
|
|
@@ -254,6 +256,7 @@ class DataprocSparkSession(SparkSession):
|
|
|
254
256
|
session._register_progress_execution_handler()
|
|
255
257
|
|
|
256
258
|
DataprocSparkSession._set_default_and_active_session(session)
|
|
259
|
+
|
|
257
260
|
return session
|
|
258
261
|
|
|
259
262
|
def __create(self) -> "DataprocSparkSession":
|
|
@@ -268,6 +271,9 @@ class DataprocSparkSession(SparkSession):
|
|
|
268
271
|
|
|
269
272
|
dataproc_config: Session = self._get_dataproc_config()
|
|
270
273
|
|
|
274
|
+
# Check runtime version compatibility before creating session
|
|
275
|
+
self._check_runtime_compatibility(dataproc_config)
|
|
276
|
+
|
|
271
277
|
session_id = self.generate_dataproc_session_id()
|
|
272
278
|
dataproc_config.name = f"projects/{self._project_id}/locations/{self._region}/sessions/{session_id}"
|
|
273
279
|
logger.debug(
|
|
@@ -599,6 +605,43 @@ class DataprocSparkSession(SparkSession):
|
|
|
599
605
|
stacklevel=3,
|
|
600
606
|
)
|
|
601
607
|
|
|
608
|
+
def _check_runtime_compatibility(self, dataproc_config):
|
|
609
|
+
"""Check if runtime version 3.0 client is compatible with older runtime versions.
|
|
610
|
+
|
|
611
|
+
Runtime version 3.0 clients do not support older runtime versions (pre-3.0).
|
|
612
|
+
There is no backward or forward compatibility between different runtime versions.
|
|
613
|
+
|
|
614
|
+
Args:
|
|
615
|
+
dataproc_config: The Session configuration containing runtime version
|
|
616
|
+
|
|
617
|
+
Raises:
|
|
618
|
+
DataprocSparkConnectException: If server is using pre-3.0 runtime version
|
|
619
|
+
"""
|
|
620
|
+
runtime_version = dataproc_config.runtime_config.version
|
|
621
|
+
|
|
622
|
+
if not runtime_version:
|
|
623
|
+
return
|
|
624
|
+
|
|
625
|
+
logger.debug(f"Detected server runtime version: {runtime_version}")
|
|
626
|
+
|
|
627
|
+
# Parse runtime version to check if it's below minimum supported version
|
|
628
|
+
try:
|
|
629
|
+
server_version = version.parse(runtime_version)
|
|
630
|
+
min_version = version.parse(
|
|
631
|
+
DataprocSparkSession._MIN_RUNTIME_VERSION
|
|
632
|
+
)
|
|
633
|
+
|
|
634
|
+
if server_version < min_version:
|
|
635
|
+
raise DataprocSparkConnectException(
|
|
636
|
+
f"Specified {runtime_version} Dataproc Runtime version is not supported, "
|
|
637
|
+
f"use {DataprocSparkSession._MIN_RUNTIME_VERSION} version or higher."
|
|
638
|
+
)
|
|
639
|
+
except version.InvalidVersion:
|
|
640
|
+
# If we can't parse the version, log a warning but continue
|
|
641
|
+
logger.warning(
|
|
642
|
+
f"Could not parse runtime version: {runtime_version}"
|
|
643
|
+
)
|
|
644
|
+
|
|
602
645
|
def _display_view_session_details_button(self, session_id):
|
|
603
646
|
try:
|
|
604
647
|
session_url = f"https://console.cloud.google.com/dataproc/interactive/sessions/{session_id}/locations/{self._region}?project={self._project_id}"
|
|
@@ -789,6 +832,11 @@ class DataprocSparkSession(SparkSession):
|
|
|
789
832
|
"""
|
|
790
833
|
|
|
791
834
|
def _display_operation_link(self, operation_id: str):
|
|
835
|
+
# Don't print per-operation Spark UI link for non-interactive (despite
|
|
836
|
+
# Ipython or non-IPython)
|
|
837
|
+
if not environment.is_interactive():
|
|
838
|
+
return
|
|
839
|
+
|
|
792
840
|
assert all(
|
|
793
841
|
[
|
|
794
842
|
operation_id is not None,
|
|
@@ -804,12 +852,13 @@ class DataprocSparkSession(SparkSession):
|
|
|
804
852
|
f"associatedSqlOperationId={operation_id}?project={self._project_id}"
|
|
805
853
|
)
|
|
806
854
|
|
|
855
|
+
if environment.is_interactive_terminal():
|
|
856
|
+
print(f"Spark Query: {url}")
|
|
857
|
+
return
|
|
858
|
+
|
|
807
859
|
try:
|
|
808
860
|
from IPython.display import display, HTML
|
|
809
|
-
from IPython.core.interactiveshell import InteractiveShell
|
|
810
861
|
|
|
811
|
-
if not InteractiveShell.initialized():
|
|
812
|
-
return
|
|
813
862
|
html_element = f"""
|
|
814
863
|
<div>
|
|
815
864
|
<p><a href="{url}">Spark Query</a> (Operation: {operation_id})</p>
|
{dataproc_spark_connect-1.0.0rc2.dist-info → dataproc_spark_connect-1.0.0rc3.dist-info}/WHEEL
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|