Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
mpolatcan opened this issue Nov 13, 2020 · 5 comments
Assignees
Labels
area:webserver Webserver related Issues kind:bug This is a clearly a bug provider:cncf-kubernetes Kubernetes provider related issues

Comments

@mpolatcan
Copy link
Contributor

mpolatcan commented Nov 13, 2020

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

@mpolatcan mpolatcan added the kind:bug This is a clearly a bug label Nov 13, 2020
@boring-cyborg
Copy link

boring-cyborg bot commented Nov 13, 2020

Thanks for opening your first issue here! Be sure to follow the issue template!

@gfeldman
Copy link

gfeldman commented Nov 21, 2020

Confirming @mpolatcan diagnosis and that changing the import from airflow.contrib.executors.kubernetes_executor to airflow.executors.kubernetes_executor in airflow/www/views.py and airflow/www_rbac/views.py resolves the issue.

@turbaszek
Copy link
Member

CC @dimberman @kaxil , should we release this in 1.10.13?

@turbaszek turbaszek added area:k8s area:webserver Webserver related Issues labels Nov 21, 2020
@kaxil
Copy link
Member

kaxil commented Nov 21, 2020

This is already fixed in 1.10.13rc1 : 25c16e8

@kaxil kaxil closed this as completed Nov 21, 2020
@kaxil kaxil added this to the Airflow 1.10.13 milestone Nov 21, 2020
@mpolatcan
Copy link
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:webserver Webserver related Issues kind:bug This is a clearly a bug provider:cncf-kubernetes Kubernetes provider related issues
Projects
None yet
Development

No branches or pull requests

6 participants