django-crontask 1.3.0__tar.gz → 2.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {django_crontask-1.3.0 → django_crontask-2.0.0}/PKG-INFO +3 -3
- {django_crontask-1.3.0 → django_crontask-2.0.0}/README.md +2 -2
- {django_crontask-1.3.0 → django_crontask-2.0.0}/crontask/__init__.py +8 -29
- {django_crontask-1.3.0 → django_crontask-2.0.0}/crontask/_version.py +3 -3
- {django_crontask-1.3.0 → django_crontask-2.0.0}/crontask/contrib/sentry.py +1 -1
- {django_crontask-1.3.0 → django_crontask-2.0.0}/LICENSE +0 -0
- {django_crontask-1.3.0 → django_crontask-2.0.0}/crontask/conf.py +0 -0
- {django_crontask-1.3.0 → django_crontask-2.0.0}/crontask/contrib/__init__.py +0 -0
- {django_crontask-1.3.0 → django_crontask-2.0.0}/crontask/management/__init__.py +0 -0
- {django_crontask-1.3.0 → django_crontask-2.0.0}/crontask/management/commands/__init__.py +0 -0
- {django_crontask-1.3.0 → django_crontask-2.0.0}/crontask/management/commands/crontask.py +0 -0
- {django_crontask-1.3.0 → django_crontask-2.0.0}/crontask/tasks.py +0 -0
- {django_crontask-1.3.0 → django_crontask-2.0.0}/crontask/utils.py +0 -0
- {django_crontask-1.3.0 → django_crontask-2.0.0}/pyproject.toml +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: django-crontask
|
|
3
|
-
Version:
|
|
3
|
+
Version: 2.0.0
|
|
4
4
|
Summary: Cron style scheduler for Django's task framework.
|
|
5
5
|
Keywords: Django,cron,tasks,scheduler
|
|
6
6
|
Author-email: Rust Saiargaliev <fly.amureki@gmail.com>, Johannes Maron <johannes@maron.family>, Mostafa Mohamed <mostafa.anm91@gmail.com>, Jacqueline Kraus <jacquelinekraus1992@gmail.com>
|
|
@@ -152,11 +152,11 @@ The monitor's slug will be the actor's name. Like `my_task` in the example above
|
|
|
152
152
|
Certain triggers are not supported by Sentry as well as sub-minute intervals.
|
|
153
153
|
In these cases, no monitor will be created and no telemetry will be sent.
|
|
154
154
|
|
|
155
|
-
Pass a custom config via `sentry_monitor_config` or set it to `
|
|
155
|
+
Pass a custom config via `sentry_monitor_config` or set it to `None`
|
|
156
156
|
to disable Sentry monitoring for a single task:
|
|
157
157
|
|
|
158
158
|
```python
|
|
159
|
-
@cron("* * * * *", sentry_monitor_config=
|
|
159
|
+
@cron("* * * * *", sentry_monitor_config=None)
|
|
160
160
|
@task
|
|
161
161
|
def my_task_without_sentry(): ...
|
|
162
162
|
```
|
|
@@ -110,11 +110,11 @@ The monitor's slug will be the actor's name. Like `my_task` in the example above
|
|
|
110
110
|
Certain triggers are not supported by Sentry as well as sub-minute intervals.
|
|
111
111
|
In these cases, no monitor will be created and no telemetry will be sent.
|
|
112
112
|
|
|
113
|
-
Pass a custom config via `sentry_monitor_config` or set it to `
|
|
113
|
+
Pass a custom config via `sentry_monitor_config` or set it to `None`
|
|
114
114
|
to disable Sentry monitoring for a single task:
|
|
115
115
|
|
|
116
116
|
```python
|
|
117
|
-
@cron("* * * * *", sentry_monitor_config=
|
|
117
|
+
@cron("* * * * *", sentry_monitor_config=None)
|
|
118
118
|
@task
|
|
119
119
|
def my_task_without_sentry(): ...
|
|
120
120
|
```
|
|
@@ -1,21 +1,19 @@
|
|
|
1
1
|
"""Cron style scheduler for Django's task framework."""
|
|
2
2
|
|
|
3
3
|
import typing
|
|
4
|
-
import warnings
|
|
5
4
|
from unittest.mock import Mock
|
|
6
5
|
|
|
7
6
|
from apscheduler.schedulers.base import STATE_STOPPED
|
|
8
7
|
from apscheduler.schedulers.blocking import BlockingScheduler
|
|
9
8
|
from apscheduler.triggers.base import BaseTrigger
|
|
10
9
|
from apscheduler.triggers.cron import CronTrigger
|
|
11
|
-
from apscheduler.triggers.interval import IntervalTrigger
|
|
12
10
|
from django.tasks import Task
|
|
13
11
|
from django.utils import timezone
|
|
14
12
|
|
|
15
13
|
from . import _version
|
|
16
14
|
from .contrib import sentry
|
|
17
15
|
|
|
18
|
-
__all__ = ["cron", "
|
|
16
|
+
__all__ = ["cron", "scheduler", "VERSION", "__version__"]
|
|
19
17
|
|
|
20
18
|
__version__ = _version.version
|
|
21
19
|
VERSION = _version.version_tuple
|
|
@@ -34,12 +32,13 @@ class LazyBlockingScheduler(BlockingScheduler):
|
|
|
34
32
|
|
|
35
33
|
|
|
36
34
|
scheduler = LazyBlockingScheduler()
|
|
35
|
+
UNSET = object()
|
|
37
36
|
|
|
38
37
|
|
|
39
38
|
def cron(
|
|
40
39
|
schedule: str | BaseTrigger,
|
|
41
40
|
*,
|
|
42
|
-
sentry_monitor_config: dict[str,
|
|
41
|
+
sentry_monitor_config: dict[str, dict[str, str | int] | str] | None = UNSET,
|
|
43
42
|
) -> typing.Callable[[Task], Task]:
|
|
44
43
|
"""
|
|
45
44
|
Run task on a scheduler with a cron schedule.
|
|
@@ -52,7 +51,7 @@ def cron(
|
|
|
52
51
|
|
|
53
52
|
Args:
|
|
54
53
|
schedule: A cron schedule string or an APScheduler trigger.
|
|
55
|
-
sentry_monitor_config: A Sentry monitor configuration dict or
|
|
54
|
+
sentry_monitor_config: A Sentry monitor configuration dict or None to disable monitoring.
|
|
56
55
|
|
|
57
56
|
"""
|
|
58
57
|
|
|
@@ -73,11 +72,13 @@ def cron(
|
|
|
73
72
|
else:
|
|
74
73
|
trigger = schedule
|
|
75
74
|
|
|
76
|
-
if sentry_monitor_config is not
|
|
75
|
+
if sentry_monitor_config is not None:
|
|
77
76
|
task = sentry.monitor_cron_task(
|
|
78
77
|
task,
|
|
79
78
|
trigger,
|
|
80
|
-
sentry_monitor_config=
|
|
79
|
+
sentry_monitor_config={}
|
|
80
|
+
if sentry_monitor_config is UNSET
|
|
81
|
+
else sentry_monitor_config,
|
|
81
82
|
)
|
|
82
83
|
|
|
83
84
|
scheduler.add_job(
|
|
@@ -90,25 +91,3 @@ def cron(
|
|
|
90
91
|
return task
|
|
91
92
|
|
|
92
93
|
return decorator
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
def interval(*, seconds):
|
|
96
|
-
"""
|
|
97
|
-
Run task on a periodic interval.
|
|
98
|
-
|
|
99
|
-
The interval decorator is deprecated and will be removed in a future release.
|
|
100
|
-
Please use the cron decorator with an 'IntervalTrigger' instead.
|
|
101
|
-
"""
|
|
102
|
-
warnings.warn(
|
|
103
|
-
"The interval decorator is deprecated and will be removed in a future release. "
|
|
104
|
-
"Please use the cron decorator with an 'IntervalTrigger' instead.",
|
|
105
|
-
DeprecationWarning,
|
|
106
|
-
stacklevel=2,
|
|
107
|
-
)
|
|
108
|
-
|
|
109
|
-
return cron(
|
|
110
|
-
IntervalTrigger(
|
|
111
|
-
seconds=seconds,
|
|
112
|
-
timezone=timezone.get_default_timezone(),
|
|
113
|
-
)
|
|
114
|
-
)
|
|
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
|
|
|
18
18
|
commit_id: str | None
|
|
19
19
|
__commit_id__: str | None
|
|
20
20
|
|
|
21
|
-
__version__ = version = '
|
|
22
|
-
__version_tuple__ = version_tuple = (
|
|
21
|
+
__version__ = version = '2.0.0'
|
|
22
|
+
__version_tuple__ = version_tuple = (2, 0, 0)
|
|
23
23
|
|
|
24
|
-
__commit_id__ = commit_id = '
|
|
24
|
+
__commit_id__ = commit_id = 'gfbe0c7d7f'
|
|
@@ -65,7 +65,7 @@ def trigger_to_monitor_config(
|
|
|
65
65
|
def monitor_cron_task(
|
|
66
66
|
task: Task,
|
|
67
67
|
trigger: BaseTrigger,
|
|
68
|
-
sentry_monitor_config: dict[str, dict[str, str | int] | str]
|
|
68
|
+
sentry_monitor_config: dict[str, dict[str, str | int] | str],
|
|
69
69
|
) -> Task:
|
|
70
70
|
"""
|
|
71
71
|
Wrap the task function in a Sentry monitor for a suitable trigger.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|