subkanthi opened a new issue #21717:
URL: https://github.com/apache/airflow/issues/21717


   ### Apache Airflow version
   
   2.2.3 (latest released)
   
   ### What happened
   
   ```
       start_task_executor_config = {
           "pod_override": 
k8s.V1Pod(metadata=k8s.V1ObjectMeta(annotations={"test": "annotation"}))
       }
       @task(
           executor_config=start_task_executor_config,
           queue='kubernetes',
           task_id='task_with_kubernetes_executor',
       )
       def task_with_template():
           print_stuff()
   ```
   When the k8s task is defined with the decorator and when executor_config is 
passed, it seems to be picked as `str`.
   
   In pod_generator.py, it throws the following type error, because it gets 
unpicked as `str` and fails the `if isinstance(` checks
   
   ```
           if isinstance(k8s_object, k8s.V1Pod):
               return k8s_object
           elif isinstance(k8s_legacy_object, dict):
               warnings.warn(
                   'Using a dictionary for the executor_config is deprecated 
and will soon be removed.'
                   'please use a `kubernetes.client.models.V1Pod` class with a 
"pod_override" key'
                   ' instead. ',
                   category=DeprecationWarning,
               )
               return PodGenerator.from_legacy_obj(obj)
           else:
               raise TypeError(
                   'Cannot convert a non-kubernetes.client.models.V1Pod object 
into a KubernetesExecutorConfig'
               )
   ```
   
   ### What you expected to happen
   
   _No response_
   
   ### How to reproduce
   
   _No response_
   
   ### Operating System
   
   Ubuntu
   
   ### Versions of Apache Airflow Providers
   
   _No response_
   
   ### Deployment
   
   Other
   
   ### Deployment details
   
   _No response_
   
   ### Anything else
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


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