|
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__/ |
a
��Sh� � @ s� d Z ddlZddlZddlZddlZddlmZ ddlmZ dZ dZ
ej�d�pRdZ
eej�d �pde
�ZdgZeed
�ZdZdZd
ZdZG dd� de�Zdd� Zddd�ZdS )a6 Remote 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� r z 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.c s� e Zd ZdZdZdZdZeedde j
f� fdd� Zddd �Zd
d� Z
dd
� Zdd� Zdd� Zdd� Ze ZZdd� Ze ZZdd� Z� ZS )r zRemote debugger.zRemote DebuggerN�d r c s� 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 � d S )
NT� �:��selfc s s | ]}t |�V qd S �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�sysr r �
_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__)r r&