To be able to debug Apache Airflow using Visual Studio Code, we first want to build a Docker image from the sources. Start by cloning the apache airflow github repository and then open the folder using VS Code.
In the Dockerfile, change the following values:
Then build the image with the new settings and then run it but overriding the entry point:
In the container, first install debugpy.
We'll need the installed location of the airflow code for our launch.json configuration file. You can find it by running:
Now, while in the running container, start airflow, here I'll just call --help, in the container with:
In the cloned repository directory, create a launch.json file in the .vscode directory. The value for remoteRoot should be taken from the output of the "python -m pip -V" above
In VS Code open the __main__.py file in the apache folder of the project and place your break points. Now run the debug using the launch.json file:
Of course the "Here we go!!!!" is from me :>)