Airflow 如何在Apache中处理条件决策点?

Airflow 如何在Apache中处理条件决策点?,airflow,apache-airflow-xcom,Airflow,Apache Airflow Xcom,我正在将当前的工作流转换为Apache任务。工作流程如下: 1. Run set of tests. 2. Check results - If the tests pass then move to the next set of tests. - If the tests fail, log the failure information (time, reason, what test was ran) in a database. 3. Send message

我正在将当前的工作流转换为Apache任务。工作流程如下:

1. Run set of tests.  
2. Check results
  - If the tests pass then move to the next set of tests.  
  - If the tests fail, log the failure information (time, reason, what test was ran) in a database.    
3. Send message out about failures. 
现在我有一个PythonOperator任务,它启动了一个callable,该callable根据我们存储在MongoDB中的信息执行一组测试

test_info_conn = MongoHook(conn_id='test_selector_mongo')
test_list = test_info_conn.find('test_selector_metadata', None).limit(2)

for count, current_test in enumerate(test_list):
    status_test_task = PythonOperator(
                     task_id='status_test_'+str(count),
                     python_callable=run_status_tests,
                     op_kwargs={'current_test':current_test},
                     provide_context=True,
                     dag=dag)
在这一点上,我不确定如何进行。我是否会将另一个任务链接到一个可调用的任务来处理结果,以及如何将结果链接到该链中的下一个任务?

  • 对于工作流分支(第2步),您可以使用
  • 用于在任务之间共享(日志)信息(第2至第3步),气流具有
    XCOM
    s()

参考资料

      • 对于工作流分支(第2步),您可以使用
      • 用于在任务之间共享(日志)信息(第2至第3步),气流具有
        XCOM
        s()

      参考资料