CatarinaSilva opened a new issue #10725:
URL: https://github.com/apache/airflow/issues/10725


   **Apache Airflow version**:
   
   1.10.12
   
   **What happened**:
   
   Seems that from 1.10.12 the behavior from BranchPythonOperator was reversed. 
A task after all branches would be excluded from the skipped tasks before but 
now it is skipped. This prevents empty branches.
   
   **What you expected to happen**:
   
   Tasks after all branches should respect the trigger_rule and not be 
automatically skipped by the branch operator
   
   **How to reproduce it**:
   
   Run following code in a dag:
   
   ```
       def needs_some_extra_task(some_bool_field, **kwargs):
           if some_bool_field:
               return f"extra_task"
           else:
               return f"final_task"
   
       branch_op = BranchPythonOperator(
           dag=dag,
           task_id=f"branch_task",
           provide_context=True,
           python_callable=needs_some_extra_task,
           op_kwargs={"some_bool_field": True},  # For purposes of showing the 
problem
       )
   
       # will be always ran in this example
       extra_op = DummyOperator(
           dag=dag,
           task_id=f"extra_task",
       )
       extra_op.set_upstream(branch_op)
   
       # will be skipped
       final_op = DummyOperator(
           dag=dag,
           task_id="final_task",
           trigger_rule="none_failed_or_skipped",
       )
       final_op.set_upstream([extra_op, branch_op])
   
   ```
   
   **Temporary workaround**:
   
   Add dummy operators to any branch with no tasks


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to