我下面有一个工作流程。我要做的是如果所有父母都处于成功或跳过状态,则运行join
任务。为此,我使用了none_failed
触发规则,但是当所有上游任务都处于skipped
状态时出现了问题,因此下游任务join
被自动跳过了。有什么解决办法,如果所有父母都是join
,我可以运行skipped
任务吗?触发规则all_done
不适合我。
Airflow workflow
dag = DAG(
dag_id="branch_without_trigger",
schedule_interval="@once",
start_date=dt.datetime(2019, 2, 28),
)
def fun():
raise AirflowSkipException("exception")
run_this_first = DummyOperator(task_id="run_this_first", dag=dag)
branching = DummyOperator(task_id="branching", dag=dag, python_callable=fun)
branch_a = DummyOperator(task_id="branch_a", dag=dag)
follow_branch_a = PythonOperator(
task_id="follow_branch_a", dag=dag, python_callable=fun
)
branch_b = PythonOperator(task_id="branch_b", dag=dag, python_callable=fun)
join = DummyOperator(task_id="join", dag=dag, trigger_rule="none_failed")
run_this_first.set_downstream(branching)
branching >> branch_a >> follow_branch_a >> join
branching >> branch_b >> join