blob: 538fee6770bc491b4f288b51c32ad0ef1813292c [file] [log] [blame]
:py:mod:`airflow.models.pool`
=============================
.. py:module:: airflow.models.pool
Module Contents
---------------
Classes
~~~~~~~
.. autoapisummary::
airflow.models.pool.PoolStats
airflow.models.pool.Pool
.. py:class:: PoolStats
Bases: :py:obj:`airflow.typing_compat.TypedDict`
Dictionary containing Pool Stats
.. py:attribute:: total
:annotation: :int
.. py:attribute:: running
:annotation: :int
.. py:attribute:: queued
:annotation: :int
.. py:attribute:: open
:annotation: :int
.. py:class:: Pool
Bases: :py:obj:`airflow.models.base.Base`
the class to get Pool info.
.. py:attribute:: __tablename__
:annotation: = slot_pool
.. py:attribute:: id
.. py:attribute:: pool
.. py:attribute:: slots
.. py:attribute:: description
.. py:attribute:: DEFAULT_POOL_NAME
:annotation: = default_pool
.. py:method:: __repr__()
.. py:method:: get_pools(session = NEW_SESSION)
:staticmethod:
Get all pools.
.. py:method:: get_pool(pool_name, session = NEW_SESSION)
:staticmethod:
Get the Pool with specific pool name from the Pools.
:param pool_name: The pool name of the Pool to get.
:param session: SQLAlchemy ORM Session
:return: the pool object
.. py:method:: get_default_pool(session = NEW_SESSION)
:staticmethod:
Get the Pool of the default_pool from the Pools.
:param session: SQLAlchemy ORM Session
:return: the pool object
.. py:method:: is_default_pool(id, session = NEW_SESSION)
:staticmethod:
Check id if is the default_pool.
:param id: pool id
:param session: SQLAlchemy ORM Session
:return: True if id is default_pool, otherwise False
.. py:method:: create_or_update_pool(name, slots, description, session = NEW_SESSION)
:staticmethod:
Create a pool with given parameters or update it if it already exists.
.. py:method:: delete_pool(name, session = NEW_SESSION)
:staticmethod:
Delete pool by a given name.
.. py:method:: slots_stats(*, lock_rows = False, session = NEW_SESSION)
:staticmethod:
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.
:param lock_rows: Should we attempt to obtain a row-level lock on all the Pool rows returns
:param session: SQLAlchemy ORM Session
.. py:method:: to_json()
Get the Pool in a json structure
:return: the pool object in json format
.. py:method:: occupied_slots(session = NEW_SESSION)
Get the number of slots used by running/queued tasks at the moment.
:param session: SQLAlchemy ORM Session
:return: the used number of slots
.. py:method:: running_slots(session = NEW_SESSION)
Get the number of slots used by running tasks at the moment.
:param session: SQLAlchemy ORM Session
:return: the used number of slots
.. py:method:: queued_slots(session = NEW_SESSION)
Get the number of slots used by queued tasks at the moment.
:param session: SQLAlchemy ORM Session
:return: the used number of slots
.. py:method:: scheduled_slots(session = NEW_SESSION)
Get the number of slots scheduled at the moment.
:param session: SQLAlchemy ORM Session
:return: the number of scheduled slots
.. py:method:: open_slots(session = NEW_SESSION)
Get the number of slots open at the moment.
:param session: SQLAlchemy ORM Session
:return: the number of slots