matthewblock commented on issue #44205:
URL: https://github.com/apache/airflow/issues/44205#issuecomment-2487401760

   I have never submitted a PR, but my team wrote some working code to add this 
to our custom operator so I want to try to contribute this functionality.
   
   My initial thought was this could be added as arguments to `BaseOperator`:
   
   ```
   run_if_condition: None | AnyConditionFunc = None,
   run_if_message: None | str,
   skip_if_condition: None | AnyConditionFunc = None,
   skip_if_message: None | str,
   ```
   
   Then a lot of the code in `airflow.decorators.condition` could move to 
`airflow.models.baseoperator`, and the existing `run_if` and `skip_if` 
decorators could be modified to utilize these new arguments.
   
   I am also seeing that in the 
[discussion](https://github.com/apache/airflow/discussions/36479) that led to 
[the `run_if` and `skip_if` PR](https://github.com/apache/airflow/pull/41116), 
it's recommended to just use `pre_execute` for this purpose. A somewhat 
compelling reason not to is that you can pass a message to `run_if` and 
`skip_if` but not `pre_execute`. 🤷‍♂️ 
   
   Any thoughts?


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

To unsubscribe, e-mail: [email protected]

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

Reply via email to