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

   > I think it's possible to do it in a safe way - plugging it in in the 
"pre_execute" framework and you are welcome to try it.
   
   Yes - We did exactly this, but in a custom operator instead of 
`BaseOperator` - We took the inner workings of `run_if` and `skip_if` related 
functions, minus the logic related to Python decorator itself, to add the 
specified callable to `pre_execute`. I'm seeing already how it is more 
difficult to modify `BaseOperator`!
   
   > A somewhat compelling reason not to is that you can pass a message to 
run_if and skip_if but not pre_execute. 🤷‍♂️
   
   Another compelling reason is if you have a `run_if` or `skip_if` function 
you want to re-use in two separate operators, where one supports TaskFlow and 
the other doesn't. Otherwise you need to raise `AirflowSkipException` in your 
function rather than having it return `True` or `False`, then having 
`run_if`/`skip_if` raise the exception.


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