Skip to content

Commit bf97d56

Browse files
author
Éric Lemoine
committed
Improve PostgresConnector docstrings
1 parent b782545 commit bf97d56

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

procrastinate/aiopg_connector.py

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,27 @@ def __init__(
2424
**kwargs: Any,
2525
):
2626
"""
27-
Create a PostgreSQL connector. The connector is based on an
28-
:py:func:`aiopg.Pool` that will be created upon first use.
27+
Create a PostgreSQL connector. The connector uses an :py:func:`aiopg.Pool`,
28+
which is either created automatically upon first use, or set through the
29+
py:func:`PostgresConnector.set_pool` method.
2930
30-
All extra parameters will be passed to ``aiopg`` (see documentation__). Some
31-
parameter definitions can be modified (see below).
31+
All other arguments than ``json_dumps`` and ``json_loads`` are passed to
32+
``aiopg.create_pool`` (see aiopg documentation__), with default values that
33+
may differ from those of ``aiopg`` (see the list of parameters below).
3234
3335
.. _psycopg2 doc: https://www.psycopg.org/docs/extras.html#json-adaptation
3436
.. __: https://aiopg.readthedocs.io/en/stable/core.html#aiopg.create_pool
3537
3638
Parameters
3739
----------
40+
json_dumps:
41+
The JSON dumps function to use for serializing job arguments. Defaults to
42+
the function used by psycopg2. See the `psycopg2 doc`_.
43+
json_loads:
44+
The JSON loads function to use for deserializing job arguments. Defaults
45+
to the function used by psycopg2. See the `psycopg2 doc`_. Unused if the
46+
pool is externally created and set into the connector through the
47+
:py:func:`PostgresConnector.set_pool` method.
3848
dsn (Optional[str]):
3949
Passed to aiopg. Default is "" instead of None, which means if no argument
4050
is passed, it will connect to localhost:5432 instead of a Unix-domain
@@ -55,17 +65,10 @@ def __init__(
5565
maxsize (int):
5666
Passed to aiopg. Cannot be lower than 2, otherwise worker won't be
5767
functionning normally (one connection for listen/notify, one for executing
58-
tasks)
68+
tasks).
5969
minsize (int):
6070
Passed to aiopg. Initial connections are not opened when the connector
6171
is created, but at first use of the pool.
62-
json_dumps:
63-
The JSON dumps function to use for serializing job arguments. Defaults to
64-
the function used by psycopg2. See the `psycopg2 doc`_.
65-
json_loads:
66-
The JSON loads function to use for deserializing job arguments. Defaults
67-
to the function used by psycopg2. See the `psycopg2 doc`_. Unused if pool
68-
is passed.
6972
"""
7073
self._pool: Optional[aiopg.Pool] = None
7174
self.json_dumps = json_dumps

0 commit comments

Comments
 (0)