Usually we debug DAG through the shell command, which looks like
airflow test dag_id task_id date
But this is not an efficient way to debug, It cannot add breakpoints. So we need to analyze through a large number of debugging logs. can not be very friendly to watch the values of the variables at that time.
We can use PyCharm to debug airflow DAG, just like debugging regular python scripts, to improve our debugging efficiency.
We just need to add the following code:
if __name__ == '__main__': dag.cli()
Configure the debugging configuration like in the screenshot, And run the main function. Now we can debug using breakpoints.