django-qstash 0.0.6__py3-none-any.whl → 0.0.7__py3-none-any.whl
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.
Potentially problematic release.
This version of django-qstash might be problematic. Click here for more details.
- django_qstash/__init__.py +1 -1
- django_qstash/management/__init__.py +0 -0
- django_qstash/management/commands/task_schedules.py +13 -9
- {django_qstash-0.0.6.dist-info → django_qstash-0.0.7.dist-info}/METADATA +1 -1
- {django_qstash-0.0.6.dist-info → django_qstash-0.0.7.dist-info}/RECORD +7 -6
- {django_qstash-0.0.6.dist-info → django_qstash-0.0.7.dist-info}/WHEEL +0 -0
- {django_qstash-0.0.6.dist-info → django_qstash-0.0.7.dist-info}/top_level.txt +0 -0
django_qstash/__init__.py
CHANGED
|
File without changes
|
|
@@ -7,7 +7,8 @@ from django.apps import apps
|
|
|
7
7
|
from django.core.management.base import BaseCommand
|
|
8
8
|
from django.db import models
|
|
9
9
|
|
|
10
|
-
from django_qstash.
|
|
10
|
+
from django_qstash.callbacks import get_callback_url
|
|
11
|
+
from django_qstash.client import qstash_client
|
|
11
12
|
|
|
12
13
|
logger = logging.getLogger(__name__)
|
|
13
14
|
|
|
@@ -28,6 +29,11 @@ class Command(BaseCommand):
|
|
|
28
29
|
action="store_true",
|
|
29
30
|
help="Sync schedules from QStash to local database",
|
|
30
31
|
)
|
|
32
|
+
parser.add_argument(
|
|
33
|
+
"--no-input",
|
|
34
|
+
action="store_true",
|
|
35
|
+
help="Do not ask for confirmation",
|
|
36
|
+
)
|
|
31
37
|
|
|
32
38
|
def get_task_schedule_model(self) -> models.Model | None:
|
|
33
39
|
"""Get the TaskSchedule model if available."""
|
|
@@ -40,13 +46,10 @@ class Command(BaseCommand):
|
|
|
40
46
|
"Add `django_qstash.schedules` to INSTALLED_APPS and run migrations."
|
|
41
47
|
)
|
|
42
48
|
)
|
|
43
|
-
return None
|
|
44
49
|
|
|
45
50
|
def sync_schedules(self, schedules: list) -> None:
|
|
46
51
|
"""Sync remote schedules to local database."""
|
|
47
52
|
TaskSchedule = self.get_task_schedule_model()
|
|
48
|
-
if not TaskSchedule:
|
|
49
|
-
return
|
|
50
53
|
|
|
51
54
|
for schedule in schedules:
|
|
52
55
|
try:
|
|
@@ -72,6 +75,7 @@ class Command(BaseCommand):
|
|
|
72
75
|
logger.exception("Failed to sync schedule %s", schedule.schedule_id)
|
|
73
76
|
|
|
74
77
|
def handle(self, *args, **options) -> None:
|
|
78
|
+
auto_confirm = options.get("no_input")
|
|
75
79
|
if not (options.get("sync") or options.get("list")):
|
|
76
80
|
self.stdout.write(
|
|
77
81
|
self.style.ERROR("Please specify either --list or --sync option")
|
|
@@ -79,9 +83,8 @@ class Command(BaseCommand):
|
|
|
79
83
|
return
|
|
80
84
|
|
|
81
85
|
try:
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
schedules = client.list_schedules()
|
|
86
|
+
destination = get_callback_url()
|
|
87
|
+
schedules = qstash_client.schedule.list()
|
|
85
88
|
|
|
86
89
|
self.stdout.write(
|
|
87
90
|
self.style.SUCCESS(
|
|
@@ -105,8 +108,9 @@ class Command(BaseCommand):
|
|
|
105
108
|
|
|
106
109
|
if options.get("sync"):
|
|
107
110
|
user_input = input("Do you want to sync remote schedules? (y/n): ")
|
|
108
|
-
if user_input.lower() == "y":
|
|
111
|
+
if user_input.lower() == "y" or auto_confirm:
|
|
109
112
|
self.sync_schedules(schedules)
|
|
110
|
-
|
|
113
|
+
else:
|
|
114
|
+
self.stdout.write(self.style.ERROR("Sync cancelled"))
|
|
111
115
|
except Exception as e:
|
|
112
116
|
self.stdout.write(self.style.ERROR(f"An error occurred: {str(e)}"))
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: django-qstash
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.7
|
|
4
4
|
Summary: A drop-in replacement for Celery's shared_task with Upstash QStash.
|
|
5
5
|
Author-email: Justin Mitchel <justin@codingforentrepreneurs.com>
|
|
6
6
|
Project-URL: Changelog, https://github.com/jmitchel3/django-qstash
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
django_qstash/__init__.py,sha256=
|
|
1
|
+
django_qstash/__init__.py,sha256=y677U8dn62nPF5Er1ROJB-qzlukk7PqiCT2_7iL4osg,117
|
|
2
2
|
django_qstash/callbacks.py,sha256=VG5tGdNzAmUEh7NlpghrxhWvnpRNXZucWmWwxaemw0M,530
|
|
3
3
|
django_qstash/client.py,sha256=cgHf-g6lDAltY_Vt6GUVJNY2JSz1czBOHL-WVkkLs2M,149
|
|
4
4
|
django_qstash/exceptions.py,sha256=pH6kKRJFIVFkDHUJQ9yRWmtGdBBSXpNAwMSFuNzMgPw,392
|
|
@@ -12,9 +12,10 @@ django_qstash/discovery/fields.py,sha256=qZDKMpl6VMRJL0FkGwXkeN_rcCT32cupDaXJOz-
|
|
|
12
12
|
django_qstash/discovery/models.py,sha256=9ml9lTKEqEKx2uqYvejZw_BjdnowgFOPE7rYNt_8E9A,685
|
|
13
13
|
django_qstash/discovery/utils.py,sha256=k-QfOGElehCM7tV5v0FJAfwKqJWjez4xFf2RUyxIgP0,3218
|
|
14
14
|
django_qstash/discovery/validators.py,sha256=NNCf7ltW--sTw0w8FWwTp-4PtiS35U6DITEApx-D7X4,645
|
|
15
|
+
django_qstash/management/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
15
16
|
django_qstash/management/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
16
17
|
django_qstash/management/commands/clear_stale_results.py,sha256=stHCnvC1ER_rZXKUK-YVUgazC2q04eGIHjo_BrPSDEI,2096
|
|
17
|
-
django_qstash/management/commands/task_schedules.py,sha256=
|
|
18
|
+
django_qstash/management/commands/task_schedules.py,sha256=b9lJ1vjQKHyGzWAo9csGwE_oaKfgcSC8bPFLt9Ry6WE,4278
|
|
18
19
|
django_qstash/results/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
19
20
|
django_qstash/results/admin.py,sha256=q9fn3lfn0gviMfiimYij0wBCYww7FxyrOfGPr1NvntA,434
|
|
20
21
|
django_qstash/results/apps.py,sha256=4me4cg5yeoeSJTphkHYzGMJUfGucT47FNIUMYu5gmIo,275
|
|
@@ -35,7 +36,7 @@ django_qstash/schedules/validators.py,sha256=i8IEjnRVk-iysmqvT_kbPYpxTKCQWoX9P1J
|
|
|
35
36
|
django_qstash/schedules/migrations/0001_initial.py,sha256=66cA8xnJV3h7QgzCaOiv-Nu3Xl9IdZQPgQKhxyW3bs4,4516
|
|
36
37
|
django_qstash/schedules/migrations/0002_taskschedule_updated_at.py,sha256=6hZO0a9P2ZpOROkk7O5UXBhahghU0QfxZl4E-c3HKGw,459
|
|
37
38
|
django_qstash/schedules/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
38
|
-
django_qstash-0.0.
|
|
39
|
-
django_qstash-0.0.
|
|
40
|
-
django_qstash-0.0.
|
|
41
|
-
django_qstash-0.0.
|
|
39
|
+
django_qstash-0.0.7.dist-info/METADATA,sha256=VXoUQawPhDe9DL1H6D1RxonOPVzzG-yGS1gmfWLjM0Q,12307
|
|
40
|
+
django_qstash-0.0.7.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
|
41
|
+
django_qstash-0.0.7.dist-info/top_level.txt,sha256=AlV3WSK1A0ZvKuCLsINtIJhJW8zo7SEB-D3_RAjZ0hI,14
|
|
42
|
+
django_qstash-0.0.7.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|