관리-도구
편집 파일: spark_worker.cpython-38.pyc
U �Mgz � @ s� d dl Z d dlZd dlmZ d dlmZmZmZmZm Z d dl mZ ertd dl mZ d dl m Z d dlmZmZmZ G dd � d e�Zd d� Zdd � Zdd� ZdS )� N)�Integration)�capture_internal_exceptions�exc_info_from_error�!single_exception_from_error_tuple�walk_exception_chain�event_hint_with_exc_info)� TYPE_CHECKING)�Any)�Optional)�ExcInfo�Event�Hintc @ s e Zd ZdZedd� �ZdS )�SparkWorkerIntegrationZspark_workerc C s dd l m} t| _d S �Nr )Zpyspark.daemon�daemon�_sentry_worker_mainZworker_main)Zoriginal_daemon� r �X/opt/hc_python/lib/python3.8/site-packages/sentry_sdk/integrations/spark/spark_worker.py� setup_once s z!SparkWorkerIntegration.setup_onceN)�__name__� __module__�__qualname__� identifier�staticmethodr r r r r r s r c C s� t �� }ddd�}t| �} | \}}}g }t| �D ]0\}}}|tttfkr0|�t||||j |�� q0|r�|� � t| �}dd|id�}t� t j ||d� d S )NZsparkF)�typeZhandled�error�values)�level� exception)�hint)� sentry_sdk� get_clientr r � SystemExit�EOFError�ConnectionResetError�appendr �options�reverser �_tag_task_contextZ capture_event) �exc_info�clientZ mechanism�exc_type� exc_value�tb�rvr �eventr r r �_capture_exception! s, ��r0 c s* ddl m� t�� } | j� fdd��}d S )Nr ��TaskContextc s t � �� t�� �t�}� �� }|d ks0|d kr@| W 5 Q R � S | �di ��dt|�� �� | d �dt|� � �� | d �dt|� � �� | d �dt|�� �� |j�rd|jkr�| d �d|jd � | d �d|jd � d |jk�r| �di ��d|jd � W 5 Q R X | S ) N�tags�stageId�partitionId� attemptNumber� taskAttemptIdZsentry_app_nameZapp_nameZapplication_idZsentry_application_idzcallSite.short�extraZcallSite) r r r! �get_integrationr �get� setdefault�strr4 r5 r6 r7 Z_localProperties)r/ r ZintegrationZtask_contextr1 r r � process_eventE s<