You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/01/18 04:19:02 UTC

[GitHub] [airflow] ashmeet13 edited a comment on issue #13704: BaseBranchOperator should push to xcom by default

ashmeet13 edited a comment on issue #13704:
URL: https://github.com/apache/airflow/issues/13704#issuecomment-761860689


   Hi!
   I would like to pick this issue up if it's open and not being worked upon.
   
   From what I understand the [execute](https://github.com/apache/airflow/blob/8af5a33950cfe59a38931a8a605394ef0cbc3c08/airflow/operators/branch.py#L51) function in BaseBranchOperator does not return the value calculated by [choose_branch](https://github.com/apache/airflow/blob/8af5a33950cfe59a38931a8a605394ef0cbc3c08/airflow/operators/branch.py#L40).
   
   A simple change from - 
   ```
       def execute(self, context: Dict):
           self.skip_all_except(context['ti'], self.choose_branch(context))
   ```
   
   to 
   
   ```
       def execute(self, context: Dict):
           branches_to_execute = self.choose_branch(context)
           self.skip_all_except(context['ti'], branches_to_execute)
           return branches_to_execute
   ```
   
   should do the trick and `do_xcom_push=True` should be usable
   New to Airflow so please do correct me if I am wrong!
   
   Thank you.


----------------------------------------------------------------
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:
users@infra.apache.org