saq 0.24.5__py3-none-any.whl → 0.24.6__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.
- saq/__init__.py +1 -1
- saq/job.py +6 -0
- saq/queue/base.py +4 -1
- saq/queue/postgres.py +2 -2
- {saq-0.24.5.dist-info → saq-0.24.6.dist-info}/METADATA +1 -1
- {saq-0.24.5.dist-info → saq-0.24.6.dist-info}/RECORD +10 -10
- {saq-0.24.5.dist-info → saq-0.24.6.dist-info}/LICENSE +0 -0
- {saq-0.24.5.dist-info → saq-0.24.6.dist-info}/WHEEL +0 -0
- {saq-0.24.5.dist-info → saq-0.24.6.dist-info}/entry_points.txt +0 -0
- {saq-0.24.5.dist-info → saq-0.24.6.dist-info}/top_level.txt +0 -0
saq/__init__.py
CHANGED
saq/job.py
CHANGED
@@ -174,6 +174,8 @@ class Job:
|
|
174
174
|
|
175
175
|
if "queue" in kwargs:
|
176
176
|
kwargs["queue"] = kwargs["queue"].name
|
177
|
+
if "status" in kwargs:
|
178
|
+
kwargs["status"] = kwargs["status"].name.lower()
|
177
179
|
|
178
180
|
if not kwargs.get("meta"):
|
179
181
|
kwargs.pop("meta", None)
|
@@ -181,6 +183,10 @@ class Job:
|
|
181
183
|
info = ", ".join(f"{k}: {v}" for k, v in kwargs.items())
|
182
184
|
return f"Job<{info}>"
|
183
185
|
|
186
|
+
def __post_init__(self) -> None:
|
187
|
+
if isinstance(self.status, str):
|
188
|
+
self.status = Status[self.status.upper()]
|
189
|
+
|
184
190
|
def __repr__(self) -> str:
|
185
191
|
return self.info(True)
|
186
192
|
|
saq/queue/base.py
CHANGED
@@ -118,7 +118,7 @@ class Queue(ABC):
|
|
118
118
|
for k, v in kwargs.items():
|
119
119
|
if hasattr(job, k):
|
120
120
|
setattr(job, k, v)
|
121
|
-
await self._update(job, **kwargs)
|
121
|
+
await self._update(self.copy(job), **kwargs)
|
122
122
|
|
123
123
|
@abstractmethod
|
124
124
|
async def _update(self, job: Job, status: Status | None = None, **kwargs: t.Any) -> None:
|
@@ -213,6 +213,9 @@ class Queue(ABC):
|
|
213
213
|
async def connect(self) -> None:
|
214
214
|
self._loop = asyncio.get_running_loop()
|
215
215
|
|
216
|
+
def copy(self, job: Job) -> Job:
|
217
|
+
return self.deserialize(job.to_dict()) # type: ignore
|
218
|
+
|
216
219
|
def serialize(self, job: Job) -> bytes | str:
|
217
220
|
return self._dump(job.to_dict())
|
218
221
|
|
saq/queue/postgres.py
CHANGED
@@ -784,7 +784,7 @@ class PostgresQueue(Queue):
|
|
784
784
|
SQL(
|
785
785
|
dedent(
|
786
786
|
"""
|
787
|
-
SELECT status
|
787
|
+
SELECT UPPER(status)
|
788
788
|
FROM {jobs_table}
|
789
789
|
WHERE key = %(key)s
|
790
790
|
{for_update}
|
@@ -800,7 +800,7 @@ class PostgresQueue(Queue):
|
|
800
800
|
)
|
801
801
|
result = await cursor.fetchone()
|
802
802
|
if result:
|
803
|
-
return result[0]
|
803
|
+
return Status[result[0]]
|
804
804
|
return None
|
805
805
|
|
806
806
|
async def _retry(self, job: Job, error: str | None) -> None:
|
@@ -1,16 +1,16 @@
|
|
1
|
-
saq/__init__.py,sha256=
|
1
|
+
saq/__init__.py,sha256=9-iA2pE4jP5kLkITxQjhBvPZukTSXtSbjaT22sebwnw,218
|
2
2
|
saq/__main__.py,sha256=N4RNqnCcj7eZbM3OyYaC03_6Cot-y-SxW5Hwx6fuzKU,2440
|
3
3
|
saq/errors.py,sha256=XPJw6J3caSAho4ZybuodIbeuGjboVabLuf3NFOEE-4Q,112
|
4
|
-
saq/job.py,sha256=
|
4
|
+
saq/job.py,sha256=X49OuSqZeN-RVmh4AonZRrwk2wU8MeukLSxrvjGLm7E,11552
|
5
5
|
saq/multiplexer.py,sha256=S_mjo7kObSBQ_f8epf0pT5Tjxg-LABW3fSH4dPfZxsE,2332
|
6
6
|
saq/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
7
7
|
saq/types.py,sha256=GhIq2BIE_Z9hA-qS-NQXh_iPICNI0NZxOzjW0vcMgFU,3196
|
8
8
|
saq/utils.py,sha256=NdOycT-03zxjhKM8A1i0vzKnkv1UQxvy_Zt4GnO0Zd8,1721
|
9
9
|
saq/worker.py,sha256=W9rqK_u0bbvUbdb879pvf1f-suNnesKk1TjYqHQREc8,16817
|
10
10
|
saq/queue/__init__.py,sha256=5LgBHGylCVvrLDcjMCcI2dRRgh0BPdz2TKOdc8NMs2E,87
|
11
|
-
saq/queue/base.py,sha256=
|
11
|
+
saq/queue/base.py,sha256=vRSr4ExGETlkjc9bLrtqfi_A7Zsr_IQzCMyN_b70-UM,15572
|
12
12
|
saq/queue/http.py,sha256=V9S26gJbUt5AUIR2ETasSQy4Q_K30eGtguBYHpfcLGU,7739
|
13
|
-
saq/queue/postgres.py,sha256=
|
13
|
+
saq/queue/postgres.py,sha256=PREn1HBA8E_m57cpdtcBNov1YW8658nR7iESyQ8YHhI,34682
|
14
14
|
saq/queue/postgres_migrations.py,sha256=gI6j-0TzlFFSWxji3Dy9aJ-llboJBm92J4tB_YZ7qI8,2080
|
15
15
|
saq/queue/redis.py,sha256=sa_wzUUlfPw-RZ-v_cnDEJWEFyUi3sy_3YTqG4UklOA,17754
|
16
16
|
saq/web/__init__.py,sha256=NG9LfjgJQxNft0_iZuZ3LnX1I58SfxRwKpycjazBoGE,23
|
@@ -20,9 +20,9 @@ saq/web/starlette.py,sha256=i38xuNcnQvWBY3jyHHu9Uo9ILSBzOwmk5Bq06c3CQzM,4432
|
|
20
20
|
saq/web/static/app.js,sha256=i6PaRvBvt96LOINBdEuKkDvVeM-GA8lJiFg4jtQ3viY,7094
|
21
21
|
saq/web/static/pico.min.css.gz,sha256=qCxIv3wWFMQ7MkvGSHQLwxio3121VvvieOkSjw6fv6o,9263
|
22
22
|
saq/web/static/snabbdom.js.gz,sha256=zSO3Z761TB7bYNQFFEtypD0vCuqWesqPJeE5CuV4xRg,7603
|
23
|
-
saq-0.24.
|
24
|
-
saq-0.24.
|
25
|
-
saq-0.24.
|
26
|
-
saq-0.24.
|
27
|
-
saq-0.24.
|
28
|
-
saq-0.24.
|
23
|
+
saq-0.24.6.dist-info/LICENSE,sha256=p208OXrLf_dMcvuRHpcinfsJdihCqKWbqtFXpw4kyW0,1065
|
24
|
+
saq-0.24.6.dist-info/METADATA,sha256=oJf-Wl30e1v24Nri7koife_X97945RymUfb_g0bPR0I,7781
|
25
|
+
saq-0.24.6.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
26
|
+
saq-0.24.6.dist-info/entry_points.txt,sha256=HkKOud1K15_DV7AEltn8G5Ua10VqIgHaZ4BQit4fdOk,42
|
27
|
+
saq-0.24.6.dist-info/top_level.txt,sha256=FMrrc5EiGr4sQkEDtUMHIpomnWHL9i6xT7B6lvEh8xM,4
|
28
|
+
saq-0.24.6.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|