subkanthi commented on pull request #19729:
URL: https://github.com/apache/airflow/pull/19729#issuecomment-1047050990
> > Waiting for response from @subkanthi on the potential bug.
>
> Im actually stuck with another issue, Im pretty sure it used to work
before, For some reason the k8s_object is str and it ends up in the else block
>
> ```
> k8s_object = obj.get("pod_override", None)
>
> if k8s_legacy_object and k8s_object:
> raise AirflowConfigException(
> "Can not have both a legacy and new"
> "executor_config object. Please delete the
KubernetesExecutor"
> "dict and only use the pod_override
kubernetes.client.models.V1Pod"
> "object."
> )
> if not k8s_object and not k8s_legacy_object:
> return None
>
> print("TYPE" + str(type(k8s_object)))
> 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'
> )
> ```
>
> ```
> kube_exec_config_special = {
> "pod_override": k8s.V1Pod(
> spec=k8s.V1PodSpec(
> containers=[
> k8s.V1Container(
> name="base", image="python"
> ),
> ]
> )
> )
> }
> @task(
> executor_config=kube_exec_config_special,
> queue='kubernetes',
> task_id='task_with_kubernetes_executor',
> )
> def task_with_template():
> print_stuff()
> ```
The problem seems to be that for some reason `executor_config` seems to get
unpicked as `str`. Im trying to figure out the right combination on when it
happens.
--
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]