BigData / Apache Airflow Interview Questions
What is a DAG in Apache Airflow?
A DAG (Directed Acyclic Graph) is the core concept in Airflow. It is a collection of tasks organized with dependencies and relationships that define how they should run. The "directed" part means each edge has a direction (from one task to another). "Acyclic" means there are no loops - you cannot create a cycle where task A depends on task B which depends on task A.
A simple DAG example:
from airflow import DAG
from airflow.operators.python import PythonOperator
from datetime import datetime
with DAG('my_dag', start_date=datetime(2024, 1, 1), schedule='@daily') as dag:
t1 = PythonOperator(task_id='task_1', python_callable=lambda: print('Hello'))
t2 = PythonOperator(task_id='task_2', python_callable=lambda: print('World'))
t1 » t2 # t2 runs after t1
Invest now in Acorns!!! 🚀
Join Acorns and get your $5 bonus!
Acorns is a micro-investing app that automatically invests your "spare change" from daily purchases into diversified, expert-built portfolios of ETFs. It is designed for beginners, allowing you to start investing with as little as $5. The service automates saving and investing. Disclosure: I may receive a referral bonus.
Invest now!!! Get Free equity stock (US, UK only)!
Use Robinhood app to invest in stocks. It is safe and secure. Use the Referral link to claim your free stock when you sign up!.
The Robinhood app makes it easy to trade stocks, crypto and more.
Webull! Receive free stock by signing up using the link: Webull signup.
More Related questions...
