You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2022/02/18 21:51:42 UTC
[GitHub] [airflow] subkanthi edited a comment on pull request #19729: Local kubernetes executor
subkanthi edited a comment on pull request #19729:
URL: https://github.com/apache/airflow/pull/19729#issuecomment-1045231490
> 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()
```
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org