rawwar opened a new pull request, #51763:
URL: https://github.com/apache/airflow/pull/51763
Using debugpy to run airflow components so that we can use IDE's as Vscode
to attach to the component to debug.
Ports for components are as follows:
```
BREEZE_DEBUG_SCHEDULER_PORT = "50231"
BREEZE_DEBUG_DAG_PROCESSOR_PORT = "50232"
BREEZE_DEBUG_API_SERVER_PORT = "50233"
BREEZE_DEBUG_CELERY_WORKER_PORT = "50234"
BREEZE_DEBUG_EDGE_PORT = "50235"
BREEZE_DEBUG_FLOWER_PORT = "50236"
```
Env variables to use debugpy to run a component are below
```
BREEZE_DEBUG_SCHEDULER
BREEZE_DEBUG_APISERVER or BREEZE_DEBUG_WEBSERVER
BREEZE_DEBUG_TRIGGERER_PORT
BREEZE_DEBUG_CELERY_WORKER_PORT
BREEZE_DEBUG_FLOWER
BREEZE_DEBUG_EDGE
BREEZE_DEBUG_DAG_PROCESSOR
```
When using breeze, we can add above env to
`files/airflow-breeze-config/environment_variables.env`.
For example, to run the scheduler via debugpy:
```
BREEZE_DEBUG_SCHEDULER=true
```
debugpy will be listening at port 50231. I use VS Code. So, using vscode, I
can add following to configuration in "launch.json" and start debugging:
```
{
"name": "Scheduler Debug(Breeze)",
"type": "debugpy",
"request": "attach",
"justMyCode": false,
"connect": {
"host": "localhost",
"port": 50231,
},
"pathMappings": [
{
"localRoot": "${workspaceFolder}",
"remoteRoot": "/opt/airflow"
}
]
},
```
Once I start breeze, Scheduler pane will be waiting as shown in screenshot:
<img width="1702" alt="image"
src="https://github.com/user-attachments/assets/7b9518c9-ad78-4dfd-a367-595b58850a21"
/>
In VSCode, I can place an arbitrary debug point and start debugging and it
will pause as shown below:

I am sure, this can be done via PyCharm as well. But, I haven't tested it
yet.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]