Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/345.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 成功运行任务,但未跳过_Python_Airflow - Fatal编程技术网

Python 成功运行任务,但未跳过

Python 成功运行任务,但未跳过,python,airflow,Python,Airflow,我在AirFlow中有一些任务,只有在前面的任务成功且未跳过时,我才想触发这些任务。根据AirFlow文档,如果我跳过一个任务,而下一个任务被设置为“all_success”,它将被触发。有没有办法避免这种情况 my_task = PythonOperator( task_id='task_id', python_callable=my_func, provide_context=True, trigger_rule='all_success', dag=

我在AirFlow中有一些任务,只有在前面的任务成功且未跳过时,我才想触发这些任务。根据AirFlow文档,如果我跳过一个任务,而下一个任务被设置为“all_success”,它将被触发。有没有办法避免这种情况

my_task = PythonOperator(
    task_id='task_id',
    python_callable=my_func,
    provide_context=True,
    trigger_rule='all_success',
    dag=my_dag)

人们必须意识到触发规则和跳过规则之间的相互作用 计划级别的任务。跳过的任务将通过触发器级联 规则所有的成功和失败,但不是所有的成功和失败, 一次成功,无一次失败,无一次跳过和失败


谢谢

我认为您可以修改文档中给出的分支示例。在一个分支上,首先触发none_skipped,然后是none_skipped和all_success所需的任务。默认情况下,另一个分支只会是all_success,并且只会在没有跳过的情况下围绕您希望完成的分支进行分支

run_this_first = DummyOperator(task_id='run_this_first', dag=dag)
branching = BranchPythonOperator(
    task_id='branching', dag=dag,
    python_callable=lambda: 'none_skipped_branch'
)

none_skipped_branch = DummyOperator(task_id='none_skipped_branch',trigger_rule='none_skipped', dag=dag)
none_skipped_and_all_success = DummyOperator(task_id='none_skipped_and_all_success', dag=dag)

branch_false = DummyOperator(task_id='branch_false', dag=dag)

join = DummyOperator(task_id='join', dag=dag)

run_this_first >> branching
branching >> none_skipped_branch >> none_skipped_and_all_success >> join
branching >> branch_false >> join

这是一个有趣的解决方案!谢谢你,比尔!