-
Notifications
You must be signed in to change notification settings - Fork 16.4k
Pool API improve slots validation #61071
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
Pool API improve slots validation #61071
Conversation
jason810496
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems -1 is still supported for pools, as it is treated as infinite. So maybe we should allow positive integers and -1 for the slots field.
airflow/airflow-core/src/airflow/models/pool.py
Lines 90 to 91 in bb0ff04
| # -1 for infinite | |
| slots: Mapped[int] = mapped_column(Integer, default=0) |
airflow/airflow-core/src/airflow/models/pool.py
Lines 216 to 222 in bb0ff04
| pool_rows = session.execute(query) | |
| for pool_name, total_slots_in, include_deferred in pool_rows: | |
| total_slots = float("inf") if total_slots_in == -1 else total_slots_in | |
| pools[pool_name] = PoolStats( | |
| total=total_slots, running=0, queued=0, open=0, deferred=0, scheduled=0 | |
| ) | |
| pool_includes_deferred[pool_name] = include_deferred |
|
Arf, yes there is that |
|
Ok, after more thoughts, lets merge this for now, which is better than no validation at all. Currently -1 is not possible to use via the API, because it will be returned as I'll create a separate issue for that. |
(cherry picked from commit 4a0364a) Co-authored-by: Pierre Jeambrun <pierrejbrun@gmail.com>
|
Issue here #61115 |
Add backend validation to pool API on slots attribute. It is not possible anymore to create or update pools slots to have null or negative values.