You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "LipuFei (via GitHub)" <gi...@apache.org> on 2024/08/16 10:11:17 UTC
[I] AttributeError: 'CeleryKubernetesExecutor' object has no attribute 'slots_occupied' [airflow]
LipuFei opened a new issue, #41525:
URL: https://github.com/apache/airflow/issues/41525
### 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?
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?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
--
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.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] AttributeError: 'CeleryKubernetesExecutor' object has no attribute 'slots_occupied' [airflow]
Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on issue #41525:
URL: https://github.com/apache/airflow/issues/41525#issuecomment-2293586004
CC: @o-nikolas -> seems to be result of #40017
--
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
Re: [I] AttributeError: 'CeleryKubernetesExecutor' object has no attribute 'slots_occupied' [airflow]
Posted by "eladkal (via GitHub)" <gi...@apache.org>.
eladkal commented on issue #41525:
URL: https://github.com/apache/airflow/issues/41525#issuecomment-2339508119
> @potiuk issue still exists on
>
> * Python 3.11
> * Airflow 2.10.1
please specify version of Celery provider that you are using
--
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
Re: [I] AttributeError: 'CeleryKubernetesExecutor' object has no attribute 'slots_occupied' [airflow]
Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on issue #41525:
URL: https://github.com/apache/airflow/issues/41525#issuecomment-2339029396
cc: @o-nikolas
--
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
Re: [I] AttributeError: 'CeleryKubernetesExecutor' object has no attribute 'slots_occupied' [airflow]
Posted by "eladkal (via GitHub)" <gi...@apache.org>.
eladkal closed issue #41525: AttributeError: 'CeleryKubernetesExecutor' object has no attribute 'slots_occupied'
URL: https://github.com/apache/airflow/issues/41525
--
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
Re: [I] AttributeError: 'CeleryKubernetesExecutor' object has no attribute 'slots_occupied' [airflow]
Posted by "eladkal (via GitHub)" <gi...@apache.org>.
eladkal commented on issue #41525:
URL: https://github.com/apache/airflow/issues/41525#issuecomment-2547544420
Providers are released separately and independently from Airflow core. https://github.com/apache/airflow/pull/41602 was released in celery provider 3.8.1
--
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
Re: [I] AttributeError: 'CeleryKubernetesExecutor' object has no attribute 'slots_occupied' [airflow]
Posted by "o-nikolas (via GitHub)" <gi...@apache.org>.
o-nikolas commented on issue #41525:
URL: https://github.com/apache/airflow/issues/41525#issuecomment-2293700446
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?
--
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
Re: [I] AttributeError: 'CeleryKubernetesExecutor' object has no attribute 'slots_occupied' [airflow]
Posted by "zoid-w (via GitHub)" <gi...@apache.org>.
zoid-w commented on issue #41525:
URL: https://github.com/apache/airflow/issues/41525#issuecomment-2296899749
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.
--
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
Re: [I] AttributeError: 'CeleryKubernetesExecutor' object has no attribute 'slots_occupied' [airflow]
Posted by "rickyzhang82 (via GitHub)" <gi...@apache.org>.
rickyzhang82 commented on issue #41525:
URL: https://github.com/apache/airflow/issues/41525#issuecomment-2546776507
@potiuk ,
I checked out the tag: `2.10.2` from airflow Git repo (commit 35087d7d10714130cc3e9e9730e34b07fc56938d) and still ran into the same attribute error:
```
File "/home/Ricky/sas-u-home/rizhan/repo/github/airflow/airflow/jobs/scheduler_job_runner.py", line 718, in <listcomp>
num_occupied_slots = sum([executor.slots_occupied for executor in self.job.executors])
AttributeError: 'SasKubernetesCeleryExecutor' object has no attribute 'slots_occupied'
```
However, we didn't see the same issue from Airflow in our production build which pip from PyPi with `2.10.2` tag.
The source code from PyPi is not the **same** even though pointing to `2.10.2`
The one from PyPi -- airflow/providers/celery/executors/celery_kubernetes_executor.py has the fix but it is not in the `2.10.2` release tag
```
119 @property
120 def slots_occupied(self):
121 """Number of tasks this executor instance is currently managing."""
122 return len(self.running) + len(self.queued_tasks)
```
I wonder why?
--
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
Re: [I] AttributeError: 'CeleryKubernetesExecutor' object has no attribute 'slots_occupied' [airflow]
Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on issue #41525:
URL: https://github.com/apache/airflow/issues/41525#issuecomment-2293719334
> @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
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.
--
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
Re: [I] AttributeError: 'CeleryKubernetesExecutor' object has no attribute 'slots_occupied' [airflow]
Posted by "salam-abdul (via GitHub)" <gi...@apache.org>.
salam-abdul commented on issue #41525:
URL: https://github.com/apache/airflow/issues/41525#issuecomment-2293562045
I'm getting a related error message on Airflow 2.10 and Python 3.11
`AttributeError: 'LocalKubernetesExecutor' object has no attribute 'slots_occupied'`
--
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
Re: [I] AttributeError: 'CeleryKubernetesExecutor' object has no attribute 'slots_occupied' [airflow]
Posted by "KulykDmytro (via GitHub)" <gi...@apache.org>.
KulykDmytro commented on issue #41525:
URL: https://github.com/apache/airflow/issues/41525#issuecomment-2338724200
@potiuk issue still exists on
* Python 3.11
* Airflow 2.10.1
--
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
Re: [I] AttributeError: 'CeleryKubernetesExecutor' object has no attribute 'slots_occupied' [airflow]
Posted by "rickyzhang82 (via GitHub)" <gi...@apache.org>.
rickyzhang82 commented on issue #41525:
URL: https://github.com/apache/airflow/issues/41525#issuecomment-2548697201
@eladkal,
I followed the doc `contributing-docs/07_local_virtualenv.rst` to create my dev playpen. I ran the following
```
pip install -e ".[devel,postgres,redis,celery,cncf-kubernetes]" --constraint "https://raw.githubusercontent.com/apache/airflow/constraints-2.10.2/constraints-3.9.txt"
```
It doesn't seem that my local playpen pick up the right version of the providers w.r.t `2.10.2` core.
How would you make them matched?
--
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
Re: [I] AttributeError: 'CeleryKubernetesExecutor' object has no attribute 'slots_occupied' [airflow]
Posted by "o-nikolas (via GitHub)" <gi...@apache.org>.
o-nikolas commented on issue #41525:
URL: https://github.com/apache/airflow/issues/41525#issuecomment-2546889237
I see the that class in this case is `SasKubernetesCeleryExecutor`, what is that? Is that a class you've created that subclasses from the existing `KubernetesCeleryExecutor`?
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 :smiley:
--
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
Re: [I] AttributeError: 'CeleryKubernetesExecutor' object has no attribute 'slots_occupied' [airflow]
Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on issue #41525:
URL: https://github.com/apache/airflow/issues/41525#issuecomment-2549421972
> How would you make them matched?
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 https://github.com/apache/airflow/issues/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 using `breeze release-management prepare-provider-packages YOUR_PROVIDER --skip-deleting-generated-files` - that will generate you the source folder structure (including `pyproject.toml` which you will be able to install your provider in the right version in `--editable` mode - additionally to airflow installed there.
That's one of the ways how you can achieve it.
--
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
Re: [I] AttributeError: 'CeleryKubernetesExecutor' object has no attribute 'slots_occupied' [airflow]
Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on issue #41525:
URL: https://github.com/apache/airflow/issues/41525#issuecomment-2339028408
Did you try with latest provider?
--
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