dbos 1.14.0a3__py3-none-any.whl → 1.14.0a4__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/_core.py +22 -0
- {dbos-1.14.0a3.dist-info → dbos-1.14.0a4.dist-info}/METADATA +1 -1
- {dbos-1.14.0a3.dist-info → dbos-1.14.0a4.dist-info}/RECORD +6 -6
- {dbos-1.14.0a3.dist-info → dbos-1.14.0a4.dist-info}/WHEEL +0 -0
- {dbos-1.14.0a3.dist-info → dbos-1.14.0a4.dist-info}/entry_points.txt +0 -0
- {dbos-1.14.0a3.dist-info → dbos-1.14.0a4.dist-info}/licenses/LICENSE +0 -0
dbos/_core.py
CHANGED
@@ -56,6 +56,7 @@ from ._error import (
|
|
56
56
|
DBOSWorkflowConflictIDError,
|
57
57
|
DBOSWorkflowFunctionNotFoundError,
|
58
58
|
)
|
59
|
+
from ._logger import dbos_logger
|
59
60
|
from ._registrations import (
|
60
61
|
DEFAULT_MAX_RECOVERY_ATTEMPTS,
|
61
62
|
get_config_name,
|
@@ -96,6 +97,14 @@ F = TypeVar("F", bound=Callable[..., Any])
|
|
96
97
|
TEMP_SEND_WF_NAME = "<temp>.temp_send_workflow"
|
97
98
|
|
98
99
|
|
100
|
+
def check_is_in_coroutine() -> bool:
|
101
|
+
try:
|
102
|
+
asyncio.get_running_loop()
|
103
|
+
return True
|
104
|
+
except RuntimeError:
|
105
|
+
return False
|
106
|
+
|
107
|
+
|
99
108
|
class WorkflowHandleFuture(Generic[R]):
|
100
109
|
|
101
110
|
def __init__(self, workflow_id: str, future: Future[R], dbos: "DBOS"):
|
@@ -828,6 +837,11 @@ def workflow_wrapper(
|
|
828
837
|
dbos._sys_db.record_get_result(workflow_id, serialized_r, None)
|
829
838
|
return r
|
830
839
|
|
840
|
+
if check_is_in_coroutine() and not inspect.iscoroutinefunction(func):
|
841
|
+
dbos_logger.warning(
|
842
|
+
f"Sync workflow ({get_dbos_func_name(func)}) shouldn't be invoked from within another async function. Define it as async or use asyncio.to_thread instead."
|
843
|
+
)
|
844
|
+
|
831
845
|
outcome = (
|
832
846
|
wfOutcome.wrap(init_wf, dbos=dbos)
|
833
847
|
.also(DBOSAssumeRole(rr))
|
@@ -1009,6 +1023,10 @@ def decorate_transaction(
|
|
1009
1023
|
assert (
|
1010
1024
|
ctx.is_workflow()
|
1011
1025
|
), "Transactions must be called from within workflows"
|
1026
|
+
if check_is_in_coroutine():
|
1027
|
+
dbos_logger.warning(
|
1028
|
+
f"Transaction function ({get_dbos_func_name(func)}) shouldn't be invoked from within another async function. Use asyncio.to_thread instead."
|
1029
|
+
)
|
1012
1030
|
with DBOSAssumeRole(rr):
|
1013
1031
|
return invoke_tx(*args, **kwargs)
|
1014
1032
|
else:
|
@@ -1153,6 +1171,10 @@ def decorate_step(
|
|
1153
1171
|
|
1154
1172
|
@wraps(func)
|
1155
1173
|
def wrapper(*args: Any, **kwargs: Any) -> Any:
|
1174
|
+
if check_is_in_coroutine() and not inspect.iscoroutinefunction(func):
|
1175
|
+
dbos_logger.warning(
|
1176
|
+
f"Sync step ({get_dbos_func_name(func)}) shouldn't be invoked from within another async function. Define it as async or use asyncio.to_thread instead."
|
1177
|
+
)
|
1156
1178
|
# If the step is called from a workflow, run it as a step.
|
1157
1179
|
# Otherwise, run it as a normal function.
|
1158
1180
|
ctx = get_local_dbos_context()
|
@@ -1,7 +1,7 @@
|
|
1
|
-
dbos-1.14.
|
2
|
-
dbos-1.14.
|
3
|
-
dbos-1.14.
|
4
|
-
dbos-1.14.
|
1
|
+
dbos-1.14.0a4.dist-info/METADATA,sha256=H6-_1NWU-g_Z0T3icZiFc1ZaDVv5_zqFdaf2AUC0vWU,13268
|
2
|
+
dbos-1.14.0a4.dist-info/WHEEL,sha256=9P2ygRxDrTJz3gsagc0Z96ukrxjr-LFBGOgv3AuKlCA,90
|
3
|
+
dbos-1.14.0a4.dist-info/entry_points.txt,sha256=_QOQ3tVfEjtjBlr1jS4sHqHya9lI2aIEIWkz8dqYp14,58
|
4
|
+
dbos-1.14.0a4.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=e8ELhcDWqR3_PNobnNgUvLGh5lzZq0yFSF6dvtzoQRI,16267
|
@@ -28,7 +28,7 @@ dbos/_client.py,sha256=_3Wc2QQc5VDcBuJ3cNb-lWg439OuITo2ex4Y7qb9l44,18800
|
|
28
28
|
dbos/_conductor/conductor.py,sha256=3E_hL3c9g9yWqKZkvI6KA0-ZzPMPRo06TOzT1esMiek,24114
|
29
29
|
dbos/_conductor/protocol.py,sha256=q3rgLxINFtWFigdOONc-4gX4vn66UmMlJQD6Kj8LnL4,7420
|
30
30
|
dbos/_context.py,sha256=IMboNgbCqTxfIORqeifE3da-Ce5siMz7MYMLPk5M-AQ,26851
|
31
|
-
dbos/_core.py,sha256=
|
31
|
+
dbos/_core.py,sha256=Lm4gCAVZqNbJdZlXPQ7WROrdhhJ6tWhNzbpe5hgEDSs,49866
|
32
32
|
dbos/_croniter.py,sha256=XHAyUyibs_59sJQfSNWkP7rqQY6_XrlfuuCxk4jYqek,47559
|
33
33
|
dbos/_dbos.py,sha256=wKLN7W1ej6cyEOHnCtt3-awnU6SR6MQAlOvTTt5_N-E,58219
|
34
34
|
dbos/_dbos_config.py,sha256=_26ktif8qAZW4Ujg6dZfLkYO7dE4CI8b3IQbw_5YkpA,25710
|
@@ -75,4 +75,4 @@ dbos/cli/migration.py,sha256=5GiyagLZkyVvDz3StYxtFdkFoKFCmh6eSXjzsIGhZ_A,3330
|
|
75
75
|
dbos/dbos-config.schema.json,sha256=LyUT1DOTaAwOP6suxQGS5KemVIqXGPyu_q7Hbo0neA8,6192
|
76
76
|
dbos/py.typed,sha256=QfzXT1Ktfk3Rj84akygc7_42z0lRpCq0Ilh8OXI6Zas,44
|
77
77
|
version/__init__.py,sha256=L4sNxecRuqdtSFdpUGX3TtBi9KL3k7YsZVIvv-fv9-A,1678
|
78
|
-
dbos-1.14.
|
78
|
+
dbos-1.14.0a4.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|