관리-도구
편집 파일: spark_driver.cpython-38.pyc
U �Mg� � @ s� d dl Z d dlmZ d dlmZmZ d dlmZ er\d dlmZ d dlm Z d dl mZmZ G dd � d e�Z d d� Zdd � Zdd� ZG dd� d�ZG dd� de�ZdS )� N)�Integration)�capture_internal_exceptions�ensure_integration_enabled)� TYPE_CHECKING)�Any)�Optional)�Event�Hintc @ s e Zd ZdZedd� �ZdS )�SparkIntegrationZsparkc C s t � d S �N)�patch_spark_context_init� r r �X/opt/hc_python/lib/python3.8/site-packages/sentry_sdk/integrations/spark/spark_driver.py� setup_once s zSparkIntegration.setup_onceN)�__name__� __module__�__qualname__� identifier�staticmethodr r r r r r s r c C s6 ddl m} | j}|r2|�d|j� |�d|j� dS )z� Set properties in driver that propagate to worker processes, allowing for workers to have access to those properties. This allows worker integration to have access to app_name and application_id. r ��SparkContextZsentry_app_nameZsentry_application_idN)�pysparkr �_active_spark_contextZsetLocalProperty�appName� applicationId)r Z spark_contextr r r �_set_app_properties s �r c C s4 ddl m} | j}||� t� }| j�� �|� dS )zA Start java gateway server to add custom `SparkListener` r )�ensure_callback_server_startedN)Zpyspark.java_gatewayr Z_gateway�SentryListenerZ_jsc�scZaddSparkListener)r r ZgwZlistenerr r r �_start_sentry_listener'