dbos 0.20.0a3__py3-none-any.whl → 0.20.0a5__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 dbos might be problematic. Click here for more details.
- dbos/_core.py +21 -1
- dbos/_fastapi.py +10 -9
- {dbos-0.20.0a3.dist-info → dbos-0.20.0a5.dist-info}/METADATA +1 -1
- {dbos-0.20.0a3.dist-info → dbos-0.20.0a5.dist-info}/RECORD +7 -7
- {dbos-0.20.0a3.dist-info → dbos-0.20.0a5.dist-info}/WHEEL +0 -0
- {dbos-0.20.0a3.dist-info → dbos-0.20.0a5.dist-info}/entry_points.txt +0 -0
- {dbos-0.20.0a3.dist-info → dbos-0.20.0a5.dist-info}/licenses/LICENSE +0 -0
dbos/_core.py
CHANGED
|
@@ -488,6 +488,22 @@ def start_workflow(
|
|
|
488
488
|
return WorkflowHandleFuture(new_wf_id, future, dbos)
|
|
489
489
|
|
|
490
490
|
|
|
491
|
+
if sys.version_info < (3, 12):
|
|
492
|
+
|
|
493
|
+
def _mark_coroutine(func: Callable[P, R]) -> Callable[P, R]:
|
|
494
|
+
@wraps(func)
|
|
495
|
+
async def async_wrapper(*args: Any, **kwargs: Any) -> R:
|
|
496
|
+
return await func(*args, **kwargs) # type: ignore
|
|
497
|
+
|
|
498
|
+
return async_wrapper # type: ignore
|
|
499
|
+
|
|
500
|
+
else:
|
|
501
|
+
|
|
502
|
+
def _mark_coroutine(func: Callable[P, R]) -> Callable[P, R]:
|
|
503
|
+
inspect.markcoroutinefunction(func)
|
|
504
|
+
return func
|
|
505
|
+
|
|
506
|
+
|
|
491
507
|
def workflow_wrapper(
|
|
492
508
|
dbosreg: "DBOSRegistry",
|
|
493
509
|
func: Callable[P, R],
|
|
@@ -548,7 +564,7 @@ def workflow_wrapper(
|
|
|
548
564
|
)
|
|
549
565
|
return outcome() # type: ignore
|
|
550
566
|
|
|
551
|
-
return wrapper
|
|
567
|
+
return _mark_coroutine(wrapper) if inspect.iscoroutinefunction(func) else wrapper
|
|
552
568
|
|
|
553
569
|
|
|
554
570
|
def decorate_workflow(
|
|
@@ -838,6 +854,10 @@ def decorate_step(
|
|
|
838
854
|
assert tempwf
|
|
839
855
|
return tempwf(*args, **kwargs)
|
|
840
856
|
|
|
857
|
+
wrapper = (
|
|
858
|
+
_mark_coroutine(wrapper) if inspect.iscoroutinefunction(func) else wrapper # type: ignore
|
|
859
|
+
)
|
|
860
|
+
|
|
841
861
|
def temp_wf_sync(*args: Any, **kwargs: Any) -> Any:
|
|
842
862
|
return wrapper(*args, **kwargs)
|
|
843
863
|
|
dbos/_fastapi.py
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import uuid
|
|
2
|
-
from typing import Any, Callable, cast
|
|
2
|
+
from typing import Any, Callable, MutableMapping, cast
|
|
3
3
|
|
|
4
4
|
from fastapi import FastAPI
|
|
5
5
|
from fastapi import Request as FastAPIRequest
|
|
6
6
|
from fastapi.responses import JSONResponse
|
|
7
|
-
from starlette.types import ASGIApp,
|
|
7
|
+
from starlette.types import ASGIApp, Receive, Scope, Send
|
|
8
8
|
|
|
9
9
|
from . import DBOS
|
|
10
10
|
from ._context import (
|
|
@@ -61,15 +61,16 @@ class LifespanMiddleware:
|
|
|
61
61
|
|
|
62
62
|
async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None:
|
|
63
63
|
if scope["type"] == "lifespan":
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
if message["type"] == "lifespan.startup":
|
|
64
|
+
|
|
65
|
+
async def wrapped_send(message: MutableMapping[str, Any]) -> None:
|
|
66
|
+
if message["type"] == "lifespan.startup.complete":
|
|
67
67
|
self.dbos._launch()
|
|
68
|
-
|
|
69
|
-
elif message["type"] == "lifespan.shutdown":
|
|
68
|
+
elif message["type"] == "lifespan.shutdown.complete":
|
|
70
69
|
self.dbos._destroy()
|
|
71
|
-
|
|
72
|
-
|
|
70
|
+
await send(message)
|
|
71
|
+
|
|
72
|
+
# Call the original app with our wrapped functions
|
|
73
|
+
await self.app(scope, receive, wrapped_send)
|
|
73
74
|
else:
|
|
74
75
|
await self.app(scope, receive, send)
|
|
75
76
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
dbos-0.20.
|
|
2
|
-
dbos-0.20.
|
|
3
|
-
dbos-0.20.
|
|
4
|
-
dbos-0.20.
|
|
1
|
+
dbos-0.20.0a5.dist-info/METADATA,sha256=cZ5iLUPDym0buq95icnnMNaD7rZV90kbOut-927xtU0,5309
|
|
2
|
+
dbos-0.20.0a5.dist-info/WHEEL,sha256=thaaA2w1JzcGC48WYufAs8nrYZjJm8LqNfnXFOFyCC4,90
|
|
3
|
+
dbos-0.20.0a5.dist-info/entry_points.txt,sha256=_QOQ3tVfEjtjBlr1jS4sHqHya9lI2aIEIWkz8dqYp14,58
|
|
4
|
+
dbos-0.20.0a5.dist-info/licenses/LICENSE,sha256=VGZit_a5-kdw9WT6fY5jxAWVwGQzgLFyPWrcVVUhVNU,1067
|
|
5
5
|
dbos/__init__.py,sha256=CxRHBHEthPL4PZoLbZhp3rdm44-KkRTT2-7DkK9d4QQ,724
|
|
6
6
|
dbos/_admin_server.py,sha256=PJgneZG9-64TapZrPeJtt73puAswRImCE5uce2k2PKU,4750
|
|
7
7
|
dbos/_app_db.py,sha256=_tv2vmPjjiaikwgxH3mqxgJ4nUUcG2-0uMXKWCqVu1c,5509
|
|
@@ -10,13 +10,13 @@ dbos/_cloudutils/authentication.py,sha256=V0fCWQN9stCkhbuuxgPTGpvuQcDqfU3KAxPAh0
|
|
|
10
10
|
dbos/_cloudutils/cloudutils.py,sha256=5e3CW1deSW-dI5G3QN0XbiVsBhyqT8wu7fuV2f8wtGU,7688
|
|
11
11
|
dbos/_cloudutils/databases.py,sha256=x4187Djsyoa-QaG3Kog8JT2_GERsnqa93LIVanmVUmg,8393
|
|
12
12
|
dbos/_context.py,sha256=RH08s_nee95vgxdz6AsYuVWF1LuJSVtOyIifblsa4pw,18760
|
|
13
|
-
dbos/_core.py,sha256
|
|
13
|
+
dbos/_core.py,sha256=-2oh2-NicMJBwTwrd2EQBQm4Vu0caozFeoS9Kj47DzM,36588
|
|
14
14
|
dbos/_croniter.py,sha256=hbhgfsHBqclUS8VeLnJ9PSE9Z54z6mi4nnrr1aUXn0k,47561
|
|
15
15
|
dbos/_db_wizard.py,sha256=xgKLna0_6Xi50F3o8msRosXba8NScHlpJR5ICVCkHDQ,7534
|
|
16
16
|
dbos/_dbos.py,sha256=Kgnity6JxjThIf1L8CQbeobQMiJqUUeWlRf36_eGu2g,35385
|
|
17
17
|
dbos/_dbos_config.py,sha256=h_q1gzudhsAMVkGMD0qQ6kLic6YhdJgzm50YFSIx9Bo,8196
|
|
18
18
|
dbos/_error.py,sha256=vtaSsG0QW6cRlwfZ4zzZWy_IHCZlomwSlrDyGWuyn8c,4337
|
|
19
|
-
dbos/_fastapi.py,sha256=
|
|
19
|
+
dbos/_fastapi.py,sha256=ke03vqsSYDnO6XeOtOVFXj0-f-v1MGsOxa9McaROvNc,3616
|
|
20
20
|
dbos/_flask.py,sha256=DZKUZR5-xOzPI7tYZ53r2PvvHVoAb8SYwLzMVFsVfjI,2608
|
|
21
21
|
dbos/_kafka.py,sha256=o6DbwnsYRDtvVTZVsN7BAK8cdP79AfoWX3Q7CGY2Yuo,4199
|
|
22
22
|
dbos/_kafka_message.py,sha256=NYvOXNG3Qn7bghn1pv3fg4Pbs86ILZGcK4IB-MLUNu0,409
|
|
@@ -60,4 +60,4 @@ dbos/cli/cli.py,sha256=4YRwY9fIOPAP7CS1OhTOZvLeyihK6ddn0KcYRDvX0E8,13928
|
|
|
60
60
|
dbos/dbos-config.schema.json,sha256=X5TpXNcARGceX0zQs0fVgtZW_Xj9uBbY5afPt9Rz9yk,5741
|
|
61
61
|
dbos/py.typed,sha256=QfzXT1Ktfk3Rj84akygc7_42z0lRpCq0Ilh8OXI6Zas,44
|
|
62
62
|
version/__init__.py,sha256=L4sNxecRuqdtSFdpUGX3TtBi9KL3k7YsZVIvv-fv9-A,1678
|
|
63
|
-
dbos-0.20.
|
|
63
|
+
dbos-0.20.0a5.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|