How to find dependent tasks for a given DAG


Hi, I’m creating a bash script to validate the set of DAGs. I can get the DAG name by looping through the directory names. My question is how to get the task names for the given DAG and its dependencies?

For eg.
Dag Name : dag_1
Tasks : T1 >> T2 >> T3

I need the tasks names dynamically to pass to the below command
airflow dag_1 T1

Please share if you have answer.