dbos 1.2.0a9__py3-none-any.whl → 1.3.0a2__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/_dbos.py +1 -5
- dbos/_event_loop.py +7 -10
- dbos/_sys_db.py +27 -27
- {dbos-1.2.0a9.dist-info → dbos-1.3.0a2.dist-info}/METADATA +1 -1
- {dbos-1.2.0a9.dist-info → dbos-1.3.0a2.dist-info}/RECORD +8 -8
- {dbos-1.2.0a9.dist-info → dbos-1.3.0a2.dist-info}/WHEEL +0 -0
- {dbos-1.2.0a9.dist-info → dbos-1.3.0a2.dist-info}/entry_points.txt +0 -0
- {dbos-1.2.0a9.dist-info → dbos-1.3.0a2.dist-info}/licenses/LICENSE +0 -0
dbos/_dbos.py
CHANGED
@@ -297,7 +297,6 @@ class DBOS:
|
|
297
297
|
|
298
298
|
self._launched: bool = False
|
299
299
|
self._debug_mode: bool = False
|
300
|
-
self._configured_threadpool: bool = False
|
301
300
|
self._sys_db_field: Optional[SystemDatabase] = None
|
302
301
|
self._app_db_field: Optional[ApplicationDatabase] = None
|
303
302
|
self._registry: DBOSRegistry = _get_or_create_dbos_registry()
|
@@ -410,7 +409,7 @@ class DBOS:
|
|
410
409
|
GlobalParams.executor_id = str(uuid.uuid4())
|
411
410
|
dbos_logger.info(f"Executor ID: {GlobalParams.executor_id}")
|
412
411
|
dbos_logger.info(f"Application version: {GlobalParams.app_version}")
|
413
|
-
self._executor_field = ThreadPoolExecutor(max_workers=
|
412
|
+
self._executor_field = ThreadPoolExecutor(max_workers=sys.maxsize)
|
414
413
|
self._background_event_loop.start()
|
415
414
|
assert self._config["database_url"] is not None
|
416
415
|
assert self._config["database"]["sys_db_engine_kwargs"] is not None
|
@@ -941,11 +940,8 @@ class DBOS:
|
|
941
940
|
|
942
941
|
This function is called before the first call to asyncio.to_thread.
|
943
942
|
"""
|
944
|
-
if _get_dbos_instance()._configured_threadpool:
|
945
|
-
return
|
946
943
|
loop = asyncio.get_running_loop()
|
947
944
|
loop.set_default_executor(_get_dbos_instance()._executor)
|
948
|
-
_get_dbos_instance()._configured_threadpool = True
|
949
945
|
|
950
946
|
@classmethod
|
951
947
|
def resume_workflow(cls, workflow_id: str) -> WorkflowHandle[Any]:
|
dbos/_event_loop.py
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
import asyncio
|
2
2
|
import threading
|
3
|
-
from concurrent.futures import ThreadPoolExecutor
|
4
3
|
from typing import Any, Coroutine, Optional, TypeVar
|
5
4
|
|
6
5
|
|
@@ -34,17 +33,15 @@ class BackgroundEventLoop:
|
|
34
33
|
|
35
34
|
def _run_event_loop(self) -> None:
|
36
35
|
self._loop = asyncio.new_event_loop()
|
37
|
-
|
38
|
-
self._loop.set_default_executor(thread_pool)
|
39
|
-
asyncio.set_event_loop(self._loop)
|
36
|
+
asyncio.set_event_loop(self._loop)
|
40
37
|
|
41
|
-
|
42
|
-
|
38
|
+
self._running = True
|
39
|
+
self._ready.set() # Signal that the loop is ready
|
43
40
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
41
|
+
try:
|
42
|
+
self._loop.run_forever()
|
43
|
+
finally:
|
44
|
+
self._loop.close()
|
48
45
|
|
49
46
|
async def _shutdown(self) -> None:
|
50
47
|
if self._loop is None:
|
dbos/_sys_db.py
CHANGED
@@ -1385,35 +1385,35 @@ class SystemDatabase:
|
|
1385
1385
|
payload = f"{workflow_uuid}::{topic}"
|
1386
1386
|
condition = threading.Condition()
|
1387
1387
|
# Must acquire first before adding to the map. Otherwise, the notification listener may notify it before the condition is acquired and waited.
|
1388
|
-
|
1389
|
-
|
1390
|
-
|
1391
|
-
|
1392
|
-
|
1393
|
-
|
1394
|
-
raise DBOSWorkflowConflictIDError(workflow_uuid)
|
1388
|
+
try:
|
1389
|
+
condition.acquire()
|
1390
|
+
success, _ = self.notifications_map.set(payload, condition)
|
1391
|
+
if not success:
|
1392
|
+
# This should not happen, but if it does, it means the workflow is executed concurrently.
|
1393
|
+
raise DBOSWorkflowConflictIDError(workflow_uuid)
|
1395
1394
|
|
1396
|
-
|
1397
|
-
|
1398
|
-
|
1399
|
-
|
1400
|
-
|
1401
|
-
|
1402
|
-
|
1403
|
-
|
1404
|
-
|
1405
|
-
|
1406
|
-
|
1395
|
+
# Check if the key is already in the database. If not, wait for the notification.
|
1396
|
+
init_recv: Sequence[Any]
|
1397
|
+
with self.engine.begin() as c:
|
1398
|
+
init_recv = c.execute(
|
1399
|
+
sa.select(
|
1400
|
+
SystemSchema.notifications.c.topic,
|
1401
|
+
).where(
|
1402
|
+
SystemSchema.notifications.c.destination_uuid == workflow_uuid,
|
1403
|
+
SystemSchema.notifications.c.topic == topic,
|
1404
|
+
)
|
1405
|
+
).fetchall()
|
1407
1406
|
|
1408
|
-
|
1409
|
-
|
1410
|
-
|
1411
|
-
|
1412
|
-
|
1413
|
-
|
1414
|
-
|
1415
|
-
|
1416
|
-
|
1407
|
+
if len(init_recv) == 0:
|
1408
|
+
# Wait for the notification
|
1409
|
+
# Support OAOO sleep
|
1410
|
+
actual_timeout = self.sleep(
|
1411
|
+
workflow_uuid, timeout_function_id, timeout_seconds, skip_sleep=True
|
1412
|
+
)
|
1413
|
+
condition.wait(timeout=actual_timeout)
|
1414
|
+
finally:
|
1415
|
+
condition.release()
|
1416
|
+
self.notifications_map.pop(payload)
|
1417
1417
|
|
1418
1418
|
# Transactionally consume and return the message if it's in the database, otherwise return null.
|
1419
1419
|
with self.engine.begin() as c:
|
@@ -1,7 +1,7 @@
|
|
1
|
-
dbos-1.
|
2
|
-
dbos-1.
|
3
|
-
dbos-1.
|
4
|
-
dbos-1.
|
1
|
+
dbos-1.3.0a2.dist-info/METADATA,sha256=FLGWD6E0OqgjOJ8RnpSPGTK9sAi0s4F_7_I_vfu51KE,13267
|
2
|
+
dbos-1.3.0a2.dist-info/WHEEL,sha256=tSfRZzRHthuv7vxpI4aehrdN9scLjk-dCJkPLzkHxGg,90
|
3
|
+
dbos-1.3.0a2.dist-info/entry_points.txt,sha256=_QOQ3tVfEjtjBlr1jS4sHqHya9lI2aIEIWkz8dqYp14,58
|
4
|
+
dbos-1.3.0a2.dist-info/licenses/LICENSE,sha256=VGZit_a5-kdw9WT6fY5jxAWVwGQzgLFyPWrcVVUhVNU,1067
|
5
5
|
dbos/__init__.py,sha256=NssPCubaBxdiKarOWa-wViz1hdJSkmBGcpLX_gQ4NeA,891
|
6
6
|
dbos/__main__.py,sha256=G7Exn-MhGrVJVDbgNlpzhfh8WMX_72t3_oJaFT9Lmt8,653
|
7
7
|
dbos/_admin_server.py,sha256=TWXi4drrzKFpKkUmEJpJkQBZxAtOalnhtYicEn2nDK0,10618
|
@@ -13,12 +13,12 @@ dbos/_conductor/protocol.py,sha256=wgOFZxmS81bv0WCB9dAyg0s6QzldpzVKQDoSPeaX0Ws,6
|
|
13
13
|
dbos/_context.py,sha256=5ajoWAmToAfzzmMLylnJZoL4Ny9rBwZWuG05sXadMIA,24798
|
14
14
|
dbos/_core.py,sha256=m2i9lsHjNKTi8BQyiSOUBrAVH5OvMoBswNZPRpMVIC0,48662
|
15
15
|
dbos/_croniter.py,sha256=XHAyUyibs_59sJQfSNWkP7rqQY6_XrlfuuCxk4jYqek,47559
|
16
|
-
dbos/_dbos.py,sha256=
|
16
|
+
dbos/_dbos.py,sha256=ccVC97MgJr979z9sc0HhVLrdi1BJ9GzaMJSKFiPyKck,47041
|
17
17
|
dbos/_dbos_config.py,sha256=JWVuPE_Ifyr-pYHFxclFalB_HZ8ETFCGNJzBHGpClXw,20347
|
18
18
|
dbos/_debug.py,sha256=MNlQVZ6TscGCRQeEEL0VE8Uignvr6dPeDDDefS3xgIE,1823
|
19
19
|
dbos/_docker_pg_helper.py,sha256=tLJXWqZ4S-ExcaPnxg_i6cVxL6ZxrYlZjaGsklY-s2I,6115
|
20
20
|
dbos/_error.py,sha256=q0OQJZTbR8FFHV9hEpAGpz9oWBT5L509zUhmyff7FJw,8500
|
21
|
-
dbos/_event_loop.py,sha256=
|
21
|
+
dbos/_event_loop.py,sha256=NmaLbEQFfEK36S_0KhVD39YdYrGce3qSKCTJ-5RqKQ0,2136
|
22
22
|
dbos/_fastapi.py,sha256=m4SL3H9P-NBQ_ZrbFxAWMOqNyIi3HGEn2ODR7xAK038,3118
|
23
23
|
dbos/_flask.py,sha256=Npnakt-a3W5OykONFRkDRnumaDhTQmA0NPdUCGRYKXE,1652
|
24
24
|
dbos/_kafka.py,sha256=pz0xZ9F3X9Ky1k-VSbeF3tfPhP3UPr3lUUhUfE41__U,4198
|
@@ -47,7 +47,7 @@ dbos/_schemas/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
47
47
|
dbos/_schemas/application_database.py,sha256=SypAS9l9EsaBHFn9FR8jmnqt01M74d9AF1AMa4m2hhI,1040
|
48
48
|
dbos/_schemas/system_database.py,sha256=3Z0L72bOgHnusK1hBaETWU9RfiLBP0QnS-fdu41i0yY,5835
|
49
49
|
dbos/_serialization.py,sha256=bWuwhXSQcGmiazvhJHA5gwhrRWxtmFmcCFQSDJnqqkU,3666
|
50
|
-
dbos/_sys_db.py,sha256=
|
50
|
+
dbos/_sys_db.py,sha256=KP2wIoytbtFoNzx3-SmobkAn3HhE6tZy_9Vvh8qpUQ8,85780
|
51
51
|
dbos/_templates/dbos-db-starter/README.md,sha256=GhxhBj42wjTt1fWEtwNriHbJuKb66Vzu89G4pxNHw2g,930
|
52
52
|
dbos/_templates/dbos-db-starter/__package/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
53
53
|
dbos/_templates/dbos-db-starter/__package/main.py.dbos,sha256=aQnBPSSQpkB8ERfhf7gB7P9tsU6OPKhZscfeh0yiaD8,2702
|
@@ -67,4 +67,4 @@ dbos/cli/cli.py,sha256=EemOMqNpzSU2BQhAxV_e59pBRITDLwt49HF6W3uWBZg,20775
|
|
67
67
|
dbos/dbos-config.schema.json,sha256=CjaspeYmOkx6Ip_pcxtmfXJTn_YGdSx_0pcPBF7KZmo,6060
|
68
68
|
dbos/py.typed,sha256=QfzXT1Ktfk3Rj84akygc7_42z0lRpCq0Ilh8OXI6Zas,44
|
69
69
|
version/__init__.py,sha256=L4sNxecRuqdtSFdpUGX3TtBi9KL3k7YsZVIvv-fv9-A,1678
|
70
|
-
dbos-1.
|
70
|
+
dbos-1.3.0a2.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|