potiuk commented on issue #23803:
URL: https://github.com/apache/airflow/issues/23803#issuecomment-1134330504

   Also - another thing I usually recommend in this case - maybe this is not 
really a big problem that you cannot use it in classsic Airflow Operators. I 
think - personally - we should move away from classic operators and if you 
really want to use the "modern" way of writing DAGs, simply stop using them.
   
   Pretty much all the "classic" operators are usually thin wrappers over the 
Hooks. This has always been the case, but with the taskflow api, this is much 
more "viable" than ever to use this pattern:
   
   ```
   @task
   def run_task(param):
       .... # params here
       hook = CreateMyHook(connection=connection)
       hook.run_hook_methods_here()
   ```
   
   Arguably - this is not as easy with KubernetesPodOperator - because it is 
pretty "thick" comparing to other operators and has a lot of logic for pod 
templates generation and such - so temporarily, the proposal by @uranusjr  
might make sense, but with some recent changes that are coming - i.e. 
https://github.com/apache/airflow/pull/20578 and 
https://github.com/apache/airflow/pull/21077 (they will come in 2.4 most 
likely) even KPO will move to the "taskflow" world.
   
   Which might actaully mean that we do not have to do anything with classic 
operators here.
   


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