airflow.models.pool

Module Contents

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__(self)[source]
static get_pool(pool_name, session: Session = None)[source]

Get the Pool with specific pool name from the Pools.

Parameters
  • pool_name – The pool name of the Pool to get.

  • session – SQLAlchemy ORM Session

Returns

the pool object

static get_default_pool(session: Session = None)[source]

Get the Pool of the default_pool from the Pools.

Parameters

session – SQLAlchemy ORM Session

Returns

the pool object

static slots_stats(*, lock_rows: bool = False, session: Session = None)[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
  • lock_rows – Should we attempt to obtain a row-level lock on all the Pool rows returns

  • session – SQLAlchemy ORM Session

to_json(self)[source]

Get the Pool in a json structure

Returns

the pool object in json format

occupied_slots(self, session: Session)[source]

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

Parameters

session – SQLAlchemy ORM Session

Returns

the used number of slots

running_slots(self, session: Session)[source]

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

Parameters

session – SQLAlchemy ORM Session

Returns

the used number of slots

queued_slots(self, session: Session)[source]

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

Parameters

session – SQLAlchemy ORM Session

Returns

the used number of slots

open_slots(self, session: Session)[source]

Get the number of slots open at the moment.

Parameters

session – SQLAlchemy ORM Session

Returns

the number of slots

Was this entry helpful?