dbos 1.14.0a8__tar.gz → 1.14.0a9__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.
- {dbos-1.14.0a8 → dbos-1.14.0a9}/PKG-INFO +1 -1
- {dbos-1.14.0a8 → dbos-1.14.0a9}/dbos/_debouncer.py +12 -17
- {dbos-1.14.0a8 → dbos-1.14.0a9}/pyproject.toml +1 -1
- {dbos-1.14.0a8 → dbos-1.14.0a9}/tests/test_debouncer.py +55 -47
- {dbos-1.14.0a8 → dbos-1.14.0a9}/LICENSE +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/README.md +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/dbos/__init__.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/dbos/__main__.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/dbos/_admin_server.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/dbos/_alembic_migrations/env.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/dbos/_alembic_migrations/script.py.mako +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/dbos/_alembic_migrations/versions/01ce9f07bd10_streaming.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/dbos/_alembic_migrations/versions/04ca4f231047_workflow_queues_executor_id.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/dbos/_alembic_migrations/versions/27ac6900c6ad_add_queue_dedup.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/dbos/_alembic_migrations/versions/471b60d64126_dbos_migrations.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/dbos/_alembic_migrations/versions/50f3227f0b4b_fix_job_queue.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/dbos/_alembic_migrations/versions/5c361fc04708_added_system_tables.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/dbos/_alembic_migrations/versions/66478e1b95e5_consolidate_queues.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/dbos/_alembic_migrations/versions/83f3732ae8e7_workflow_timeout.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/dbos/_alembic_migrations/versions/933e86bdac6a_add_queue_priority.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/dbos/_alembic_migrations/versions/a3b18ad34abe_added_triggers.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/dbos/_alembic_migrations/versions/d76646551a6b_job_queue_limiter.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/dbos/_alembic_migrations/versions/d76646551a6c_workflow_queue.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/dbos/_alembic_migrations/versions/d994145b47b6_consolidate_inputs.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/dbos/_alembic_migrations/versions/eab0cc1d9a14_job_queue.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/dbos/_alembic_migrations/versions/f4b9b32ba814_functionname_childid_op_outputs.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/dbos/_app_db.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/dbos/_classproperty.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/dbos/_client.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/dbos/_conductor/conductor.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/dbos/_conductor/protocol.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/dbos/_context.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/dbos/_core.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/dbos/_croniter.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/dbos/_dbos.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/dbos/_dbos_config.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/dbos/_debug.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/dbos/_docker_pg_helper.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/dbos/_error.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/dbos/_event_loop.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/dbos/_fastapi.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/dbos/_flask.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/dbos/_kafka.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/dbos/_kafka_message.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/dbos/_logger.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/dbos/_migration.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/dbos/_outcome.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/dbos/_queue.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/dbos/_recovery.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/dbos/_registrations.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/dbos/_roles.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/dbos/_scheduler.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/dbos/_schemas/__init__.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/dbos/_schemas/application_database.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/dbos/_schemas/system_database.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/dbos/_serialization.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/dbos/_sys_db.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/dbos/_sys_db_postgres.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/dbos/_sys_db_sqlite.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/dbos/_templates/dbos-db-starter/README.md +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/dbos/_templates/dbos-db-starter/__package/__init__.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/dbos/_templates/dbos-db-starter/__package/main.py.dbos +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/dbos/_templates/dbos-db-starter/__package/schema.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/dbos/_templates/dbos-db-starter/alembic.ini +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/dbos/_templates/dbos-db-starter/dbos-config.yaml.dbos +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/dbos/_templates/dbos-db-starter/migrations/env.py.dbos +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/dbos/_templates/dbos-db-starter/migrations/script.py.mako +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/dbos/_templates/dbos-db-starter/migrations/versions/2024_07_31_180642_init.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/dbos/_templates/dbos-db-starter/start_postgres_docker.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/dbos/_tracer.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/dbos/_utils.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/dbos/_workflow_commands.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/dbos/cli/_github_init.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/dbos/cli/_template_init.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/dbos/cli/cli.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/dbos/cli/migration.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/dbos/dbos-config.schema.json +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/dbos/py.typed +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/tests/__init__.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/tests/atexit_no_ctor.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/tests/atexit_no_launch.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/tests/classdefs.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/tests/client_collateral.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/tests/client_worker.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/tests/conftest.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/tests/dupname_classdefs1.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/tests/dupname_classdefsa.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/tests/more_classdefs.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/tests/queuedworkflow.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/tests/test_admin_server.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/tests/test_async.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/tests/test_async_workflow_management.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/tests/test_classdecorators.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/tests/test_cli.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/tests/test_client.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/tests/test_concurrency.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/tests/test_config.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/tests/test_croniter.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/tests/test_dbos.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/tests/test_debug.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/tests/test_docker_secrets.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/tests/test_failures.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/tests/test_fastapi.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/tests/test_fastapi_roles.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/tests/test_flask.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/tests/test_kafka.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/tests/test_outcome.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/tests/test_package.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/tests/test_queue.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/tests/test_scheduler.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/tests/test_schema_migration.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/tests/test_singleton.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/tests/test_spans.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/tests/test_sqlalchemy.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/tests/test_streaming.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/tests/test_workflow_introspection.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/tests/test_workflow_management.py +0 -0
- {dbos-1.14.0a8 → dbos-1.14.0a9}/version/__init__.py +0 -0
@@ -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
|
@@ -33,18 +33,18 @@ def test_debouncer(dbos: DBOS) -> None:
|
|
33
33
|
|
34
34
|
debounce_period = 2
|
35
35
|
|
36
|
-
debouncer = Debouncer.create(workflow
|
37
|
-
first_handle = debouncer.debounce(debounce_period, first_value)
|
38
|
-
debouncer = Debouncer.create(workflow
|
39
|
-
second_handle = debouncer.debounce(debounce_period, second_value)
|
36
|
+
debouncer = Debouncer.create(workflow)
|
37
|
+
first_handle = debouncer.debounce("key", debounce_period, first_value)
|
38
|
+
debouncer = Debouncer.create(workflow)
|
39
|
+
second_handle = debouncer.debounce("key", debounce_period, second_value)
|
40
40
|
assert first_handle.workflow_id == second_handle.workflow_id
|
41
41
|
assert first_handle.get_result() == second_value
|
42
42
|
assert second_handle.get_result() == second_value
|
43
43
|
|
44
|
-
debouncer = Debouncer.create(workflow
|
45
|
-
third_handle = debouncer.debounce(debounce_period, third_value)
|
46
|
-
debouncer = Debouncer.create(workflow
|
47
|
-
fourth_handle = debouncer.debounce(debounce_period, fourth_value)
|
44
|
+
debouncer = Debouncer.create(workflow)
|
45
|
+
third_handle = debouncer.debounce("key", debounce_period, third_value)
|
46
|
+
debouncer = Debouncer.create(workflow)
|
47
|
+
fourth_handle = debouncer.debounce("key", debounce_period, fourth_value)
|
48
48
|
assert third_handle.workflow_id != first_handle.workflow_id
|
49
49
|
assert third_handle.workflow_id == fourth_handle.workflow_id
|
50
50
|
assert third_handle.get_result() == fourth_value
|
@@ -53,7 +53,7 @@ def test_debouncer(dbos: DBOS) -> None:
|
|
53
53
|
# Test SetWorkflowID works
|
54
54
|
wfid = generate_uuid()
|
55
55
|
with SetWorkflowID(wfid):
|
56
|
-
handle = debouncer.debounce(debounce_period, first_value)
|
56
|
+
handle = debouncer.debounce("key", debounce_period, first_value)
|
57
57
|
assert handle.workflow_id == wfid
|
58
58
|
assert handle.get_result() == first_value
|
59
59
|
|
@@ -83,19 +83,18 @@ def test_debouncer_timeout(dbos: DBOS) -> None:
|
|
83
83
|
# Set a huge period but small timeout, verify workflows start after the timeout
|
84
84
|
debouncer = Debouncer.create(
|
85
85
|
workflow,
|
86
|
-
debounce_key="key",
|
87
86
|
debounce_timeout_sec=2,
|
88
87
|
)
|
89
88
|
long_debounce_period = 10000000
|
90
89
|
|
91
|
-
first_handle = debouncer.debounce(long_debounce_period, first_value)
|
92
|
-
second_handle = debouncer.debounce(long_debounce_period, second_value)
|
90
|
+
first_handle = debouncer.debounce("key", long_debounce_period, first_value)
|
91
|
+
second_handle = debouncer.debounce("key", long_debounce_period, second_value)
|
93
92
|
assert first_handle.workflow_id == second_handle.workflow_id
|
94
93
|
assert first_handle.get_result() == second_value
|
95
94
|
assert second_handle.get_result() == second_value
|
96
95
|
|
97
|
-
third_handle = debouncer.debounce(long_debounce_period, third_value)
|
98
|
-
fourth_handle = debouncer.debounce(long_debounce_period, fourth_value)
|
96
|
+
third_handle = debouncer.debounce("key", long_debounce_period, third_value)
|
97
|
+
fourth_handle = debouncer.debounce("key", long_debounce_period, fourth_value)
|
99
98
|
assert third_handle.workflow_id != first_handle.workflow_id
|
100
99
|
assert third_handle.workflow_id == fourth_handle.workflow_id
|
101
100
|
assert third_handle.get_result() == fourth_value
|
@@ -104,12 +103,11 @@ def test_debouncer_timeout(dbos: DBOS) -> None:
|
|
104
103
|
# Submit first with a long period then with a short one, verify workflows start on time
|
105
104
|
debouncer = Debouncer.create(
|
106
105
|
workflow,
|
107
|
-
debounce_key="key",
|
108
106
|
)
|
109
107
|
short_debounce_period = 1
|
110
108
|
|
111
|
-
first_handle = debouncer.debounce(long_debounce_period, first_value)
|
112
|
-
second_handle = debouncer.debounce(short_debounce_period, second_value)
|
109
|
+
first_handle = debouncer.debounce("key", long_debounce_period, first_value)
|
110
|
+
second_handle = debouncer.debounce("key", short_debounce_period, second_value)
|
113
111
|
assert fourth_handle.workflow_id != first_handle.workflow_id
|
114
112
|
assert first_handle.workflow_id == second_handle.workflow_id
|
115
113
|
assert first_handle.get_result() == second_value
|
@@ -125,14 +123,14 @@ def test_multiple_debouncers(dbos: DBOS) -> None:
|
|
125
123
|
first_value, second_value, third_value, fourth_value = 0, 1, 2, 3
|
126
124
|
|
127
125
|
# Set a huge period but small timeout, verify workflows start after the timeout
|
128
|
-
debouncer_one = Debouncer.create(workflow
|
129
|
-
debouncer_two = Debouncer.create(workflow
|
126
|
+
debouncer_one = Debouncer.create(workflow)
|
127
|
+
debouncer_two = Debouncer.create(workflow)
|
130
128
|
debounce_period = 2
|
131
129
|
|
132
|
-
first_handle = debouncer_one.debounce(debounce_period, first_value)
|
133
|
-
second_handle = debouncer_one.debounce(debounce_period, second_value)
|
134
|
-
third_handle = debouncer_two.debounce(debounce_period, third_value)
|
135
|
-
fourth_handle = debouncer_two.debounce(debounce_period, fourth_value)
|
130
|
+
first_handle = debouncer_one.debounce("key_one", debounce_period, first_value)
|
131
|
+
second_handle = debouncer_one.debounce("key_one", debounce_period, second_value)
|
132
|
+
third_handle = debouncer_two.debounce("key_two", debounce_period, third_value)
|
133
|
+
fourth_handle = debouncer_two.debounce("key_two", debounce_period, fourth_value)
|
136
134
|
assert first_handle.workflow_id == second_handle.workflow_id
|
137
135
|
assert first_handle.workflow_id != third_handle.workflow_id
|
138
136
|
assert third_handle.workflow_id == fourth_handle.workflow_id
|
@@ -151,11 +149,11 @@ def test_debouncer_queue(dbos: DBOS) -> None:
|
|
151
149
|
first_value, second_value, third_value, fourth_value = 0, 1, 2, 3
|
152
150
|
queue = Queue("test-queue")
|
153
151
|
|
154
|
-
debouncer = Debouncer.create(workflow,
|
152
|
+
debouncer = Debouncer.create(workflow, queue=queue)
|
155
153
|
debounce_period_sec = 2
|
156
154
|
|
157
|
-
first_handle = debouncer.debounce(debounce_period_sec, first_value)
|
158
|
-
second_handle = debouncer.debounce(debounce_period_sec, second_value)
|
155
|
+
first_handle = debouncer.debounce("key", debounce_period_sec, first_value)
|
156
|
+
second_handle = debouncer.debounce("key", debounce_period_sec, second_value)
|
159
157
|
assert first_handle.workflow_id == second_handle.workflow_id
|
160
158
|
assert first_handle.get_result() == second_value
|
161
159
|
assert second_handle.get_result() == second_value
|
@@ -163,8 +161,8 @@ def test_debouncer_queue(dbos: DBOS) -> None:
|
|
163
161
|
|
164
162
|
# Test SetWorkflowTimeout works
|
165
163
|
with SetWorkflowTimeout(5.0):
|
166
|
-
third_handle = debouncer.debounce(debounce_period_sec, third_value)
|
167
|
-
fourth_handle = debouncer.debounce(debounce_period_sec, fourth_value)
|
164
|
+
third_handle = debouncer.debounce("key", debounce_period_sec, third_value)
|
165
|
+
fourth_handle = debouncer.debounce("key", debounce_period_sec, fourth_value)
|
168
166
|
assert third_handle.workflow_id != first_handle.workflow_id
|
169
167
|
assert third_handle.workflow_id == fourth_handle.workflow_id
|
170
168
|
assert third_handle.get_result() == fourth_value
|
@@ -176,7 +174,7 @@ def test_debouncer_queue(dbos: DBOS) -> None:
|
|
176
174
|
# Test SetWorkflowID works
|
177
175
|
wfid = str(uuid.uuid4())
|
178
176
|
with SetWorkflowID(wfid):
|
179
|
-
handle = debouncer.debounce(debounce_period_sec, first_value)
|
177
|
+
handle = debouncer.debounce("key", debounce_period_sec, first_value)
|
180
178
|
assert handle.workflow_id == wfid
|
181
179
|
assert handle.get_result() == first_value
|
182
180
|
assert handle.get_status().queue_name == queue.name
|
@@ -187,7 +185,7 @@ def test_debouncer_queue(dbos: DBOS) -> None:
|
|
187
185
|
with SetEnqueueOptions(
|
188
186
|
priority=1, deduplication_id="test", app_version=test_version
|
189
187
|
):
|
190
|
-
handle = debouncer.debounce(debounce_period_sec, first_value)
|
188
|
+
handle = debouncer.debounce("key", debounce_period_sec, first_value)
|
191
189
|
assert handle.get_result() == first_value
|
192
190
|
assert handle.get_status().queue_name == queue.name
|
193
191
|
assert handle.get_status().app_version == test_version
|
@@ -202,17 +200,25 @@ async def test_debouncer_async(dbos: DBOS) -> None:
|
|
202
200
|
|
203
201
|
first_value, second_value, third_value, fourth_value = 0, 1, 2, 3
|
204
202
|
|
205
|
-
debouncer = Debouncer.create_async(workflow_async
|
203
|
+
debouncer = Debouncer.create_async(workflow_async)
|
206
204
|
debounce_period_sec = 2
|
207
205
|
|
208
|
-
first_handle = await debouncer.debounce_async(
|
209
|
-
|
206
|
+
first_handle = await debouncer.debounce_async(
|
207
|
+
"key", debounce_period_sec, first_value
|
208
|
+
)
|
209
|
+
second_handle = await debouncer.debounce_async(
|
210
|
+
"key", debounce_period_sec, second_value
|
211
|
+
)
|
210
212
|
assert first_handle.workflow_id == second_handle.workflow_id
|
211
213
|
assert await first_handle.get_result() == second_value
|
212
214
|
assert await second_handle.get_result() == second_value
|
213
215
|
|
214
|
-
third_handle = await debouncer.debounce_async(
|
215
|
-
|
216
|
+
third_handle = await debouncer.debounce_async(
|
217
|
+
"key", debounce_period_sec, third_value
|
218
|
+
)
|
219
|
+
fourth_handle = await debouncer.debounce_async(
|
220
|
+
"key", debounce_period_sec, fourth_value
|
221
|
+
)
|
216
222
|
assert third_handle.workflow_id != first_handle.workflow_id
|
217
223
|
assert third_handle.workflow_id == fourth_handle.workflow_id
|
218
224
|
assert await third_handle.get_result() == fourth_value
|
@@ -232,24 +238,24 @@ def test_debouncer_client(dbos: DBOS, client: DBOSClient) -> None:
|
|
232
238
|
"workflow_name": workflow.__qualname__,
|
233
239
|
"queue_name": queue.name,
|
234
240
|
}
|
235
|
-
debouncer = DebouncerClient(client, options
|
241
|
+
debouncer = DebouncerClient(client, options)
|
236
242
|
debounce_period_sec = 2
|
237
243
|
|
238
244
|
first_handle: WorkflowHandle[int] = debouncer.debounce(
|
239
|
-
debounce_period_sec, first_value
|
245
|
+
"key", debounce_period_sec, first_value
|
240
246
|
)
|
241
247
|
second_handle: WorkflowHandle[int] = debouncer.debounce(
|
242
|
-
debounce_period_sec, second_value
|
248
|
+
"key", debounce_period_sec, second_value
|
243
249
|
)
|
244
250
|
assert first_handle.workflow_id == second_handle.workflow_id
|
245
251
|
assert first_handle.get_result() == second_value
|
246
252
|
assert second_handle.get_result() == second_value
|
247
253
|
|
248
254
|
third_handle: WorkflowHandle[int] = debouncer.debounce(
|
249
|
-
debounce_period_sec, third_value
|
255
|
+
"key", debounce_period_sec, third_value
|
250
256
|
)
|
251
257
|
fourth_handle: WorkflowHandle[int] = debouncer.debounce(
|
252
|
-
debounce_period_sec, fourth_value
|
258
|
+
"key", debounce_period_sec, fourth_value
|
253
259
|
)
|
254
260
|
assert third_handle.workflow_id != first_handle.workflow_id
|
255
261
|
assert third_handle.workflow_id == fourth_handle.workflow_id
|
@@ -258,7 +264,9 @@ def test_debouncer_client(dbos: DBOS, client: DBOSClient) -> None:
|
|
258
264
|
|
259
265
|
wfid = str(uuid.uuid4())
|
260
266
|
options["workflow_id"] = wfid
|
261
|
-
handle: WorkflowHandle[int] = debouncer.debounce(
|
267
|
+
handle: WorkflowHandle[int] = debouncer.debounce(
|
268
|
+
"key", debounce_period_sec, first_value
|
269
|
+
)
|
262
270
|
assert handle.workflow_id == wfid
|
263
271
|
assert handle.get_result() == first_value
|
264
272
|
|
@@ -277,24 +285,24 @@ async def test_debouncer_client_async(dbos: DBOS, client: DBOSClient) -> None:
|
|
277
285
|
"workflow_name": workflow_async.__qualname__,
|
278
286
|
"queue_name": queue.name,
|
279
287
|
}
|
280
|
-
debouncer = DebouncerClient(client, options
|
288
|
+
debouncer = DebouncerClient(client, options)
|
281
289
|
debounce_period_sec = 2
|
282
290
|
|
283
291
|
first_handle: WorkflowHandleAsync[int] = await debouncer.debounce_async(
|
284
|
-
debounce_period_sec, first_value
|
292
|
+
"key", debounce_period_sec, first_value
|
285
293
|
)
|
286
294
|
second_handle: WorkflowHandleAsync[int] = await debouncer.debounce_async(
|
287
|
-
debounce_period_sec, second_value
|
295
|
+
"key", debounce_period_sec, second_value
|
288
296
|
)
|
289
297
|
assert first_handle.workflow_id == second_handle.workflow_id
|
290
298
|
assert await first_handle.get_result() == second_value
|
291
299
|
assert await second_handle.get_result() == second_value
|
292
300
|
|
293
301
|
third_handle: WorkflowHandleAsync[int] = await debouncer.debounce_async(
|
294
|
-
debounce_period_sec, third_value
|
302
|
+
"key", debounce_period_sec, third_value
|
295
303
|
)
|
296
304
|
fourth_handle: WorkflowHandleAsync[int] = await debouncer.debounce_async(
|
297
|
-
debounce_period_sec, fourth_value
|
305
|
+
"key", debounce_period_sec, fourth_value
|
298
306
|
)
|
299
307
|
assert third_handle.workflow_id != first_handle.workflow_id
|
300
308
|
assert third_handle.workflow_id == fourth_handle.workflow_id
|
@@ -304,7 +312,7 @@ async def test_debouncer_client_async(dbos: DBOS, client: DBOSClient) -> None:
|
|
304
312
|
wfid = str(uuid.uuid4())
|
305
313
|
options["workflow_id"] = wfid
|
306
314
|
handle: WorkflowHandleAsync[int] = await debouncer.debounce_async(
|
307
|
-
debounce_period_sec, first_value
|
315
|
+
"key", debounce_period_sec, first_value
|
308
316
|
)
|
309
317
|
assert handle.workflow_id == wfid
|
310
318
|
assert await handle.get_result() == first_value
|
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
|
{dbos-1.14.0a8 → dbos-1.14.0a9}/dbos/_alembic_migrations/versions/27ac6900c6ad_add_queue_dedup.py
RENAMED
File without changes
|
{dbos-1.14.0a8 → dbos-1.14.0a9}/dbos/_alembic_migrations/versions/471b60d64126_dbos_migrations.py
RENAMED
File without changes
|
{dbos-1.14.0a8 → dbos-1.14.0a9}/dbos/_alembic_migrations/versions/50f3227f0b4b_fix_job_queue.py
RENAMED
File without changes
|
File without changes
|
{dbos-1.14.0a8 → dbos-1.14.0a9}/dbos/_alembic_migrations/versions/66478e1b95e5_consolidate_queues.py
RENAMED
File without changes
|
{dbos-1.14.0a8 → dbos-1.14.0a9}/dbos/_alembic_migrations/versions/83f3732ae8e7_workflow_timeout.py
RENAMED
File without changes
|
{dbos-1.14.0a8 → dbos-1.14.0a9}/dbos/_alembic_migrations/versions/933e86bdac6a_add_queue_priority.py
RENAMED
File without changes
|
{dbos-1.14.0a8 → dbos-1.14.0a9}/dbos/_alembic_migrations/versions/a3b18ad34abe_added_triggers.py
RENAMED
File without changes
|
{dbos-1.14.0a8 → dbos-1.14.0a9}/dbos/_alembic_migrations/versions/d76646551a6b_job_queue_limiter.py
RENAMED
File without changes
|
{dbos-1.14.0a8 → dbos-1.14.0a9}/dbos/_alembic_migrations/versions/d76646551a6c_workflow_queue.py
RENAMED
File without changes
|
{dbos-1.14.0a8 → dbos-1.14.0a9}/dbos/_alembic_migrations/versions/d994145b47b6_consolidate_inputs.py
RENAMED
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|