Reuse tasks in airflow

允我心安 提交于 2021-01-24 10:58:06

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!