Repository navigation
Closed
Labels
area:corekind:bugThis is a clearly a bugneeds-triagelabel for new issues that we didn't triage yetprovider:cncf-kubernetesKubernetes (k8s) provider related issues
Milestone
Description
Apache Airflow version
Other Airflow 2 version (please specify below)
If "Other Airflow 2 version" selected, which one?
2.10.0 Python 3.12
What happened?
UPDATE: I think the CeleryKubernetesExecutor class should inherit BaseExecutor instead of LoggingMixin. BaseExecutor has the slots_occupied method implemented.
I get an error in the scheduler when I use CeleryKubernetesExecutor. My Airflow installation is on Kubernetes with the official Helm chart.
/home/airflow/.local/lib/python3.12/site-packages/airflow/providers/cncf/kubernetes/executors/kubernetes_executor.py:143 FutureWarning: The config section [kubernetes] has been renamed to [kubernetes_executor]. Please update your `conf.get*` call to use the new name
[2024-08-16T11:55:08.527+0200] {executor_loader.py:254} INFO - Loaded executor: CeleryKubernetesExecutor
[2024-08-16T11:55:08.826+0200] {scheduler_job_runner.py:935} INFO - Starting the scheduler
[2024-08-16T11:55:08.827+0200] {scheduler_job_runner.py:942} INFO - Processing each file at most -1 times
[2024-08-16T11:55:08.828+0200] {ecs_executor.py:181} INFO - Loading Connection information
[2024-08-16T11:55:09.724+0200] {base.py:84} INFO - Retrieving connection 'aws_default'
[2024-08-16T11:55:11.322+0200] {executor_loader.py:254} INFO - Loaded executor: airflow.providers.amazon.aws.executors.ecs.AwsEcsExecutor
[2024-08-16T11:55:11.323+0200] {kubernetes_executor.py:287} INFO - Start Kubernetes executor
[2024-08-16T11:55:11.435+0200] {kubernetes_executor_utils.py:140} INFO - Event: and now my watch begins starting at resource_version: 0
[2024-08-16T11:55:11.623+0200] {kubernetes_executor.py:208} INFO - Found 0 queued task instances
[2024-08-16T11:55:11.625+0200] {ecs_executor.py:125} INFO - Starting ECS Executor and determining health...
[2024-08-16T11:55:12.119+0200] {ecs_executor.py:173} INFO - ECS Executor health check has succeeded.
[2024-08-16T11:55:12.120+0200] {scheduler_job_runner.py:1843} INFO - Adopting or resetting orphaned tasks for active dag runs
[2024-08-16T11:55:12.246+0200] {scheduler_job_runner.py:1001} ERROR - Exception when executing SchedulerJob._run_scheduler_loop
Traceback (most recent call last):
File "/home/airflow/.local/lib/python3.12/site-packages/airflow/jobs/scheduler_job_runner.py", line 984, in _execute
self._run_scheduler_loop()
File "/home/airflow/.local/lib/python3.12/site-packages/airflow/jobs/scheduler_job_runner.py", line 1121, in _run_scheduler_loop
num_queued_tis = self._do_scheduling(session)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/airflow/.local/lib/python3.12/site-packages/airflow/jobs/scheduler_job_runner.py", line 1264, in _do_scheduling
num_queued_tis = self._critical_section_enqueue_task_instances(session=session)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/airflow/.local/lib/python3.12/site-packages/airflow/jobs/scheduler_job_runner.py", line 718, in _critical_section_enqueue_task_instances
num_occupied_slots = sum([executor.slots_occupied for executor in self.job.executors])
^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'CeleryKubernetesExecutor' object has no attribute 'slots_occupied'
[2024-08-16T11:55:12.330+0200] {kubernetes_executor.py:752} INFO - Shutting down Kubernetes executor
[2024-08-16T11:55:12.529+0200] {scheduler_job_runner.py:1014} INFO - Exited execute loop
What you think should happen instead?
No response
How to reproduce
Install Airflow with the official Helm chart with CeleryKubernetesExecutor and the scheduler container will raise this exception.
Operating System
Kubernetes, Linux
Versions of Apache Airflow Providers
No response
Deployment
Official Apache Airflow Helm Chart
Deployment details
No response
Anything else?
No response
Are you willing to submit PR?
- Yes I am willing to submit a PR!
Code of Conduct
- I agree to follow this project's Code of Conduct
Reacted by Marcin Szymański and Brian Hayden
Metadata
Metadata
Assignees
Labels
area:corekind:bugThis is a clearly a bugneeds-triagelabel for new issues that we didn't triage yetprovider:cncf-kubernetesKubernetes (k8s) provider related issues
Activity
salam-abdul commentedon Aug 16, 2024
I'm getting a related error message on Airflow 2.10 and Python 3.11
AttributeError: 'LocalKubernetesExecutor' object has no attribute 'slots_occupied'potiuk commentedon Aug 16, 2024
CC: @o-nikolas -> seems to be result of #40017
o-nikolas commentedon Aug 16, 2024
I'll look into fixing this issue But I encourage folks to use Multiple Executor Configuration instead of these old (and should be deprecated) hybrid executors. These are exactly the types of issues that arise from these statically combined executors, since they're full of bespoke logic and hard coupling.
@potiuk what steps need to be followed for us to deprecate these old hybrid executors for airflow 3.0? Or is that not possible because they are in provider packages?
potiuk commentedon Aug 16, 2024
We can deprecate-with-warnings those and remove them from providers when the time comes (which might or might not be faster than getting rid of Airflow 2 support from those providers.
zoid-w commentedon Aug 19, 2024
On a related note ; the current helm chart (1.15.0) does not yet support the hybrid executor approach introduced in airflow 2.10.0.
In the helm chart there is a constraint on an ENUM of the "old" executors.
Not sure what the best approach would be to validate the executor input (if possible) considering the possibility to specify your own custom executor.
KulykDmytro commentedon Sep 9, 2024
@potiuk issue still exists on
potiuk commentedon Sep 9, 2024
Did you try with latest provider?
potiuk commentedon Sep 9, 2024
cc: @o-nikolas
eladkal commentedon Sep 10, 2024
please specify version of Celery provider that you are using
rickyzhang82 commentedon Dec 16, 2024
@potiuk ,
I checked out the tag:
2.10.2from airflow Git repo (commit 35087d7) and still ran into the same attribute error:However, we didn't see the same issue from Airflow in our production build which pip from PyPi with
2.10.2tag.The source code from PyPi is not the same even though pointing to
2.10.2The one from PyPi -- airflow/providers/celery/executors/celery_kubernetes_executor.py has the fix but it is not in the
2.10.2release tagI wonder why?
o-nikolas commentedon Dec 16, 2024
I see the that class in this case is
SasKubernetesCeleryExecutor, what is that? Is that a class you've created that subclasses from the existingKubernetesCeleryExecutor?I'm not entirely sure why the code is not in the repo tag, but you see it in pypi. But the fix is definitely pushed, I just double checked main. I don't do releases personally, so perhaps @eladkal or @potiuk would know?
Also, I still encourage folks to stop using these old static hybrid executors and please use the new multiple executor configuration 😃
eladkal commentedon Dec 17, 2024
Providers are released separately and independently from Airflow core. #41602 was released in celery provider 3.8.1
rickyzhang82 commentedon Dec 17, 2024
@eladkal,
I followed the doc
contributing-docs/07_local_virtualenv.rstto create my dev playpen. I ran the followingIt doesn't seem that my local playpen pick up the right version of the providers w.r.t
2.10.2core.How would you make them matched?
potiuk commentedon Dec 17, 2024
You can't have them from a single checkout - it's impossible. As also explained in another discussion (and abobe by @eladkal) providers and airflow are released separately - and our cotributor guide assumes you are working on main where you are working on latest airflow + latest providers at the same time.
I am not sure that trying to have one devplay with the different versions of providers and airflow installed from sources is even something that makes sense for historical version because you are talking about potentially cross-matching and installing sources from different tags - with might or miugh not work.
As explained elsewhere - tis will be easier once we implement #44511 - but until then you can try to - for example - install airflow in non editable mode, and then prepare the sources of the provider in the version you want by checking out the tag you want - look at the tags we have starting with
providers-*and usingbreeze release-management prepare-provider-packages YOUR_PROVIDER --skip-deleting-generated-files- that will generate you the source folder structure (includingpyproject.tomlwhich you will be able to install your provider in the right version in--editablemode - additionally to airflow installed there.That's one of the ways how you can achieve it.