dataproc-spark-connect 0.8.0__py2.py3-none-any.whl → 0.8.2__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-0.8.0.dist-info → dataproc_spark_connect-0.8.2.dist-info}/METADATA +1 -1
- {dataproc_spark_connect-0.8.0.dist-info → dataproc_spark_connect-0.8.2.dist-info}/RECORD +6 -6
- google/cloud/dataproc_spark_connect/session.py +54 -6
- {dataproc_spark_connect-0.8.0.dist-info → dataproc_spark_connect-0.8.2.dist-info}/WHEEL +0 -0
- {dataproc_spark_connect-0.8.0.dist-info → dataproc_spark_connect-0.8.2.dist-info}/licenses/LICENSE +0 -0
- {dataproc_spark_connect-0.8.0.dist-info → dataproc_spark_connect-0.8.2.dist-info}/top_level.txt +0 -0
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
dataproc_spark_connect-0.8.
|
|
1
|
+
dataproc_spark_connect-0.8.2.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/exceptions.py,sha256=WF-qdzgdofRwILCriIkjjsmjObZfF0P3Ecg4lv-Hmec,968
|
|
4
4
|
google/cloud/dataproc_spark_connect/pypi_artifacts.py,sha256=gd-VMwiVP-EJuPp9Vf9Shx8pqps3oSKp0hBcSSZQS-A,1575
|
|
5
|
-
google/cloud/dataproc_spark_connect/session.py,sha256=
|
|
5
|
+
google/cloud/dataproc_spark_connect/session.py,sha256=Sr9ISKIJ6U5dJ13FzKQ8UC_pGeFXbchc7X3d9U5Hj48,32144
|
|
6
6
|
google/cloud/dataproc_spark_connect/client/__init__.py,sha256=6hCNSsgYlie6GuVpc5gjFsPnyeMTScTpXSPYqp1fplY,615
|
|
7
7
|
google/cloud/dataproc_spark_connect/client/core.py,sha256=m3oXTKBm3sBy6jhDu9GRecrxLb5CdEM53SgMlnJb6ag,4616
|
|
8
8
|
google/cloud/dataproc_spark_connect/client/proxy.py,sha256=qUZXvVY1yn934vE6nlO495XUZ53AUx9O74a9ozkGI9U,8976
|
|
9
|
-
dataproc_spark_connect-0.8.
|
|
10
|
-
dataproc_spark_connect-0.8.
|
|
11
|
-
dataproc_spark_connect-0.8.
|
|
12
|
-
dataproc_spark_connect-0.8.
|
|
9
|
+
dataproc_spark_connect-0.8.2.dist-info/METADATA,sha256=2PCMrKtuuab4232elYKFHiTdaJcqiM4N38ceD_AhS-E,3465
|
|
10
|
+
dataproc_spark_connect-0.8.2.dist-info/WHEEL,sha256=JNWh1Fm1UdwIQV075glCn4MVuCRs0sotJIq-J6rbxCU,109
|
|
11
|
+
dataproc_spark_connect-0.8.2.dist-info/top_level.txt,sha256=_1QvSJIhFAGfxb79D6DhB7SUw2X6T4rwnz_LLrbcD3c,7
|
|
12
|
+
dataproc_spark_connect-0.8.2.dist-info/RECORD,,
|
|
@@ -234,6 +234,9 @@ class DataprocSparkSession(SparkSession):
|
|
|
234
234
|
target=create_session_pbar
|
|
235
235
|
)
|
|
236
236
|
|
|
237
|
+
# Activate Spark Connect mode for Spark client
|
|
238
|
+
os.environ["SPARK_CONNECT_MODE_ENABLED"] = "1"
|
|
239
|
+
|
|
237
240
|
try:
|
|
238
241
|
if (
|
|
239
242
|
os.getenv(
|
|
@@ -253,10 +256,9 @@ class DataprocSparkSession(SparkSession):
|
|
|
253
256
|
operation = SessionControllerClient(
|
|
254
257
|
client_options=self._client_options
|
|
255
258
|
).create_session(session_request)
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
)
|
|
259
|
-
self._display_view_session_details_button(session_id)
|
|
259
|
+
self._display_session_link_on_creation(session_id)
|
|
260
|
+
# TODO: Add the 'View Session Details' button once the UI changes are done.
|
|
261
|
+
# self._display_view_session_details_button(session_id)
|
|
260
262
|
create_session_pbar_thread.start()
|
|
261
263
|
session_response: Session = operation.result(
|
|
262
264
|
polling=retry.Retry(
|
|
@@ -269,7 +271,7 @@ class DataprocSparkSession(SparkSession):
|
|
|
269
271
|
)
|
|
270
272
|
stop_create_session_pbar_event.set()
|
|
271
273
|
create_session_pbar_thread.join()
|
|
272
|
-
|
|
274
|
+
self._print_session_created_message()
|
|
273
275
|
file_path = (
|
|
274
276
|
DataprocSparkSession._get_active_session_file_path()
|
|
275
277
|
)
|
|
@@ -314,6 +316,46 @@ class DataprocSparkSession(SparkSession):
|
|
|
314
316
|
session_response, dataproc_config.name
|
|
315
317
|
)
|
|
316
318
|
|
|
319
|
+
def _display_session_link_on_creation(self, session_id):
|
|
320
|
+
session_url = f"https://console.cloud.google.com/dataproc/interactive/{self._region}/{session_id}?project={self._project_id}"
|
|
321
|
+
plain_message = f"Creating Dataproc Session: {session_url}"
|
|
322
|
+
html_element = f"""
|
|
323
|
+
<div>
|
|
324
|
+
<p>Creating Dataproc Spark Session<p>
|
|
325
|
+
<p><a href="{session_url}">Dataproc Session</a></p>
|
|
326
|
+
</div>
|
|
327
|
+
"""
|
|
328
|
+
|
|
329
|
+
self._output_element_or_message(plain_message, html_element)
|
|
330
|
+
|
|
331
|
+
def _print_session_created_message(self):
|
|
332
|
+
plain_message = f"Dataproc Session was successfully created"
|
|
333
|
+
html_element = f"<div><p>{plain_message}</p></div>"
|
|
334
|
+
|
|
335
|
+
self._output_element_or_message(plain_message, html_element)
|
|
336
|
+
|
|
337
|
+
def _output_element_or_message(self, plain_message, html_element):
|
|
338
|
+
"""
|
|
339
|
+
Display / print the needed rich HTML element or plain text depending
|
|
340
|
+
on whether rich element is supported or not.
|
|
341
|
+
|
|
342
|
+
:param plain_message: Message to print on non-IPython or
|
|
343
|
+
non-interactive shell
|
|
344
|
+
:param html_element: HTML element to display for interactive IPython
|
|
345
|
+
environment
|
|
346
|
+
"""
|
|
347
|
+
try:
|
|
348
|
+
from IPython.display import display, HTML
|
|
349
|
+
from IPython.core.interactiveshell import InteractiveShell
|
|
350
|
+
|
|
351
|
+
if not InteractiveShell.initialized():
|
|
352
|
+
raise DataprocSparkConnectException(
|
|
353
|
+
"Not in an Interactive IPython Environment"
|
|
354
|
+
)
|
|
355
|
+
display(HTML(html_element))
|
|
356
|
+
except (ImportError, DataprocSparkConnectException):
|
|
357
|
+
print(plain_message)
|
|
358
|
+
|
|
317
359
|
def _get_exiting_active_session(
|
|
318
360
|
self,
|
|
319
361
|
) -> Optional["DataprocSparkSession"]:
|
|
@@ -334,7 +376,8 @@ class DataprocSparkSession(SparkSession):
|
|
|
334
376
|
print(
|
|
335
377
|
f"Using existing Dataproc Session (configuration changes may not be applied): https://console.cloud.google.com/dataproc/interactive/{self._region}/{s8s_session_id}?project={self._project_id}"
|
|
336
378
|
)
|
|
337
|
-
|
|
379
|
+
# TODO: Add the 'View Session Details' button once the UI changes are done.
|
|
380
|
+
# self._display_view_session_details_button(s8s_session_id)
|
|
338
381
|
if session is None:
|
|
339
382
|
session = self.__create_spark_connect_session_from_s8s(
|
|
340
383
|
session_response, session_name
|
|
@@ -453,6 +496,11 @@ class DataprocSparkSession(SparkSession):
|
|
|
453
496
|
def _display_view_session_details_button(self, session_id):
|
|
454
497
|
try:
|
|
455
498
|
session_url = f"https://console.cloud.google.com/dataproc/interactive/sessions/{session_id}/locations/{self._region}?project={self._project_id}"
|
|
499
|
+
from IPython.core.interactiveshell import InteractiveShell
|
|
500
|
+
|
|
501
|
+
if not InteractiveShell.initialized():
|
|
502
|
+
return
|
|
503
|
+
|
|
456
504
|
from google.cloud.aiplatform.utils import _ipython_utils
|
|
457
505
|
|
|
458
506
|
_ipython_utils.display_link(
|
|
File without changes
|
{dataproc_spark_connect-0.8.0.dist-info → dataproc_spark_connect-0.8.2.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|
{dataproc_spark_connect-0.8.0.dist-info → dataproc_spark_connect-0.8.2.dist-info}/top_level.txt
RENAMED
|
File without changes
|