如何在Airflow Operator中跳过任务? [英] How to skip task in Airflow operator?
本文介绍了如何在Airflow Operator中跳过任务?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Airflow是否可以从PythonOperator跳过当前任务?例如:
Is there a way for Airflow to skip current task from the PythonOperator? For example:
def execute():
if condition:
skip_current_task()
task = PythonOperator(task_id='task', python_callable=execute, dag=some_dag)
还将任务标记为已跳过"在Airflow UI中?
And also marking the task as "Skipped" in Airflow UI?
推荐答案
想通了!跳过任务很容易:
Figured it out! Skipping task is as easy as:
def execute():
if condition:
raise AirflowSkipException
task = PythonOperator(task_id='task', python_callable=execute, dag=some_dag)
这篇关于如何在Airflow Operator中跳过任务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文