airflow.models.pool

Module Contents

Classes

PoolStats

Dictionary containing Pool Stats

Pool

the class to get Pool info.

class airflow.models.pool.PoolStats[source]

Bases: airflow.typing_compat.TypedDict

Dictionary containing Pool Stats

total :int[source]
running :int[source]
queued :int[source]
open :int[source]
class airflow.models.pool.Pool[source]

Bases: airflow.models.base.Base

the class to get Pool info.

__tablename__ = slot_pool[source]
id[source]
pool[source]
slots[source]
description[source]
DEFAULT_POOL_NAME = default_pool[source]
__repr__()[source]
static get_pools(session=NEW_SESSION)[source]

Get all pools.

static get_pool(pool_name, session=NEW_SESSION)[source]

Get the Pool with specific pool name from the Pools.

Parameters
Returns

the pool object

static get_default_pool(session=NEW_SESSION)[source]

Get the Pool of the default_pool from the Pools.

Parameters

session (sqlalchemy.orm.session.Session) – SQLAlchemy ORM Session

Returns

the pool object

static is_default_pool(id, session=NEW_SESSION)[source]

Check id if is the default_pool.

Parameters
Returns

True if id is default_pool, otherwise False

Return type

bool

static create_or_update_pool(name, slots, description, session=NEW_SESSION)[source]

Create a pool with given parameters or update it if it already exists.

static delete_pool(name, session=NEW_SESSION)[source]

Delete pool by a given name.

static slots_stats(*, lock_rows=False, session=NEW_SESSION)[source]

Get Pool stats (Number of Running, Queued, Open & Total tasks)

If lock_rows is True, and the database engine in use supports the NOWAIT syntax, then a non-blocking lock will be attempted – if the lock is not available then SQLAlchemy will throw an OperationalError.

Parameters
to_json()[source]

Get the Pool in a json structure

Returns

the pool object in json format

occupied_slots(session=NEW_SESSION)[source]

Get the number of slots used by running/queued tasks at the moment.

Parameters

session (sqlalchemy.orm.session.Session) – SQLAlchemy ORM Session

Returns

the used number of slots

running_slots(session=NEW_SESSION)[source]

Get the number of slots used by running tasks at the moment.

Parameters

session (sqlalchemy.orm.session.Session) – SQLAlchemy ORM Session

Returns

the used number of slots

queued_slots(session=NEW_SESSION)[source]

Get the number of slots used by queued tasks at the moment.

Parameters

session (sqlalchemy.orm.session.Session) – SQLAlchemy ORM Session

Returns

the used number of slots

open_slots(session=NEW_SESSION)[source]

Get the number of slots open at the moment.

Parameters

session (sqlalchemy.orm.session.Session) – SQLAlchemy ORM Session

Returns

the number of slots

Return type

float

Was this entry helpful?