问题
I'm trying out airflow for orchestrating some of my data pipelines. I'm having multiple tasks for each ingestion pipeline. The tasks are getting repeated across multiple ingestion pipelines. How can I reuse a task across DAGS in airflow?
回答1:
- Just like object is an instance of a class, an Airflow task is an instance of an Operator (strictly speaking, BaseOperator)
- So write a "re-usable" (aka generic) operator and use it 100s of times across your pipeline(s) simply by passing different params (particularly
task_id
)
来源:https://stackoverflow.com/questions/57181937/reuse-tasks-in-airflow