question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

KubernetesExecutor single task run error: Only works with the Celery or Kubernetes executors, sorry

See original GitHub issue

Apache Airflow version: 1.10.12

Kubernetes version (if you are using kubernetes) (use kubectl version): v1.16.13-gke.401

Environment: AWS EKS

  • Cloud provider or hardware configuration:
  • OS (e.g. from /etc/os-release):
  • Kernel (e.g. uname -a):
  • Install tools:
  • Others:**

What happened:

Hi Airflow community ✋ I have detected bug on Airflow webserver. I have deployed Airflow cluster that uses Kubernetes executor, runs on production AWS EKS cluster. All configurations are correct and runs successfully tasks on DAGs. But when I want to run specific task on DAG, that throws error like that:

image

But, I have checked my KubernetesExecutor configurations all of them are correct. So, I have digged error on source code of Airflow webserver at tag 1.10.12 which I have deployed version of Airflow. And found that some import errors are ignored for KubernetesExecutor on file https://github.com/apache/airflow/blob/1.10.12/airflow/www/views.py at line 1152

executor = ExecutorLoader.get_default_executor()
valid_celery_config = False
valid_kubernetes_config = False

try:
   from airflow.executors.celery_executor import CeleryExecutor  # noqa

   valid_celery_config = isinstance(executor, CeleryExecutor)
except ImportError:
    pass

try:
  from airflow.contrib.executors.kubernetes_executor import KubernetesExecutor  # noqa

   valid_kubernetes_config = isinstance(executor, KubernetesExecutor)
except ImportError:
   pass

if not valid_celery_config and not valid_kubernetes_config:
   flash("Only works with the Celery or Kubernetes executors, sorry", "error")
   return redirect(origin)

In there, bug in this code snippet

try:
  from airflow.contrib.executors.kubernetes_executor import KubernetesExecutor  # BUG IS HERE !!!

   valid_kubernetes_config = isinstance(executor, KubernetesExecutor)
except ImportError:
   pass

Import statement raises error KubernetesExecutor not found in this module because when you look that module at tag 1.10.12 https://github.com/apache/airflow/blob/1.10.12/airflow/contrib/executors/kubernetes_executor.py, there is no KubernetesExecutor class, only includes kubernetes_executor module which it is KubernetesExecutor’s location. But when you use that you need to change the code like that:

try:
  from airflow.contrib.executors.kubernetes_executor import kubernetes_executor
  
  valid_kubernetes_config = isinstance(executor, kubernetes_executor.KubernetesExecutor)
except ImportError:
   pass

or:

try:
  from airflow.executors.kubernetes_executor import KubernetesExecutor
  
  valid_kubernetes_config = isinstance(executor, KubernetesExecutor)
except ImportError:
   pass

What you expected:

Runs successfully single task with KubernetesExecutor. This error block user to run single task with KubernetesExecutor without run whole DAG.

Thanks, have a nice day 👍 😄

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:5
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
kaxilcommented, Nov 21, 2020
0reactions
mpolatcancommented, Nov 21, 2020

Thanks @kaxil, I am awaiting Airflow version 1.10.13 😄 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

Only works with the CeleryExecutor - Stack Overflow
I had a similar problem. Issue was following: With LocalExecutor you cannot run single task, you could only run the whole DAG at...
Read more >
Only works with the Celery or Kubernetes executors, sorry
... mpolatcan commented on issue #12341: KubernetesExecutor single task run error: Only works with the Celery or Kubernetes executors, sorry.
Read more >
[GitHub] [airflow] gfeldman edited a comment on issue #12341 ...
... [airflow] gfeldman edited a comment on issue #12341: KubernetesExecutor single task run error: Only works with the Celery or Kubernetes executors, sorry....
Read more >
Airflow Executors | Astronomer Documentation
The Kubernetes executor relies on a fixed single Pod that dynamically delegates work and resources. For each and every task that needs to...
Read more >
A Gentle Introduction To Understand Airflow Executor
It is similar to SequentialExecutor to run one task at a time, and it supports to work with sensors. To summary, CeleryExecutor and ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found