hussein-awala commented on PR #30718:
URL: https://github.com/apache/airflow/pull/30718#issuecomment-1556276295

   Since `on_finish_action` is a new parameter in the KPO class, we cannot 
deprecate the old parameter in the subclasses without checking if the 
`cncf-kubernetes` provider version supports the new parameter. To accomplish 
that, I had two options:
   
   Checking the provider version:
   ```python
   if sys.version_info < (3, 8):
       from importlib_metadata import version
   else:
       from importlib.metadata import version
   
   kubernetes_provider_version = 
version("apache-airflow-providers-cncf-kubernetes")
   if kubernetes_provider_version < "7.1.0":
     ...
   ```
   However, this approach doesn't work in development environments that use the 
code from source without installing the provider lib.
   
   The second option is to check if the KPO init method has the 
`on_finish_action` parameter (currently being used):
   ```python
   kpo_init_args = inspect.signature(KubernetesPodOperator.__init__).parameters
   
   if "on_finish_action" not in kpo_init_args:
     ...
   ```
   WDYT?


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