dbos 0.27.0a10__py3-none-any.whl → 0.27.0a11__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/_error.py +15 -0
- dbos/_serialization.py +54 -3
- dbos/_sys_db.py +18 -14
- {dbos-0.27.0a10.dist-info → dbos-0.27.0a11.dist-info}/METADATA +1 -1
- {dbos-0.27.0a10.dist-info → dbos-0.27.0a11.dist-info}/RECORD +8 -8
- {dbos-0.27.0a10.dist-info → dbos-0.27.0a11.dist-info}/WHEEL +0 -0
- {dbos-0.27.0a10.dist-info → dbos-0.27.0a11.dist-info}/entry_points.txt +0 -0
- {dbos-0.27.0a10.dist-info → dbos-0.27.0a11.dist-info}/licenses/LICENSE +0 -0
dbos/_error.py
CHANGED
@@ -134,12 +134,17 @@ class DBOSNotAuthorizedError(DBOSException):
|
|
134
134
|
"""Exception raised by DBOS role-based security when the user is not authorized to access a function."""
|
135
135
|
|
136
136
|
def __init__(self, msg: str):
|
137
|
+
self.msg = msg
|
137
138
|
super().__init__(
|
138
139
|
msg,
|
139
140
|
dbos_error_code=DBOSErrorCode.NotAuthorized.value,
|
140
141
|
)
|
141
142
|
self.status_code = 403
|
142
143
|
|
144
|
+
def __reduce__(self) -> Any:
|
145
|
+
# Tell jsonpickle how to reconstruct this object
|
146
|
+
return (self.__class__, (self.msg,))
|
147
|
+
|
143
148
|
|
144
149
|
class DBOSMaxStepRetriesExceeded(DBOSException):
|
145
150
|
"""Exception raised when a step was retried the maximimum number of times without success."""
|
@@ -185,11 +190,21 @@ class DBOSQueueDeduplicatedError(DBOSException):
|
|
185
190
|
def __init__(
|
186
191
|
self, workflow_id: str, queue_name: str, deduplication_id: str
|
187
192
|
) -> None:
|
193
|
+
self.workflow_id = workflow_id
|
194
|
+
self.queue_name = queue_name
|
195
|
+
self.deduplication_id = deduplication_id
|
188
196
|
super().__init__(
|
189
197
|
f"Workflow {workflow_id} was deduplicated due to an existing workflow in queue {queue_name} with deduplication ID {deduplication_id}.",
|
190
198
|
dbos_error_code=DBOSErrorCode.QueueDeduplicated.value,
|
191
199
|
)
|
192
200
|
|
201
|
+
def __reduce__(self) -> Any:
|
202
|
+
# Tell jsonpickle how to reconstruct this object
|
203
|
+
return (
|
204
|
+
self.__class__,
|
205
|
+
(self.workflow_id, self.queue_name, self.deduplication_id),
|
206
|
+
)
|
207
|
+
|
193
208
|
|
194
209
|
#######################################
|
195
210
|
## BaseException
|
dbos/_serialization.py
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
import types
|
2
|
-
from typing import Any, Dict, Tuple, TypedDict
|
2
|
+
from typing import Any, Dict, Optional, Tuple, TypedDict
|
3
3
|
|
4
4
|
import jsonpickle # type: ignore
|
5
5
|
|
6
|
+
from ._logger import dbos_logger
|
7
|
+
|
6
8
|
|
7
9
|
class WorkflowInputs(TypedDict):
|
8
10
|
args: Tuple[Any, ...]
|
@@ -51,5 +53,54 @@ def deserialize_args(serialized_data: str) -> WorkflowInputs:
|
|
51
53
|
|
52
54
|
def deserialize_exception(serialized_data: str) -> Exception:
|
53
55
|
"""Deserialize JSON string back to a Python Exception using jsonpickle."""
|
54
|
-
|
55
|
-
return
|
56
|
+
exc: Exception = jsonpickle.decode(serialized_data)
|
57
|
+
return exc
|
58
|
+
|
59
|
+
|
60
|
+
def safe_deserialize(
|
61
|
+
workflow_id: str,
|
62
|
+
*,
|
63
|
+
serialized_input: Optional[str],
|
64
|
+
serialized_output: Optional[str],
|
65
|
+
serialized_exception: Optional[str],
|
66
|
+
) -> tuple[Optional[WorkflowInputs], Optional[Any], Optional[Exception]]:
|
67
|
+
"""
|
68
|
+
This function safely deserializes a workflow's recorded input and output/exception.
|
69
|
+
If any of them is not deserializable, it logs a warning and returns a string instead of throwing an exception.
|
70
|
+
|
71
|
+
This function is used in workflow introspection methods (get_workflows and get_queued_workflow)
|
72
|
+
to ensure errors related to nondeserializable objects are observable.
|
73
|
+
"""
|
74
|
+
input: Optional[WorkflowInputs]
|
75
|
+
try:
|
76
|
+
input = (
|
77
|
+
deserialize_args(serialized_input) if serialized_input is not None else None
|
78
|
+
)
|
79
|
+
except Exception as e:
|
80
|
+
dbos_logger.warning(
|
81
|
+
f"Warning: input object could not be deserialized for workflow {workflow_id}, returning as string: {e}"
|
82
|
+
)
|
83
|
+
input = serialized_input # type: ignore
|
84
|
+
output: Optional[Any]
|
85
|
+
try:
|
86
|
+
output = (
|
87
|
+
deserialize(serialized_output) if serialized_output is not None else None
|
88
|
+
)
|
89
|
+
except Exception as e:
|
90
|
+
dbos_logger.warning(
|
91
|
+
f"Warning: output object could not be deserialized for workflow {workflow_id}, returning as string: {e}"
|
92
|
+
)
|
93
|
+
output = serialized_output
|
94
|
+
exception: Optional[Exception]
|
95
|
+
try:
|
96
|
+
exception = (
|
97
|
+
deserialize_exception(serialized_exception)
|
98
|
+
if serialized_exception is not None
|
99
|
+
else None
|
100
|
+
)
|
101
|
+
except Exception as e:
|
102
|
+
dbos_logger.warning(
|
103
|
+
f"Warning: exception object could not be deserialized for workflow {workflow_id}, returning as string: {e}"
|
104
|
+
)
|
105
|
+
exception = serialized_exception # type: ignore
|
106
|
+
return input, output, exception
|
dbos/_sys_db.py
CHANGED
@@ -901,13 +901,15 @@ class SystemDatabase:
|
|
901
901
|
info.app_version = row[14]
|
902
902
|
info.app_id = row[15]
|
903
903
|
|
904
|
-
inputs = _serialization.
|
905
|
-
|
906
|
-
|
907
|
-
|
908
|
-
|
909
|
-
|
910
|
-
|
904
|
+
inputs, output, exception = _serialization.safe_deserialize(
|
905
|
+
info.workflow_id,
|
906
|
+
serialized_input=row[16],
|
907
|
+
serialized_output=row[17],
|
908
|
+
serialized_exception=row[18],
|
909
|
+
)
|
910
|
+
info.input = inputs
|
911
|
+
info.output = output
|
912
|
+
info.error = exception
|
911
913
|
|
912
914
|
infos.append(info)
|
913
915
|
return infos
|
@@ -1007,13 +1009,15 @@ class SystemDatabase:
|
|
1007
1009
|
info.app_version = row[14]
|
1008
1010
|
info.app_id = row[15]
|
1009
1011
|
|
1010
|
-
inputs = _serialization.
|
1011
|
-
|
1012
|
-
|
1013
|
-
|
1014
|
-
|
1015
|
-
|
1016
|
-
|
1012
|
+
inputs, output, exception = _serialization.safe_deserialize(
|
1013
|
+
info.workflow_id,
|
1014
|
+
serialized_input=row[16],
|
1015
|
+
serialized_output=row[17],
|
1016
|
+
serialized_exception=row[18],
|
1017
|
+
)
|
1018
|
+
info.input = inputs
|
1019
|
+
info.output = output
|
1020
|
+
info.error = exception
|
1017
1021
|
|
1018
1022
|
infos.append(info)
|
1019
1023
|
|
@@ -1,7 +1,7 @@
|
|
1
|
-
dbos-0.27.
|
2
|
-
dbos-0.27.
|
3
|
-
dbos-0.27.
|
4
|
-
dbos-0.27.
|
1
|
+
dbos-0.27.0a11.dist-info/METADATA,sha256=yw_xz14PUHXYfgd-u1bEU0qU0jmm7nmxV2m5yrCGMZo,5554
|
2
|
+
dbos-0.27.0a11.dist-info/WHEEL,sha256=tSfRZzRHthuv7vxpI4aehrdN9scLjk-dCJkPLzkHxGg,90
|
3
|
+
dbos-0.27.0a11.dist-info/entry_points.txt,sha256=_QOQ3tVfEjtjBlr1jS4sHqHya9lI2aIEIWkz8dqYp14,58
|
4
|
+
dbos-0.27.0a11.dist-info/licenses/LICENSE,sha256=VGZit_a5-kdw9WT6fY5jxAWVwGQzgLFyPWrcVVUhVNU,1067
|
5
5
|
dbos/__init__.py,sha256=-FdBlOlr-f2tY__C23J4v22MoCAXqcDN_-zXsJXdoZ0,1005
|
6
6
|
dbos/__main__.py,sha256=G7Exn-MhGrVJVDbgNlpzhfh8WMX_72t3_oJaFT9Lmt8,653
|
7
7
|
dbos/_admin_server.py,sha256=NG0JWQQer9kEslPNAA0dBv-O262sjarz7ZSlv8yird0,9053
|
@@ -17,7 +17,7 @@ dbos/_dbos.py,sha256=ENDQ6Xi4MoKrjXoCRlk1B64yZP7D-MyDUjUlOTRsw9I,48314
|
|
17
17
|
dbos/_dbos_config.py,sha256=L0Z0OOB5FoPM9g-joZqXGeJnlxWQsEUtgPtgtg9Uf48,21732
|
18
18
|
dbos/_debug.py,sha256=MNlQVZ6TscGCRQeEEL0VE8Uignvr6dPeDDDefS3xgIE,1823
|
19
19
|
dbos/_docker_pg_helper.py,sha256=NmcgqmR5rQA_4igfeqh8ugNT2z3YmoOvuep_MEtxTiY,5854
|
20
|
-
dbos/_error.py,sha256=
|
20
|
+
dbos/_error.py,sha256=EN4eVBjMT3k7O7hfqJl6mIf4sxWPsiAOM086yhcGH_g,8012
|
21
21
|
dbos/_event_loop.py,sha256=NmaLbEQFfEK36S_0KhVD39YdYrGce3qSKCTJ-5RqKQ0,2136
|
22
22
|
dbos/_fastapi.py,sha256=PhaKftbApHnjtYEOw0EYna_3K0cmz__J9of7mRJWzu4,3704
|
23
23
|
dbos/_flask.py,sha256=DZKUZR5-xOzPI7tYZ53r2PvvHVoAb8SYwLzMVFsVfjI,2608
|
@@ -46,8 +46,8 @@ dbos/_scheduler.py,sha256=SR1oRZRcVzYsj-JauV2LA8JtwTkt8mru7qf6H1AzQ1U,2027
|
|
46
46
|
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=wLqrhApNqrwZC1SdUxi_ca0y_66WzKaaBOxvND4_bdg,5738
|
49
|
-
dbos/_serialization.py,sha256=
|
50
|
-
dbos/_sys_db.py,sha256=
|
49
|
+
dbos/_serialization.py,sha256=bWuwhXSQcGmiazvhJHA5gwhrRWxtmFmcCFQSDJnqqkU,3666
|
50
|
+
dbos/_sys_db.py,sha256=caIbhOwAnfugGzhnJ5rOG2V_bXphD9tJ4Un37gnG47A,82281
|
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,sha256=nJMN3ZD2lmwg4Dcgmiwqc-tQGuCJuJal2Xl85iA277U,2453
|
@@ -67,4 +67,4 @@ dbos/cli/cli.py,sha256=a3rUrHog5-e22KjjUPOuTjH20PmUgSP0amRpMd6LVJE,18882
|
|
67
67
|
dbos/dbos-config.schema.json,sha256=8KcwJb_sQc4-6tQG2TLmjE_nratfrQa0qVLl9XPsvWE,6367
|
68
68
|
dbos/py.typed,sha256=QfzXT1Ktfk3Rj84akygc7_42z0lRpCq0Ilh8OXI6Zas,44
|
69
69
|
version/__init__.py,sha256=L4sNxecRuqdtSFdpUGX3TtBi9KL3k7YsZVIvv-fv9-A,1678
|
70
|
-
dbos-0.27.
|
70
|
+
dbos-0.27.0a11.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|