Skip to content

Commit 474b89d

Browse files
author
Éric Lemoine
committed
Remove PostgresJobStore (compatibility layer)
1 parent e31df23 commit 474b89d

File tree

5 files changed

+3
-49
lines changed

5 files changed

+3
-49
lines changed

procrastinate/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
from procrastinate import metadata as _metadata_module
2-
from procrastinate.aiopg_connector import PostgresConnector, PostgresJobStore
2+
from procrastinate.aiopg_connector import PostgresConnector
33
from procrastinate.app import App
44
from procrastinate.retry import BaseRetryStrategy, RetryStrategy
55

66
__all__ = [
77
"App",
88
"BaseRetryStrategy",
99
"PostgresConnector",
10-
"PostgresJobStore",
1110
"RetryStrategy",
1211
]
1312

procrastinate/aiopg_connector.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import asyncio
22
import logging
3-
import warnings
43
from typing import Any, Callable, Dict, Iterable, List, NoReturn, Optional
54

65
import aiopg
@@ -222,13 +221,3 @@ async def _loop_notify(
222221
continue
223222

224223
event.set()
225-
226-
227-
def PostgresJobStore(*args, **kwargs):
228-
message = (
229-
"Use procrastinate.PostgresConnector(...) "
230-
"instead of procrastinate.PostgresJobStore(...), with the same arguments"
231-
)
232-
logger.warning(f"Deprecation Warning: {message}")
233-
warnings.warn(DeprecationWarning(message))
234-
return PostgresConnector(**kwargs)

procrastinate/app.py

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import functools
22
import logging
3-
import warnings
43
from typing import TYPE_CHECKING, Any, Callable, Dict, Iterable, Optional, Set
54

65
from procrastinate import builtin_tasks
@@ -35,20 +34,17 @@ def from_path(cls, dotted_path: str):
3534
def __init__(
3635
self,
3736
*,
38-
connector: Optional[connector_module.BaseConnector] = None,
37+
connector: connector_module.BaseConnector,
3938
import_paths: Optional[Iterable[str]] = None,
4039
worker_timeout: float = WORKER_TIMEOUT,
41-
# Just for backwards compatibility
42-
job_store: Optional[connector_module.BaseConnector] = None,
4340
):
4441
"""
4542
Parameters
4643
----------
4744
connector:
4845
Instance of a subclass of :py:class:`BaseConnector`, typically
4946
:py:class:`PostgresConnector`. It will be responsible for all
50-
communications with the database.
51-
Mandatory if job_store is not passed.
47+
communications with the database. Mandatory.
5248
import_paths:
5349
List of python dotted paths of modules to import, to make sure
5450
that the workers know about all possible tasks.
@@ -68,21 +64,7 @@ def __init__(
6864
this parameter.
6965
Raising this parameter can lower the rate of workers making queries to the
7066
database for requesting jobs.
71-
job_store:
72-
**Deprecated**: Old name of ``connector``.
7367
"""
74-
# Compatibility
75-
if job_store:
76-
message = (
77-
"Use App(connector=procrastinate.PostgresConnector(...)) "
78-
"instead of App(job_store=procrastinate.PostgresJobStore())"
79-
)
80-
logger.warning(f"Deprecation Warning: {message}")
81-
warnings.warn(DeprecationWarning(message))
82-
connector = job_store
83-
if not connector:
84-
raise TypeError("App() missing 1 required argument: 'connector'")
85-
8668
self.connector = connector
8769
self.tasks: Dict[str, "tasks.Task"] = {}
8870
self.builtin_tasks: Dict[str, "tasks.Task"] = {}

tests/unit/test_aiopg_connector.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import pytest
22

3-
import procrastinate
43
from procrastinate import aiopg_connector
54

65

@@ -29,10 +28,3 @@ def test_adapt_pool_args_maxsize():
2928
)
3029

3130
assert args["maxsize"] == 2
32-
33-
34-
def test_app_deprecation(caplog, mocker):
35-
with pytest.deprecated_call():
36-
procrastinate.PostgresJobStore()
37-
assert caplog.records[0].levelname == "WARNING"
38-
assert caplog.records[0].message.startswith("Deprecation Warning")

tests/unit/test_app.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import pendulum
44
import pytest
55

6-
from procrastinate import aiopg_connector
76
from procrastinate import app as app_module
87
from procrastinate import tasks
98

@@ -12,13 +11,6 @@ def task_func():
1211
pass
1312

1413

15-
def test_app_deprecation(caplog):
16-
with pytest.deprecated_call():
17-
app_module.App(job_store=aiopg_connector.PostgresConnector)
18-
assert caplog.records[0].levelname == "WARNING"
19-
assert caplog.records[0].message.startswith("Deprecation Warning")
20-
21-
2214
def test_app_no_connector():
2315
with pytest.raises(TypeError):
2416
app_module.App()

0 commit comments

Comments
 (0)