dbos 1.14.0a8__py3-none-any.whl → 1.14.0a9__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.
- dbos/_debouncer.py +12 -17
- {dbos-1.14.0a8.dist-info → dbos-1.14.0a9.dist-info}/METADATA +1 -1
- {dbos-1.14.0a8.dist-info → dbos-1.14.0a9.dist-info}/RECORD +6 -6
- {dbos-1.14.0a8.dist-info → dbos-1.14.0a9.dist-info}/WHEEL +0 -0
- {dbos-1.14.0a8.dist-info → dbos-1.14.0a9.dist-info}/entry_points.txt +0 -0
- {dbos-1.14.0a8.dist-info → dbos-1.14.0a9.dist-info}/licenses/LICENSE +0 -0
dbos/_debouncer.py
CHANGED
@@ -147,7 +147,6 @@ class Debouncer(Generic[P, R]):
|
|
147
147
|
self,
|
148
148
|
workflow_name: str,
|
149
149
|
*,
|
150
|
-
debounce_key: str,
|
151
150
|
debounce_timeout_sec: Optional[float] = None,
|
152
151
|
queue: Optional[Queue] = None,
|
153
152
|
):
|
@@ -157,13 +156,11 @@ class Debouncer(Generic[P, R]):
|
|
157
156
|
"queue_name": queue.name if queue else None,
|
158
157
|
"workflow_name": workflow_name,
|
159
158
|
}
|
160
|
-
self.debounce_key = debounce_key
|
161
159
|
|
162
160
|
@staticmethod
|
163
161
|
def create(
|
164
162
|
workflow: Callable[P, R],
|
165
163
|
*,
|
166
|
-
debounce_key: str,
|
167
164
|
debounce_timeout_sec: Optional[float] = None,
|
168
165
|
queue: Optional[Queue] = None,
|
169
166
|
) -> "Debouncer[P, R]":
|
@@ -172,7 +169,6 @@ class Debouncer(Generic[P, R]):
|
|
172
169
|
raise TypeError("Only workflow functions may be debounced, not methods")
|
173
170
|
return Debouncer[P, R](
|
174
171
|
get_dbos_func_name(workflow),
|
175
|
-
debounce_key=debounce_key,
|
176
172
|
debounce_timeout_sec=debounce_timeout_sec,
|
177
173
|
queue=queue,
|
178
174
|
)
|
@@ -181,7 +177,6 @@ class Debouncer(Generic[P, R]):
|
|
181
177
|
def create_async(
|
182
178
|
workflow: Callable[P, Coroutine[Any, Any, R]],
|
183
179
|
*,
|
184
|
-
debounce_key: str,
|
185
180
|
debounce_timeout_sec: Optional[float] = None,
|
186
181
|
queue: Optional[Queue] = None,
|
187
182
|
) -> "Debouncer[P, R]":
|
@@ -190,13 +185,16 @@ class Debouncer(Generic[P, R]):
|
|
190
185
|
raise TypeError("Only workflow functions may be debounced, not methods")
|
191
186
|
return Debouncer[P, R](
|
192
187
|
get_dbos_func_name(workflow),
|
193
|
-
debounce_key=debounce_key,
|
194
188
|
debounce_timeout_sec=debounce_timeout_sec,
|
195
189
|
queue=queue,
|
196
190
|
)
|
197
191
|
|
198
192
|
def debounce(
|
199
|
-
self,
|
193
|
+
self,
|
194
|
+
debounce_key: str,
|
195
|
+
debounce_period_sec: float,
|
196
|
+
*args: P.args,
|
197
|
+
**kwargs: P.kwargs,
|
200
198
|
) -> "WorkflowHandle[R]":
|
201
199
|
from dbos._dbos import DBOS, _get_dbos_instance
|
202
200
|
|
@@ -232,9 +230,7 @@ class Debouncer(Generic[P, R]):
|
|
232
230
|
while True:
|
233
231
|
try:
|
234
232
|
# Attempt to enqueue a debouncer for this workflow.
|
235
|
-
deduplication_id =
|
236
|
-
f"{self.options['workflow_name']}-{self.debounce_key}"
|
237
|
-
)
|
233
|
+
deduplication_id = f"{self.options['workflow_name']}-{debounce_key}"
|
238
234
|
with SetEnqueueOptions(deduplication_id=deduplication_id):
|
239
235
|
with SetWorkflowTimeout(None):
|
240
236
|
internal_queue.enqueue(
|
@@ -284,6 +280,7 @@ class Debouncer(Generic[P, R]):
|
|
284
280
|
|
285
281
|
async def debounce_async(
|
286
282
|
self,
|
283
|
+
debounce_key: str,
|
287
284
|
debounce_period_sec: float,
|
288
285
|
*args: P.args,
|
289
286
|
**kwargs: P.kwargs,
|
@@ -292,7 +289,7 @@ class Debouncer(Generic[P, R]):
|
|
292
289
|
|
293
290
|
dbos = _get_dbos_instance()
|
294
291
|
handle = await asyncio.to_thread(
|
295
|
-
self.debounce, debounce_period_sec, *args, **kwargs
|
292
|
+
self.debounce, debounce_key, debounce_period_sec, *args, **kwargs
|
296
293
|
)
|
297
294
|
return WorkflowHandleAsyncPolling(handle.workflow_id, dbos)
|
298
295
|
|
@@ -304,7 +301,6 @@ class DebouncerClient:
|
|
304
301
|
client: DBOSClient,
|
305
302
|
workflow_options: EnqueueOptions,
|
306
303
|
*,
|
307
|
-
debounce_key: str,
|
308
304
|
debounce_timeout_sec: Optional[float] = None,
|
309
305
|
queue: Optional[Queue] = None,
|
310
306
|
):
|
@@ -314,11 +310,10 @@ class DebouncerClient:
|
|
314
310
|
"queue_name": queue.name if queue else None,
|
315
311
|
"workflow_name": workflow_options["workflow_name"],
|
316
312
|
}
|
317
|
-
self.debounce_key = debounce_key
|
318
313
|
self.client = client
|
319
314
|
|
320
315
|
def debounce(
|
321
|
-
self, debounce_period_sec: float, *args: Any, **kwargs: Any
|
316
|
+
self, debounce_key: str, debounce_period_sec: float, *args: Any, **kwargs: Any
|
322
317
|
) -> "WorkflowHandle[R]":
|
323
318
|
|
324
319
|
ctxOptions: ContextOptions = {
|
@@ -337,7 +332,7 @@ class DebouncerClient:
|
|
337
332
|
try:
|
338
333
|
# Attempt to enqueue a debouncer for this workflow.
|
339
334
|
deduplication_id = (
|
340
|
-
f"{self.debouncer_options['workflow_name']}-{
|
335
|
+
f"{self.debouncer_options['workflow_name']}-{debounce_key}"
|
341
336
|
)
|
342
337
|
debouncer_options: EnqueueOptions = {
|
343
338
|
"workflow_name": DEBOUNCER_WORKFLOW_NAME,
|
@@ -390,10 +385,10 @@ class DebouncerClient:
|
|
390
385
|
)
|
391
386
|
|
392
387
|
async def debounce_async(
|
393
|
-
self, debounce_period_sec: float, *args: Any, **kwargs: Any
|
388
|
+
self, deboucne_key: str, debounce_period_sec: float, *args: Any, **kwargs: Any
|
394
389
|
) -> "WorkflowHandleAsync[R]":
|
395
390
|
handle: "WorkflowHandle[R]" = await asyncio.to_thread(
|
396
|
-
self.debounce, debounce_period_sec, *args, **kwargs
|
391
|
+
self.debounce, deboucne_key, debounce_period_sec, *args, **kwargs
|
397
392
|
)
|
398
393
|
return WorkflowHandleClientAsyncPolling[R](
|
399
394
|
handle.workflow_id, self.client._sys_db
|
@@ -1,7 +1,7 @@
|
|
1
|
-
dbos-1.14.
|
2
|
-
dbos-1.14.
|
3
|
-
dbos-1.14.
|
4
|
-
dbos-1.14.
|
1
|
+
dbos-1.14.0a9.dist-info/METADATA,sha256=z_qeuQRuFMPDSGviV29KhLtBuULZu7f-tBlL2j8rLVU,13268
|
2
|
+
dbos-1.14.0a9.dist-info/WHEEL,sha256=9P2ygRxDrTJz3gsagc0Z96ukrxjr-LFBGOgv3AuKlCA,90
|
3
|
+
dbos-1.14.0a9.dist-info/entry_points.txt,sha256=_QOQ3tVfEjtjBlr1jS4sHqHya9lI2aIEIWkz8dqYp14,58
|
4
|
+
dbos-1.14.0a9.dist-info/licenses/LICENSE,sha256=VGZit_a5-kdw9WT6fY5jxAWVwGQzgLFyPWrcVVUhVNU,1067
|
5
5
|
dbos/__init__.py,sha256=pT4BuNLDCrIQX27vQG8NlfxX6PZRU7r9miq4thJTszU,982
|
6
6
|
dbos/__main__.py,sha256=G7Exn-MhGrVJVDbgNlpzhfh8WMX_72t3_oJaFT9Lmt8,653
|
7
7
|
dbos/_admin_server.py,sha256=e8ELhcDWqR3_PNobnNgUvLGh5lzZq0yFSF6dvtzoQRI,16267
|
@@ -32,7 +32,7 @@ dbos/_core.py,sha256=plF80l5Rh_bBpy5PFZy3p3ux6agmYkUgZq8e36i68F4,50443
|
|
32
32
|
dbos/_croniter.py,sha256=XHAyUyibs_59sJQfSNWkP7rqQY6_XrlfuuCxk4jYqek,47559
|
33
33
|
dbos/_dbos.py,sha256=AgkcE9YSC9KWsDUNfEhdbkfR9NjT0seZDAOunb3n61w,58201
|
34
34
|
dbos/_dbos_config.py,sha256=_26ktif8qAZW4Ujg6dZfLkYO7dE4CI8b3IQbw_5YkpA,25710
|
35
|
-
dbos/_debouncer.py,sha256=
|
35
|
+
dbos/_debouncer.py,sha256=KMu64pbq7mUAY4g_9_gzP4a4FKDOv5BbLhkkh9PcBuA,15217
|
36
36
|
dbos/_debug.py,sha256=99j2SChWmCPAlZoDmjsJGe77tpU2LEa8E2TtLAnnh7o,1831
|
37
37
|
dbos/_docker_pg_helper.py,sha256=tLJXWqZ4S-ExcaPnxg_i6cVxL6ZxrYlZjaGsklY-s2I,6115
|
38
38
|
dbos/_error.py,sha256=GwO0Ng4d4iB52brY09-Ss6Cz_V28Xc0D0cRCzZ6XmNM,8688
|
@@ -76,4 +76,4 @@ dbos/cli/migration.py,sha256=5GiyagLZkyVvDz3StYxtFdkFoKFCmh6eSXjzsIGhZ_A,3330
|
|
76
76
|
dbos/dbos-config.schema.json,sha256=LyUT1DOTaAwOP6suxQGS5KemVIqXGPyu_q7Hbo0neA8,6192
|
77
77
|
dbos/py.typed,sha256=QfzXT1Ktfk3Rj84akygc7_42z0lRpCq0Ilh8OXI6Zas,44
|
78
78
|
version/__init__.py,sha256=L4sNxecRuqdtSFdpUGX3TtBi9KL3k7YsZVIvv-fv9-A,1678
|
79
|
-
dbos-1.14.
|
79
|
+
dbos-1.14.0a9.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|