Rdb
Remote debugger.
Attributes
| Attribute | Type | Description |
|---|---|---|
| me | string = Remote Debugger | Display label used to identify the debugger instance in logs and banners. |
| do_c | callable = do_continue | Alias for the continue command which closes the remote session and resumes program execution. |
| do_q | callable = do_quit | Alias for the quit command which closes the remote session and terminates the debugger. |
Constructor
Signature
def Rdb(
host: string = CELERY_RDB_HOST,
port: int = CELERY_RDB_PORT,
port_search_limit: int = 100,
port_skew: int = 0,
out: file-like object = sys.stdout
)
Parameters
| Name | Type | Description |
|---|---|---|
| host | string = CELERY_RDB_HOST | The hostname or IP address to bind the debugger to. |
| port | int = CELERY_RDB_PORT | The base port number to start searching for an available port. |
| port_search_limit | int = 100 | The maximum number of ports to check if the initial port is unavailable. |
| port_skew | int = 0 | An offset added to the base port number. |
| out | file-like object = sys.stdout | The output stream used for local status messages. |
Methods
get_avail_port()
@classmethod
def get_avail_port(
host: string,
port: integer,
search_limit: integer = 100,
skew: integer = +0
) - > tuple
Attempts to find and bind to an available TCP port within a specified range, accounting for process skew.
Parameters
| Name | Type | Description |
|---|---|---|
| host | string | The hostname or IP address to bind the listening socket to |
| port | integer | The base port number to start searching from |
| search_limit | integer = 100 | The maximum number of consecutive ports to check before failing |
| skew | integer = +0 | An offset added to the base port, often derived from the current process name to avoid collisions |
Returns
| Type | Description |
|---|---|
tuple | A tuple containing the bound socket object and the integer port number that was successfully acquired |
say()
@classmethod
def say(
m: string
) - > null
Writes a message to the local output stream, typically used for logging connection status and banners.
Parameters
| Name | Type | Description |
|---|---|---|
| m | string | The message string to be printed to the output stream |
Returns
| Type | Description |
|---|---|
null |
do_continue()
@classmethod
def do_continue(
arg: string
) - > integer
Closes the remote session and resumes program execution.
Parameters
| Name | Type | Description |
|---|---|---|
| arg | string | Optional arguments passed from the debugger command line |
Returns
| Type | Description |
|---|---|
integer | Returns 1 to signal the debugger loop to stop and continue execution |
do_quit()
@classmethod
def do_quit(
arg: string
) - > integer
Closes the remote session and terminates the debugger.
Parameters
| Name | Type | Description |
|---|---|---|
| arg | string | Optional arguments passed from the debugger command line |
Returns
| Type | Description |
|---|---|
integer | Returns 1 to signal the debugger loop to stop |
set_quit()
@classmethod
def set_quit() - > null
Disables the system trace function to stop debugging, which may trigger a BdbQuit exception.
Returns
| Type | Description |
|---|---|
null |