dataproc-spark-connect 1.0.0rc2__tar.gz → 1.0.0rc3__tar.gz

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.
Files changed (19) hide show
  1. {dataproc_spark_connect-1.0.0rc2 → dataproc_spark_connect-1.0.0rc3}/PKG-INFO +1 -1
  2. {dataproc_spark_connect-1.0.0rc2 → dataproc_spark_connect-1.0.0rc3}/dataproc_spark_connect.egg-info/PKG-INFO +1 -1
  3. {dataproc_spark_connect-1.0.0rc2 → dataproc_spark_connect-1.0.0rc3}/google/cloud/dataproc_spark_connect/session.py +52 -3
  4. {dataproc_spark_connect-1.0.0rc2 → dataproc_spark_connect-1.0.0rc3}/setup.py +1 -1
  5. {dataproc_spark_connect-1.0.0rc2 → dataproc_spark_connect-1.0.0rc3}/LICENSE +0 -0
  6. {dataproc_spark_connect-1.0.0rc2 → dataproc_spark_connect-1.0.0rc3}/README.md +0 -0
  7. {dataproc_spark_connect-1.0.0rc2 → dataproc_spark_connect-1.0.0rc3}/dataproc_spark_connect.egg-info/SOURCES.txt +0 -0
  8. {dataproc_spark_connect-1.0.0rc2 → dataproc_spark_connect-1.0.0rc3}/dataproc_spark_connect.egg-info/dependency_links.txt +0 -0
  9. {dataproc_spark_connect-1.0.0rc2 → dataproc_spark_connect-1.0.0rc3}/dataproc_spark_connect.egg-info/requires.txt +0 -0
  10. {dataproc_spark_connect-1.0.0rc2 → dataproc_spark_connect-1.0.0rc3}/dataproc_spark_connect.egg-info/top_level.txt +0 -0
  11. {dataproc_spark_connect-1.0.0rc2 → dataproc_spark_connect-1.0.0rc3}/google/cloud/dataproc_spark_connect/__init__.py +0 -0
  12. {dataproc_spark_connect-1.0.0rc2 → dataproc_spark_connect-1.0.0rc3}/google/cloud/dataproc_spark_connect/client/__init__.py +0 -0
  13. {dataproc_spark_connect-1.0.0rc2 → dataproc_spark_connect-1.0.0rc3}/google/cloud/dataproc_spark_connect/client/core.py +0 -0
  14. {dataproc_spark_connect-1.0.0rc2 → dataproc_spark_connect-1.0.0rc3}/google/cloud/dataproc_spark_connect/client/proxy.py +0 -0
  15. {dataproc_spark_connect-1.0.0rc2 → dataproc_spark_connect-1.0.0rc3}/google/cloud/dataproc_spark_connect/environment.py +0 -0
  16. {dataproc_spark_connect-1.0.0rc2 → dataproc_spark_connect-1.0.0rc3}/google/cloud/dataproc_spark_connect/exceptions.py +0 -0
  17. {dataproc_spark_connect-1.0.0rc2 → dataproc_spark_connect-1.0.0rc3}/google/cloud/dataproc_spark_connect/pypi_artifacts.py +0 -0
  18. {dataproc_spark_connect-1.0.0rc2 → dataproc_spark_connect-1.0.0rc3}/pyproject.toml +0 -0
  19. {dataproc_spark_connect-1.0.0rc2 → dataproc_spark_connect-1.0.0rc3}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dataproc-spark-connect
3
- Version: 1.0.0rc2
3
+ Version: 1.0.0rc3
4
4
  Summary: Dataproc client library for Spark Connect
5
5
  Home-page: https://github.com/GoogleCloudDataproc/dataproc-spark-connect-python
6
6
  Author: Google LLC
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dataproc-spark-connect
3
- Version: 1.0.0rc2
3
+ Version: 1.0.0rc3
4
4
  Summary: Dataproc client library for Spark Connect
5
5
  Home-page: https://github.com/GoogleCloudDataproc/dataproc-spark-connect-python
6
6
  Author: Google LLC
@@ -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>
@@ -20,7 +20,7 @@ long_description = (this_directory / "README.md").read_text()
20
20
 
21
21
  setup(
22
22
  name="dataproc-spark-connect",
23
- version="1.0.0rc2",
23
+ version="1.0.0rc3",
24
24
  description="Dataproc client library for Spark Connect",
25
25
  long_description=long_description,
26
26
  author="Google LLC",