Kubernetes executor is broken in Airflow 1.10.11
See original GitHub issueApache Airflow version: 1.10.11
Kubernetes version (if you are using kubernetes) (use kubectl version
): v1.15.11
Environment:
- Cloud provider or hardware configuration: AWS
- OS (e.g. from /etc/os-release):
- Kernel (e.g.
uname -a
): - Install tools:
- Others:
What happened:
The scheduler can’t launch pods if KubernetesExecutor
defines pod resources
The error message:
[2020-07-14 08:00:13,853] {{kubernetes_executor.py:758}} INFO - Add task ('DAG_ID', 'TASK_ID', datetime.datetime(2020, 7, 14, 7, 0, tzinfo=<Timezone [UTC]>), 1) with command ['airflow', 'run', 'DAG_ID', 'TASK_ID', '2020-07-14T07:00:00+00:00', '--local', '--pool', 'rider_scoring', '-sd', '/opt/airflow/dags/dag.py'] with executor_config {'KubernetesExecutor': {'request_cpu': '200m', 'limit_cpu': '200m', 'request_memory': '500Mi', 'limit_memory': '500Mi'}}
[2020-07-14 08:00:13,854] {{scheduler_job.py:1383}} ERROR - Exception when executing execute_helper
Traceback (most recent call last):
File "/home/airflow/.local/lib/python3.7/site-packages/airflow/jobs/scheduler_job.py", line 1381, in _execute
self._execute_helper()
File "/home/airflow/.local/lib/python3.7/site-packages/airflow/jobs/scheduler_job.py", line 1452, in _execute_helper
if not self._validate_and_run_task_instances(simple_dag_bag=simple_dag_bag):
File "/home/airflow/.local/lib/python3.7/site-packages/airflow/jobs/scheduler_job.py", line 1514, in _validate_and_run_task_instances
self.executor.heartbeat()
File "/home/airflow/.local/lib/python3.7/site-packages/airflow/executors/base_executor.py", line 130, in heartbeat
self.trigger_tasks(open_slots)
File "/home/airflow/.local/lib/python3.7/site-packages/airflow/executors/base_executor.py", line 154, in trigger_tasks
executor_config=simple_ti.executor_config)
File "/home/airflow/.local/lib/python3.7/site-packages/airflow/executors/kubernetes_executor.py", line 761, in execute_async
kube_executor_config = PodGenerator.from_obj(executor_config)
File "/home/airflow/.local/lib/python3.7/site-packages/airflow/kubernetes/pod_generator.py", line 374, in from_obj
return PodGenerator(**namespaced).gen_pod()
TypeError: __init__() got an unexpected keyword argument 'request_cpu'
What you expected to happen:
The scheduler should launch new worker pods
How to reproduce it:
Define pod resources in KubernetesExecutor
default_args = {
'executor_config': {
'KubernetesExecutor': {
'request_cpu': "200m",
'limit_cpu': "200m",
'request_memory': "500Mi",
'limit_memory': "500Mi"
}
}
}
dag = DAG(
dag_id='foo',
default_args=default_args,
)
Anything else we need to know:
I think there are two issues:
- When #6230 has been backported to 1.10.11 branch,
namespaced['resources'] = resources
get lost. Commit in 1.10.11 PodGenerator
gets as parametersnamespaced
object which contains the content ofKubernetesExecutor
. When resources are defined inKubernetesExecutor
,PodGenerator
receivesrequest_cpu
,limit_cpu
,request_memory
,limit_memory
but they are not valid parameters forPodGenerator
. I believe we need to delete them fromnamespaced
. Another option would be to instantiatenamespaced
as an emptydict
and add only the allowed parameter forPodGenerator
.
FYI @dimberman @kaxil
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:17 (15 by maintainers)
Top Results From Across the Web
[GitHub] [airflow] thesuperzapper commented on issue #9812
[GitHub] [airflow] thesuperzapper commented on issue #9812: Kubernetes executor is broken in Airflow 1.10.11.
Read more >Changelog — Airflow Documentation - Apache Airflow
Make KubernetesExecutor recognize kubernetes_labels (#10412). Fix broken Kubernetes PodRuntimeInfoEnv (#10478).
Read more >Release Notes — Airflow Documentation
KubernetesPodOperator no longer considers any core kubernetes config params, so this section now only applies to kubernetes executor. Renaming it reduces ...
Read more >Changelog — Airflow Documentation - Apache Airflow
[AIRFLOW-XXX] Add message about breaking change in DAG#get_task_instances in 1.10.4 (#6226). [AIRFLOW-XXX] Fix incorrect units in docs for metrics using ...
Read more >Kubernetes Executor — Airflow Documentation - Apache Airflow
To troubleshoot issue with KubernetesExecutor, you can use airflow kubernetes generate-dag-yaml command. This command generates the pods as they will be ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
fixed 😃 https://github.com/apache/airflow/pull/10084.
Man this was one hell of a chaos testing, but feeling pretty good with how many situations are handled now!
@kaxil yes, we need to remove the params from
namespaced