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/15 17:51:07 UTC

[GitHub] [airflow] HaloKo4 opened a new issue #13704: BaseBranchOperator should push to xcom by default

HaloKo4 opened a new issue #13704:
URL: https://github.com/apache/airflow/issues/13704


   **Apache Airflow version**: 2.0.0
   
   **Kubernetes version (if you are using kubernetes)** (use `kubectl version`):
   Not relevant 
   
   **Environment**:
   Not relevant 
   
   **What happened**:
   
   BranchPythonOperator performs xcom push by default since this is the behavior of PythonOperator.
   However BaseBranchOperator doesn't do xcom push.
   
   
   **What you expected to happen**:
   BaseBranchOperator to do xcom push of the branch it choose to follow as the default.
   
   


----------------------------------------------------------------
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



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

Posted by GitBox <gi...@apache.org>.
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



[GitHub] [airflow] kaxil closed issue #13704: BaseBranchOperator should push to xcom by default

Posted by GitBox <gi...@apache.org>.
kaxil closed issue #13704:
URL: https://github.com/apache/airflow/issues/13704


   


----------------------------------------------------------------
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



[GitHub] [airflow] kaxil closed issue #13704: BaseBranchOperator should push to xcom by default

Posted by GitBox <gi...@apache.org>.
kaxil closed issue #13704:
URL: https://github.com/apache/airflow/issues/13704


   


----------------------------------------------------------------
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



[GitHub] [airflow] turbaszek commented on issue #13704: BaseBranchOperator should push to xcom by default

Posted by GitBox <gi...@apache.org>.
turbaszek commented on issue #13704:
URL: https://github.com/apache/airflow/issues/13704#issuecomment-761096056


   > It's impossible to push to xcom manually
   
   Strictly speaking it is possible because you can override the `execute` method in your custom branch operator.
   
   Apart from that your suggestion make sense to me - I don't see any drawbacks to that. Would you mind opening a PR?


----------------------------------------------------------------
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



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

Posted by GitBox <gi...@apache.org>.
ashmeet13 commented 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)
   ```
   
   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