patroni package¶
Subpackages¶
- patroni.dcs package
- patroni.postgresql package
- Submodules
- patroni.postgresql.bootstrap module
- patroni.postgresql.callback_executor module
- patroni.postgresql.cancellable module
- patroni.postgresql.citus module
- patroni.postgresql.config module
- patroni.postgresql.connection module
- patroni.postgresql.misc module
- patroni.postgresql.postmaster module
- patroni.postgresql.rewind module
- patroni.postgresql.slots module
- patroni.postgresql.sync module
- patroni.postgresql.validator module
- Module contents
- Submodules
- patroni.scripts package
- patroni.watchdog package
Submodules¶
- patroni.api module
- patroni.async_executor module
- patroni.collections module
- patroni.config module
- patroni.ctl module
- patroni.daemon module
- patroni.exceptions module
- patroni.file_perm module
- patroni.ha module
- patroni.log module
- patroni.psycopg module
- patroni.raft_controller module
- patroni.request module
- patroni.utils module
- patroni.validator module
- patroni.version module
Module contents¶
Define general variables and functions for patroni.
- var PATRONI_ENV_PREFIX
prefix for Patroni related configuration environment variables.
- var KUBERNETES_ENV_PREFIX
prefix for Kubernetes related configuration environment variables.
- var MIN_PSYCOPG2
minimum version of
psycopg2required by Patroni to work.
- patroni.check_psycopg(_min_psycopg2: Tuple[int, ...] = (2, 5, 4), _parse_version: Callable[[str], Tuple[int, ...]] = <function parse_version>) None¶
Ensure at least one among
psycopg2orpsycopglibraries are available in the environment.Note
We pass
MIN_PSYCOPG2andparse_version()as arguments to simplify usage ofcheck_psycopg()from thesetup.py.Note
Patroni chooses
psycopg2overpsycopg, if possible.If nothing meeting the requirements is found, then exit with a fatal message.
- Parameters
_min_psycopg2 – minimum required version in case
psycopg2is chosen._parse_version – function used to parse
psycopg2/psycopgversion into a comparable object.
- patroni.fatal(string: str, *args: Any) None¶
Write a fatal message to stderr and exit with code
1.- Parameters
string – message to be written before exiting.
- patroni.parse_version(version: str) Tuple[int, ...]¶
Convert version from human-readable format to tuple of integers.
Note
Designed for easy comparison of software versions in Python.
- Parameters
version – human-readable software version, e.g.
2.5.4.- Returns
tuple of version parts, each part as an integer.
- Example
>>> parse_version('2.5.4') (2, 5, 4)