
    lhz                         d dl Z d dlZd dlmZ d dlmZmZmZmZm	Z	 d dl
mZ erd dl
mZ d dl
mZ d dlmZmZmZ  G d d	e      Zd
 Zd Zd Zy)    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                        e Zd ZdZed        Zy)SparkWorkerIntegrationspark_workerc                  &    dd l m}  t        | _        y Nr   )pyspark.daemondaemon_sentry_worker_mainworker_main)original_daemons    |/var/www/pru.catia.catastroantioquia-mas.com/tasa/lib/python3.12/site-packages/sentry_sdk/integrations/spark/spark_worker.py
setup_oncez!SparkWorkerIntegration.setup_once   s     	1&9#    N)__name__
__module____qualname__
identifierstaticmethodr    r   r   r   r      s    J: :r   r   c           
         t        j                         }ddd}t        |       } | \  }}}g }t        |       D ]B  \  }}}|t        t
        t        fvs|j                  t        ||||j                  |             D |rD|j                          t        |       }dd|id}t                t        j                  ||       y y )NsparkF)typehandlederrorvalues)level	exception)hint)
sentry_sdk
get_clientr   r   
SystemExitEOFErrorConnectionResetErrorappendr   optionsreverser   _tag_task_contextcapture_event)	exc_infoclient	mechanismexc_type	exc_valuetbrvr*   events	            r   _capture_exceptionr=   !   s    ""$F U3I"8,H&Hi	B $8#A )RJ2FGGII1iV^^Y 



'1!2?  T2 
r   c                  b    ddl m t        j                         } | j                  fd       }y )Nr   )TaskContextc                    t               5  t        j                         j                  t              }j                         }||| cd d d        S | j                  di       j                  dt        |j                                      | d   j                  dt        |j                                      | d   j                  dt        |j                                      | d   j                  dt        |j                                      |j                  rd|j                  v rD| d   j                  d|j                  d          | d   j                  d|j                  d	          d
|j                  v r/| j                  di       j                  d|j                  d
          d d d        | S # 1 sw Y   | S xY w)NtagsstageIdpartitionIdattemptNumbertaskAttemptIdsentry_app_nameapp_nameapplication_idsentry_application_idzcallSite.shortextracallSite)r   r+   r,   get_integrationr   get
setdefaultstrrB   rC   rD   rE   _localProperties)r<   r*   integrationtask_contextr?   s       r   process_eventz(_tag_task_context.<locals>.process_eventE   s    )* 	$//1AA&K '??,L"l&:	 	 VR(333|3356 &M$$]C8P8P8R4ST&M$$_c,:T:T:V6WX&M$$_c,:T:T:V6WX,,$(E(EE&M,,"L$A$ABS$T &M,,($556MN
 $|'D'DD$$Wb1<<"L$A$ABR$S7	> ?	> s   =F5EF55F?)pyspark.taskcontextr?   r+   get_isolation_scopeadd_event_processor)scoperS   r?   s     @r   r3   r3   ?   s,    /**,E
! !r   c                  $   dd l m} 	  |j                  | i | y # t        $ rk t	        j
                         j                  t              At        j                         }t               5  t        |       d d d        Y y # 1 sw Y   Y y xY wY y w xY wr   )pyspark.workerworkermainr-   r+   r,   rL   r   sysr5   r   r=   )argskwargsoriginal_workerr5   s       r   r   r   j   s}    ,-d-f- -  "223IJV||~H,. -"8,- - - W-s.    AB)A?5B?B		B	BB)r\   r+   sentry_sdk.integrationsr   sentry_sdk.utilsr   r   r   r   r   typingr	   r
   r   sentry_sdk._typesr   r   r   r   r=   r3   r   r!   r   r   <module>rd      sH    
  /  !66:[ :3<(V
-r   