Skip to content

Conversation

@pierrejeambrun
Copy link
Member

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.

@pierrejeambrun pierrejeambrun added this to the Airflow 3.1.7 milestone Jan 26, 2026
@pierrejeambrun pierrejeambrun self-assigned this Jan 26, 2026
@pierrejeambrun pierrejeambrun added the backport-to-v3-1-test Mark PR with this label to backport to v3-1-test branch label Jan 26, 2026
@boring-cyborg boring-cyborg bot added area:airflow-ctl area:API Airflow's REST/HTTP API area:UI Related to UI/UX. For Frontend Developers. labels Jan 26, 2026
Copy link
Member

@jason810496 jason810496 left a 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.

# -1 for infinite
slots: Mapped[int] = mapped_column(Integer, default=0)

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

@pierrejeambrun
Copy link
Member Author

Arf, yes there is that

@pierrejeambrun
Copy link
Member Author

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 infinity to the server which will 500. (and the front does not currently handle infinity as available pool slots).

I'll create a separate issue for that.

@pierrejeambrun pierrejeambrun merged commit 4a0364a into apache:main Jan 27, 2026
128 checks passed
@pierrejeambrun pierrejeambrun deleted the pool-api-improve-slots-validation branch January 27, 2026 11:23
github-actions bot pushed a commit that referenced this pull request Jan 27, 2026
(cherry picked from commit 4a0364a)

Co-authored-by: Pierre Jeambrun <pierrejbrun@gmail.com>
@github-actions
Copy link

Backport successfully created: v3-1-test

Status Branch Result
v3-1-test PR Link

@pierrejeambrun
Copy link
Member Author

Issue here #61115

pierrejeambrun added a commit that referenced this pull request Jan 27, 2026
(cherry picked from commit 4a0364a)

Co-authored-by: Pierre Jeambrun <pierrejbrun@gmail.com>
shreyas-dev pushed a commit to shreyas-dev/airflow that referenced this pull request Jan 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:airflow-ctl area:API Airflow's REST/HTTP API area:UI Related to UI/UX. For Frontend Developers. backport-to-v3-1-test Mark PR with this label to backport to v3-1-test branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants