dstandish commented on pull request #19361:
URL: https://github.com/apache/airflow/pull/19361#issuecomment-981926878


   One thing that is not mentioned here is that it's not necessary to use 
branch operator.  In any operator you can raise AirflowSkipException and it 
will skip.  And therefore you can subclass apply your skipping logic prior to 
calling `super().execute`.
   
   Given that you can implement this skipping logic easily in a subclass, we 
can think of this PR as just about implementing time-based skipping logic 
without subclassing operators.
   
   Along these lines, one thing that might be more palatable is to add to 
BaseOperator the ability to inject (using params) a callable that would be 
called in `pre_execute`.  E.g. call it `pre_execute_hook: 
Optional[Callable]=None`.  Then users could call arbitrary logic in pre_execute 
without having to subclass.  And this would open up some interesting 
possibilities where  we could inject pre_execute and  post_execute callables 
with global task policy, which I think could be very useful.
   
   


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