dbos 0.5.0a3__py3-none-any.whl → 0.5.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/context.py +16 -18
- dbos/core.py +31 -36
- dbos/dbos.py +14 -17
- dbos/error.py +5 -5
- dbos/registrations.py +1 -1
- dbos/system_database.py +1 -14
- {dbos-0.5.0a3.dist-info → dbos-0.5.0a4.dist-info}/METADATA +1 -1
- {dbos-0.5.0a3.dist-info → dbos-0.5.0a4.dist-info}/RECORD +11 -11
- {dbos-0.5.0a3.dist-info → dbos-0.5.0a4.dist-info}/WHEEL +0 -0
- {dbos-0.5.0a3.dist-info → dbos-0.5.0a4.dist-info}/entry_points.txt +0 -0
- {dbos-0.5.0a3.dist-info → dbos-0.5.0a4.dist-info}/licenses/LICENSE +0 -0
dbos/context.py
CHANGED
|
@@ -18,18 +18,16 @@ from .logger import dbos_logger
|
|
|
18
18
|
from .tracer import dbos_tracer
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
#
|
|
21
|
+
# These are used to tag OTel traces
|
|
22
22
|
class OperationType(Enum):
|
|
23
23
|
HANDLER = "handler"
|
|
24
24
|
WORKFLOW = "workflow"
|
|
25
25
|
TRANSACTION = "transaction"
|
|
26
|
-
|
|
26
|
+
STEP = "step"
|
|
27
27
|
PROCEDURE = "procedure"
|
|
28
28
|
|
|
29
29
|
|
|
30
|
-
OperationTypes = Literal[
|
|
31
|
-
"handler", "workflow", "transaction", "communicator", "procedure"
|
|
32
|
-
]
|
|
30
|
+
OperationTypes = Literal["handler", "workflow", "transaction", "step", "procedure"]
|
|
33
31
|
|
|
34
32
|
|
|
35
33
|
# Keys must be the same as in TypeScript Transact
|
|
@@ -64,7 +62,7 @@ class DBOSContext:
|
|
|
64
62
|
self.function_id: int = -1
|
|
65
63
|
self.in_recovery: bool = False
|
|
66
64
|
|
|
67
|
-
self.
|
|
65
|
+
self.curr_step_function_id: int = -1
|
|
68
66
|
self.curr_tx_function_id: int = -1
|
|
69
67
|
self.sql_session: Optional[Session] = None
|
|
70
68
|
self.spans: list[Span] = []
|
|
@@ -117,26 +115,26 @@ class DBOSContext:
|
|
|
117
115
|
def is_workflow(self) -> bool:
|
|
118
116
|
return (
|
|
119
117
|
len(self.workflow_id) > 0
|
|
120
|
-
and not self.
|
|
118
|
+
and not self.is_step()
|
|
121
119
|
and not self.is_transaction()
|
|
122
120
|
)
|
|
123
121
|
|
|
124
122
|
def is_transaction(self) -> bool:
|
|
125
123
|
return self.sql_session is not None
|
|
126
124
|
|
|
127
|
-
def
|
|
128
|
-
return self.
|
|
125
|
+
def is_step(self) -> bool:
|
|
126
|
+
return self.curr_step_function_id >= 0
|
|
129
127
|
|
|
130
|
-
def
|
|
128
|
+
def start_step(
|
|
131
129
|
self,
|
|
132
130
|
fid: int,
|
|
133
131
|
attributes: TracedAttributes,
|
|
134
132
|
) -> None:
|
|
135
|
-
self.
|
|
133
|
+
self.curr_step_function_id = fid
|
|
136
134
|
self._start_span(attributes)
|
|
137
135
|
|
|
138
|
-
def
|
|
139
|
-
self.
|
|
136
|
+
def end_step(self, exc_value: Optional[BaseException]) -> None:
|
|
137
|
+
self.curr_step_function_id = -1
|
|
140
138
|
self._end_span(exc_value)
|
|
141
139
|
|
|
142
140
|
def start_transaction(
|
|
@@ -375,7 +373,7 @@ class EnterDBOSChildWorkflow:
|
|
|
375
373
|
def __enter__(self) -> DBOSContext:
|
|
376
374
|
ctx = assert_current_dbos_context()
|
|
377
375
|
self.parent_ctx = ctx
|
|
378
|
-
assert ctx.is_workflow() # Is in a workflow and not in
|
|
376
|
+
assert ctx.is_workflow() # Is in a workflow and not in a step
|
|
379
377
|
ctx.function_id += 1
|
|
380
378
|
if len(ctx.id_assigned_for_next_workflow) == 0:
|
|
381
379
|
ctx.id_assigned_for_next_workflow = (
|
|
@@ -401,7 +399,7 @@ class EnterDBOSChildWorkflow:
|
|
|
401
399
|
return False # Did not handle
|
|
402
400
|
|
|
403
401
|
|
|
404
|
-
class
|
|
402
|
+
class EnterDBOSStep:
|
|
405
403
|
def __init__(
|
|
406
404
|
self,
|
|
407
405
|
attributes: TracedAttributes,
|
|
@@ -412,7 +410,7 @@ class EnterDBOSCommunicator:
|
|
|
412
410
|
ctx = assert_current_dbos_context()
|
|
413
411
|
assert ctx.is_workflow()
|
|
414
412
|
ctx.function_id += 1
|
|
415
|
-
ctx.
|
|
413
|
+
ctx.start_step(ctx.function_id, attributes=self.attributes)
|
|
416
414
|
return ctx
|
|
417
415
|
|
|
418
416
|
def __exit__(
|
|
@@ -422,8 +420,8 @@ class EnterDBOSCommunicator:
|
|
|
422
420
|
traceback: Optional[TracebackType],
|
|
423
421
|
) -> Literal[False]:
|
|
424
422
|
ctx = assert_current_dbos_context()
|
|
425
|
-
assert ctx.
|
|
426
|
-
ctx.
|
|
423
|
+
assert ctx.is_step()
|
|
424
|
+
ctx.end_step(exc_value)
|
|
427
425
|
return False # Did not handle
|
|
428
426
|
|
|
429
427
|
|
dbos/core.py
CHANGED
|
@@ -19,20 +19,18 @@ from dbos.context import (
|
|
|
19
19
|
DBOSContextEnsure,
|
|
20
20
|
DBOSContextSwap,
|
|
21
21
|
EnterDBOSChildWorkflow,
|
|
22
|
-
|
|
22
|
+
EnterDBOSStep,
|
|
23
23
|
EnterDBOSTransaction,
|
|
24
24
|
EnterDBOSWorkflow,
|
|
25
25
|
OperationType,
|
|
26
26
|
SetWorkflowID,
|
|
27
27
|
TracedAttributes,
|
|
28
28
|
assert_current_dbos_context,
|
|
29
|
-
clear_local_dbos_context,
|
|
30
29
|
get_local_dbos_context,
|
|
31
|
-
set_local_dbos_context,
|
|
32
30
|
)
|
|
33
31
|
from dbos.error import (
|
|
34
|
-
DBOSCommunicatorMaxRetriesExceededError,
|
|
35
32
|
DBOSException,
|
|
33
|
+
DBOSMaxStepRetriesExceeded,
|
|
36
34
|
DBOSNonExistentWorkflowError,
|
|
37
35
|
DBOSRecoveryError,
|
|
38
36
|
DBOSWorkflowConflictIDError,
|
|
@@ -61,7 +59,6 @@ if TYPE_CHECKING:
|
|
|
61
59
|
from dbos.dbos import IsolationLevel
|
|
62
60
|
|
|
63
61
|
from sqlalchemy.exc import DBAPIError
|
|
64
|
-
from sqlalchemy.orm import Session
|
|
65
62
|
|
|
66
63
|
P = ParamSpec("P") # A generic type for workflow parameters
|
|
67
64
|
R = TypeVar("R", covariant=True) # A generic type for workflow return values
|
|
@@ -362,7 +359,7 @@ def _start_workflow(
|
|
|
362
359
|
|
|
363
360
|
# Sequence of events for starting a workflow:
|
|
364
361
|
# First - is there a WF already running?
|
|
365
|
-
# (and not in
|
|
362
|
+
# (and not in step as that is an error)
|
|
366
363
|
# Assign an ID to the workflow, if it doesn't have an app-assigned one
|
|
367
364
|
# If this is a root workflow, assign a new ID
|
|
368
365
|
# If this is a child workflow, assign parent wf id with call# suffix
|
|
@@ -370,7 +367,7 @@ def _start_workflow(
|
|
|
370
367
|
# Pass the new context to a worker thread that will run the wf function
|
|
371
368
|
cur_ctx = get_local_dbos_context()
|
|
372
369
|
if cur_ctx is not None and cur_ctx.is_within_workflow():
|
|
373
|
-
assert cur_ctx.is_workflow() # Not in
|
|
370
|
+
assert cur_ctx.is_workflow() # Not in a step
|
|
374
371
|
cur_ctx.function_id += 1
|
|
375
372
|
if len(cur_ctx.id_assigned_for_next_workflow) == 0:
|
|
376
373
|
cur_ctx.id_assigned_for_next_workflow = (
|
|
@@ -517,7 +514,7 @@ def _transaction(
|
|
|
517
514
|
def wrapper(*args: Any, **kwargs: Any) -> Any:
|
|
518
515
|
rr: Optional[str] = check_required_roles(func, fi)
|
|
519
516
|
# Entering transaction is allowed:
|
|
520
|
-
# In a workflow (that is not in a
|
|
517
|
+
# In a workflow (that is not in a step already)
|
|
521
518
|
# Not in a workflow (we will start the single op workflow)
|
|
522
519
|
ctx = get_local_dbos_context()
|
|
523
520
|
if ctx and ctx.is_within_workflow():
|
|
@@ -544,7 +541,7 @@ def _transaction(
|
|
|
544
541
|
return decorator
|
|
545
542
|
|
|
546
543
|
|
|
547
|
-
def
|
|
544
|
+
def _step(
|
|
548
545
|
dbosreg: "_DBOSRegistry",
|
|
549
546
|
*,
|
|
550
547
|
retries_allowed: bool = False,
|
|
@@ -554,7 +551,7 @@ def _communicator(
|
|
|
554
551
|
) -> Callable[[F], F]:
|
|
555
552
|
def decorator(func: F) -> F:
|
|
556
553
|
|
|
557
|
-
def
|
|
554
|
+
def invoke_step(*args: Any, **kwargs: Any) -> Any:
|
|
558
555
|
if dbosreg.dbos is None:
|
|
559
556
|
raise DBOSException(
|
|
560
557
|
f"Function {func.__name__} invoked before DBOS initialized"
|
|
@@ -563,10 +560,10 @@ def _communicator(
|
|
|
563
560
|
|
|
564
561
|
attributes: TracedAttributes = {
|
|
565
562
|
"name": func.__name__,
|
|
566
|
-
"operationType": OperationType.
|
|
563
|
+
"operationType": OperationType.STEP.value,
|
|
567
564
|
}
|
|
568
|
-
with
|
|
569
|
-
|
|
565
|
+
with EnterDBOSStep(attributes) as ctx:
|
|
566
|
+
step_output: OperationResultInternal = {
|
|
570
567
|
"workflow_uuid": ctx.workflow_id,
|
|
571
568
|
"function_id": ctx.function_id,
|
|
572
569
|
"output": None,
|
|
@@ -591,24 +588,24 @@ def _communicator(
|
|
|
591
588
|
for attempt in range(1, local_max_attempts + 1):
|
|
592
589
|
try:
|
|
593
590
|
output = func(*args, **kwargs)
|
|
594
|
-
|
|
591
|
+
step_output["output"] = utils.serialize(output)
|
|
595
592
|
error = None
|
|
596
593
|
break
|
|
597
594
|
except Exception as err:
|
|
598
595
|
error = err
|
|
599
596
|
if retries_allowed:
|
|
600
597
|
dbos.logger.warning(
|
|
601
|
-
f"
|
|
598
|
+
f"Step being automatically retried. (attempt {attempt} of {local_max_attempts}). {traceback.format_exc()}"
|
|
602
599
|
)
|
|
603
600
|
ctx.get_current_span().add_event(
|
|
604
|
-
f"
|
|
601
|
+
f"Step attempt {attempt} failed",
|
|
605
602
|
{
|
|
606
603
|
"error": str(error),
|
|
607
604
|
"retryIntervalSeconds": local_interval_seconds,
|
|
608
605
|
},
|
|
609
606
|
)
|
|
610
607
|
if attempt == local_max_attempts:
|
|
611
|
-
error =
|
|
608
|
+
error = DBOSMaxStepRetriesExceeded()
|
|
612
609
|
else:
|
|
613
610
|
time.sleep(local_interval_seconds)
|
|
614
611
|
local_interval_seconds = min(
|
|
@@ -616,10 +613,10 @@ def _communicator(
|
|
|
616
613
|
max_retry_interval_seconds,
|
|
617
614
|
)
|
|
618
615
|
|
|
619
|
-
|
|
616
|
+
step_output["error"] = (
|
|
620
617
|
utils.serialize(error) if error is not None else None
|
|
621
618
|
)
|
|
622
|
-
dbos.sys_db.record_operation_result(
|
|
619
|
+
dbos.sys_db.record_operation_result(step_output)
|
|
623
620
|
if error is not None:
|
|
624
621
|
raise error
|
|
625
622
|
return output
|
|
@@ -629,20 +626,18 @@ def _communicator(
|
|
|
629
626
|
@wraps(func)
|
|
630
627
|
def wrapper(*args: Any, **kwargs: Any) -> Any:
|
|
631
628
|
rr: Optional[str] = check_required_roles(func, fi)
|
|
632
|
-
# Entering
|
|
633
|
-
# In a
|
|
634
|
-
# In a workflow (that is not in a
|
|
629
|
+
# Entering step is allowed:
|
|
630
|
+
# In a step already, just call the original function directly.
|
|
631
|
+
# In a workflow (that is not in a step already)
|
|
635
632
|
# Not in a workflow (we will start the single op workflow)
|
|
636
633
|
ctx = get_local_dbos_context()
|
|
637
|
-
if ctx and ctx.
|
|
634
|
+
if ctx and ctx.is_step():
|
|
638
635
|
# Call the original function directly
|
|
639
636
|
return func(*args, **kwargs)
|
|
640
637
|
if ctx and ctx.is_within_workflow():
|
|
641
|
-
assert (
|
|
642
|
-
ctx.is_workflow()
|
|
643
|
-
), "Communicators must be called from within workflows"
|
|
638
|
+
assert ctx.is_workflow(), "Steps must be called from within workflows"
|
|
644
639
|
with DBOSAssumeRole(rr):
|
|
645
|
-
return
|
|
640
|
+
return invoke_step(*args, **kwargs)
|
|
646
641
|
else:
|
|
647
642
|
tempwf = dbosreg.workflow_info_map.get("<temp>." + func.__qualname__)
|
|
648
643
|
assert tempwf
|
|
@@ -653,7 +648,7 @@ def _communicator(
|
|
|
653
648
|
|
|
654
649
|
wrapped_wf = _workflow_wrapper(dbosreg, temp_wf)
|
|
655
650
|
set_dbos_func_name(temp_wf, "<temp>." + func.__qualname__)
|
|
656
|
-
set_temp_workflow_type(temp_wf, "
|
|
651
|
+
set_temp_workflow_type(temp_wf, "step")
|
|
657
652
|
dbosreg.register_wf_function(get_dbos_func_name(temp_wf), wrapped_wf)
|
|
658
653
|
|
|
659
654
|
return cast(F, wrapper)
|
|
@@ -668,10 +663,10 @@ def _send(
|
|
|
668
663
|
attributes: TracedAttributes = {
|
|
669
664
|
"name": "send",
|
|
670
665
|
}
|
|
671
|
-
with
|
|
666
|
+
with EnterDBOSStep(attributes) as ctx:
|
|
672
667
|
dbos.sys_db.send(
|
|
673
668
|
ctx.workflow_id,
|
|
674
|
-
ctx.
|
|
669
|
+
ctx.curr_step_function_id,
|
|
675
670
|
destination_id,
|
|
676
671
|
message,
|
|
677
672
|
topic,
|
|
@@ -697,12 +692,12 @@ def _recv(
|
|
|
697
692
|
attributes: TracedAttributes = {
|
|
698
693
|
"name": "recv",
|
|
699
694
|
}
|
|
700
|
-
with
|
|
695
|
+
with EnterDBOSStep(attributes) as ctx:
|
|
701
696
|
ctx.function_id += 1 # Reserve for the sleep
|
|
702
697
|
timeout_function_id = ctx.function_id
|
|
703
698
|
return dbos.sys_db.recv(
|
|
704
699
|
ctx.workflow_id,
|
|
705
|
-
ctx.
|
|
700
|
+
ctx.curr_step_function_id,
|
|
706
701
|
timeout_function_id,
|
|
707
702
|
topic,
|
|
708
703
|
timeout_seconds,
|
|
@@ -722,9 +717,9 @@ def _set_event(dbos: "DBOS", key: str, value: Any) -> None:
|
|
|
722
717
|
attributes: TracedAttributes = {
|
|
723
718
|
"name": "set_event",
|
|
724
719
|
}
|
|
725
|
-
with
|
|
720
|
+
with EnterDBOSStep(attributes) as ctx:
|
|
726
721
|
dbos.sys_db.set_event(
|
|
727
|
-
ctx.workflow_id, ctx.
|
|
722
|
+
ctx.workflow_id, ctx.curr_step_function_id, key, value
|
|
728
723
|
)
|
|
729
724
|
else:
|
|
730
725
|
# Cannot call it from outside of a workflow
|
|
@@ -743,12 +738,12 @@ def _get_event(
|
|
|
743
738
|
attributes: TracedAttributes = {
|
|
744
739
|
"name": "get_event",
|
|
745
740
|
}
|
|
746
|
-
with
|
|
741
|
+
with EnterDBOSStep(attributes) as ctx:
|
|
747
742
|
ctx.function_id += 1
|
|
748
743
|
timeout_function_id = ctx.function_id
|
|
749
744
|
caller_ctx: GetEventWorkflowContext = {
|
|
750
745
|
"workflow_uuid": ctx.workflow_id,
|
|
751
|
-
"function_id": ctx.
|
|
746
|
+
"function_id": ctx.curr_step_function_id,
|
|
752
747
|
"timeout_function_id": timeout_function_id,
|
|
753
748
|
}
|
|
754
749
|
return dbos.sys_db.get_event(workflow_id, key, timeout_seconds, caller_ctx)
|
dbos/dbos.py
CHANGED
|
@@ -25,13 +25,13 @@ from opentelemetry.trace import Span
|
|
|
25
25
|
|
|
26
26
|
from dbos.core import (
|
|
27
27
|
TEMP_SEND_WF_NAME,
|
|
28
|
-
_communicator,
|
|
29
28
|
_execute_workflow_id,
|
|
30
29
|
_get_event,
|
|
31
30
|
_recv,
|
|
32
31
|
_send,
|
|
33
32
|
_set_event,
|
|
34
33
|
_start_workflow,
|
|
34
|
+
_step,
|
|
35
35
|
_transaction,
|
|
36
36
|
_workflow,
|
|
37
37
|
_workflow_wrapper,
|
|
@@ -63,7 +63,7 @@ else:
|
|
|
63
63
|
|
|
64
64
|
from dbos.admin_sever import AdminServer
|
|
65
65
|
from dbos.context import (
|
|
66
|
-
|
|
66
|
+
EnterDBOSStep,
|
|
67
67
|
TracedAttributes,
|
|
68
68
|
assert_current_dbos_context,
|
|
69
69
|
get_local_dbos_context,
|
|
@@ -179,7 +179,7 @@ class DBOS:
|
|
|
179
179
|
Main access class for DBOS functionality.
|
|
180
180
|
|
|
181
181
|
`DBOS` contains functions and properties for:
|
|
182
|
-
1. Decorating classes, workflows,
|
|
182
|
+
1. Decorating classes, workflows, and steps
|
|
183
183
|
2. Starting workflow functions
|
|
184
184
|
3. Retrieving workflow status information
|
|
185
185
|
4. Interacting with workflows via events and messages
|
|
@@ -388,9 +388,8 @@ class DBOS:
|
|
|
388
388
|
"""
|
|
389
389
|
return _transaction(_get_or_create_dbos_registry(), isolation_level)
|
|
390
390
|
|
|
391
|
-
# Mirror the CommunicatorConfig from TS. However, we disable retries by default.
|
|
392
391
|
@classmethod
|
|
393
|
-
def
|
|
392
|
+
def step(
|
|
394
393
|
cls,
|
|
395
394
|
*,
|
|
396
395
|
retries_allowed: bool = False,
|
|
@@ -399,17 +398,17 @@ class DBOS:
|
|
|
399
398
|
backoff_rate: float = 2.0,
|
|
400
399
|
) -> Callable[[F], F]:
|
|
401
400
|
"""
|
|
402
|
-
Decorate and configure a function for use as a DBOS
|
|
401
|
+
Decorate and configure a function for use as a DBOS step.
|
|
403
402
|
|
|
404
403
|
Args:
|
|
405
404
|
retries_allowed(bool): If true, enable retries on thrown exceptions
|
|
406
405
|
interval_seconds(float): Time between retry attempts
|
|
407
406
|
backoff_rate(float): Multiplier for exponentially increasing `interval_seconds` between retries
|
|
408
|
-
max_attempts(int): Maximum number of
|
|
407
|
+
max_attempts(int): Maximum number of retries before raising an exception
|
|
409
408
|
|
|
410
409
|
"""
|
|
411
410
|
|
|
412
|
-
return
|
|
411
|
+
return _step(
|
|
413
412
|
_get_or_create_dbos_registry(),
|
|
414
413
|
retries_allowed=retries_allowed,
|
|
415
414
|
interval_seconds=interval_seconds,
|
|
@@ -542,9 +541,9 @@ class DBOS:
|
|
|
542
541
|
}
|
|
543
542
|
if seconds <= 0:
|
|
544
543
|
return
|
|
545
|
-
with
|
|
544
|
+
with EnterDBOSStep(attributes) as ctx:
|
|
546
545
|
_get_dbos_instance().sys_db.sleep(
|
|
547
|
-
ctx.workflow_id, ctx.
|
|
546
|
+
ctx.workflow_id, ctx.curr_step_function_id, seconds
|
|
548
547
|
)
|
|
549
548
|
|
|
550
549
|
@classmethod
|
|
@@ -615,9 +614,7 @@ class DBOS:
|
|
|
615
614
|
def sql_session(cls) -> Session:
|
|
616
615
|
"""Return the SQLAlchemy `Session` for the current context, which must be within a transaction function."""
|
|
617
616
|
ctx = assert_current_dbos_context()
|
|
618
|
-
assert (
|
|
619
|
-
ctx.is_transaction()
|
|
620
|
-
), "sql_session is only available within a transaction."
|
|
617
|
+
assert ctx.is_transaction(), "db is only available within a transaction."
|
|
621
618
|
rv = ctx.sql_session
|
|
622
619
|
assert rv
|
|
623
620
|
return rv
|
|
@@ -628,7 +625,7 @@ class DBOS:
|
|
|
628
625
|
ctx = assert_current_dbos_context()
|
|
629
626
|
assert (
|
|
630
627
|
ctx.is_within_workflow()
|
|
631
|
-
), "workflow_id is only available within a
|
|
628
|
+
), "workflow_id is only available within a DBOS operation."
|
|
632
629
|
return ctx.workflow_id
|
|
633
630
|
|
|
634
631
|
@classproperty
|
|
@@ -722,9 +719,9 @@ class DBOSConfiguredInstance:
|
|
|
722
719
|
"""
|
|
723
720
|
Base class for classes containing DBOS member functions.
|
|
724
721
|
|
|
725
|
-
When a class contains
|
|
726
|
-
|
|
727
|
-
|
|
722
|
+
When a class contains DBOS functions that access instance state, the DBOS workflow
|
|
723
|
+
executor needs a name for the instance. This name is recorded in the database, and
|
|
724
|
+
used to refer to the proper instance upon recovery.
|
|
728
725
|
|
|
729
726
|
Use `DBOSConfiguredInstance` to specify the instance name and register the instance
|
|
730
727
|
with the DBOS workflow executor.
|
dbos/error.py
CHANGED
|
@@ -32,7 +32,7 @@ class DBOSErrorCode(Enum):
|
|
|
32
32
|
WorkflowFunctionNotFound = 4
|
|
33
33
|
NonExistentWorkflowError = 5
|
|
34
34
|
DuplicateWorkflowEventError = 6
|
|
35
|
-
|
|
35
|
+
MaxStepRetriesExceeded = 7
|
|
36
36
|
NotAuthorized = 8
|
|
37
37
|
|
|
38
38
|
|
|
@@ -106,11 +106,11 @@ class DBOSNotAuthorizedError(DBOSException):
|
|
|
106
106
|
)
|
|
107
107
|
|
|
108
108
|
|
|
109
|
-
class
|
|
110
|
-
"""Exception raised when a
|
|
109
|
+
class DBOSMaxStepRetriesExceeded(DBOSException):
|
|
110
|
+
"""Exception raised when a step was retried the maximimum number of times without success."""
|
|
111
111
|
|
|
112
112
|
def __init__(self) -> None:
|
|
113
113
|
super().__init__(
|
|
114
|
-
"
|
|
115
|
-
dbos_error_code=DBOSErrorCode.
|
|
114
|
+
"Step reached maximum retries.",
|
|
115
|
+
dbos_error_code=DBOSErrorCode.MaxStepRetriesExceeded.value,
|
|
116
116
|
)
|
dbos/registrations.py
CHANGED
|
@@ -16,7 +16,7 @@ def set_dbos_func_name(f: Any, name: str) -> None:
|
|
|
16
16
|
setattr(f, "dbos_function_name", name)
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
TempWorkflowType = Literal["transaction", "
|
|
19
|
+
TempWorkflowType = Literal["transaction", "step", "send", None]
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
def get_temp_workflow_type(f: Any) -> TempWorkflowType:
|
dbos/system_database.py
CHANGED
|
@@ -4,17 +4,7 @@ import select
|
|
|
4
4
|
import threading
|
|
5
5
|
import time
|
|
6
6
|
from enum import Enum
|
|
7
|
-
from typing import
|
|
8
|
-
TYPE_CHECKING,
|
|
9
|
-
Any,
|
|
10
|
-
Dict,
|
|
11
|
-
List,
|
|
12
|
-
Literal,
|
|
13
|
-
Optional,
|
|
14
|
-
Sequence,
|
|
15
|
-
TypedDict,
|
|
16
|
-
cast,
|
|
17
|
-
)
|
|
7
|
+
from typing import Any, Dict, List, Literal, Optional, Sequence, TypedDict, cast
|
|
18
8
|
|
|
19
9
|
import psycopg2
|
|
20
10
|
import sqlalchemy as sa
|
|
@@ -33,9 +23,6 @@ from .dbos_config import ConfigFile
|
|
|
33
23
|
from .logger import dbos_logger
|
|
34
24
|
from .schemas.system_database import SystemSchema
|
|
35
25
|
|
|
36
|
-
if TYPE_CHECKING:
|
|
37
|
-
from dbos.dbos import DBOS
|
|
38
|
-
|
|
39
26
|
|
|
40
27
|
class WorkflowStatusString(Enum):
|
|
41
28
|
"""Enumeration of values allowed for `WorkflowSatusInternal.status`."""
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
dbos-0.5.
|
|
2
|
-
dbos-0.5.
|
|
3
|
-
dbos-0.5.
|
|
4
|
-
dbos-0.5.
|
|
1
|
+
dbos-0.5.0a4.dist-info/METADATA,sha256=l_v0uEPtP7uqtxzLfs6FCFNe3jLyhnG1of_HACqUUyo,5420
|
|
2
|
+
dbos-0.5.0a4.dist-info/WHEEL,sha256=rSwsxJWe3vzyR5HCwjWXQruDgschpei4h_giTm0dJVE,90
|
|
3
|
+
dbos-0.5.0a4.dist-info/entry_points.txt,sha256=3PmOPbM4FYxEmggRRdJw0oAsiBzKR8U0yx7bmwUmMOM,39
|
|
4
|
+
dbos-0.5.0a4.dist-info/licenses/LICENSE,sha256=VGZit_a5-kdw9WT6fY5jxAWVwGQzgLFyPWrcVVUhVNU,1067
|
|
5
5
|
dbos/__init__.py,sha256=X1LdP36NomDtvPfFwoMNtgXf81TO05jj7vltsp79UUw,787
|
|
6
6
|
dbos/admin_sever.py,sha256=KtzH6aKyskCm4h3yulpy9jb5PIqRlYI2sjctw5mvaKY,3395
|
|
7
7
|
dbos/application_database.py,sha256=cBSfyB-5KGFBtigLpFPWEAgmrKONAUnG1825vXPifBk,5411
|
|
8
8
|
dbos/cli.py,sha256=QnbGtZ8S963q3iyFvXNBcL4DB35r4SFMarlb5DRqN6M,7915
|
|
9
|
-
dbos/context.py,sha256=
|
|
10
|
-
dbos/core.py,sha256=
|
|
9
|
+
dbos/context.py,sha256=JZMV2RtSpTK7lnyyWxeBmGPwrZSB00XZEP6R6MT9ygQ,15690
|
|
10
|
+
dbos/core.py,sha256=8KkmHYQtxbtfFI_2sAf4DYmiznwYxLLhE6z-FLc3Gho,28675
|
|
11
11
|
dbos/dbos-config.schema.json,sha256=azpfmoDZg7WfSy3kvIsk9iEiKB_-VZt03VEOoXJAkqE,5331
|
|
12
|
-
dbos/dbos.py,sha256=
|
|
12
|
+
dbos/dbos.py,sha256=HngS2BUWSbWPmloXGr-KE81BQ8dpZtlvOXM4tx4_Qhg,26246
|
|
13
13
|
dbos/dbos_config.py,sha256=EkO0c0xaIM7_vAAqqnvNNEAKG5fOJbmmalqnZvaKYZA,5312
|
|
14
14
|
dbos/decorators.py,sha256=lbPefsLK6Cya4cb7TrOcLglOpGT3pc6qjZdsQKlfZLg,629
|
|
15
|
-
dbos/error.py,sha256=
|
|
15
|
+
dbos/error.py,sha256=nBdLC4hxGO_K9V26YbDGOo7xi1CKuN4PsE_cBv7K8Cc,3798
|
|
16
16
|
dbos/fastapi.py,sha256=ZFcMizyv3pizo5zf0sSF6U4GoR3rQH8LxGipkQIGHfU,2282
|
|
17
17
|
dbos/logger.py,sha256=cfybbu6F1zsgYLEPW8D8V6h033u-YedLXnGMnQQM6-4,3341
|
|
18
18
|
dbos/migrations/env.py,sha256=38SIGVbmn_VV2x2u1aHLcPOoWgZ84eCymf3g_NljmbU,1626
|
|
@@ -21,14 +21,14 @@ dbos/migrations/versions/5c361fc04708_added_system_tables.py,sha256=QMgFMb0aLgC2
|
|
|
21
21
|
dbos/migrations/versions/a3b18ad34abe_added_triggers.py,sha256=Rv0ZsZYZ_WdgGEULYsPfnp4YzaO5L198gDTgYY39AVA,2022
|
|
22
22
|
dbos/py.typed,sha256=QfzXT1Ktfk3Rj84akygc7_42z0lRpCq0Ilh8OXI6Zas,44
|
|
23
23
|
dbos/recovery.py,sha256=xfwQFWNuD8DXg5HD5_-3tG7Neo9j-x1lrqiwtn5FSh8,2015
|
|
24
|
-
dbos/registrations.py,sha256=
|
|
24
|
+
dbos/registrations.py,sha256=gMI-u05tv5bpvyddQGtoUgCsqARx51aOY7p0JXPafQo,6539
|
|
25
25
|
dbos/roles.py,sha256=9u0z4CWmXPeqIKzQWEzaOKIlzOuaagBtMiB-swqjX_U,2291
|
|
26
26
|
dbos/scheduler/croniter.py,sha256=hbhgfsHBqclUS8VeLnJ9PSE9Z54z6mi4nnrr1aUXn0k,47561
|
|
27
27
|
dbos/scheduler/scheduler.py,sha256=uO4_9jmWW2rLv1ODL3lc1cE_37ZaVTgnvmFx_FAlN50,1472
|
|
28
28
|
dbos/schemas/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
29
29
|
dbos/schemas/application_database.py,sha256=q_Wr2XbiZNBYFkOtu7uKavo1T_cSOBblxKGHThYGGsY,962
|
|
30
30
|
dbos/schemas/system_database.py,sha256=5V3vqnEzry0Hn7ZbVS9Gs_dJKia8uX8p7mGC82Ru8rk,4303
|
|
31
|
-
dbos/system_database.py,sha256=
|
|
31
|
+
dbos/system_database.py,sha256=h04PngaTdHxr1zfXcH6rSdac_vX0mSsD4SWHyOEWpJQ,38147
|
|
32
32
|
dbos/templates/hello/README.md,sha256=GhxhBj42wjTt1fWEtwNriHbJuKb66Vzu89G4pxNHw2g,930
|
|
33
33
|
dbos/templates/hello/__package/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
34
34
|
dbos/templates/hello/__package/main.py,sha256=hJgp3S14cseT7zWIZsPwjqdzwTCw1aLo8kPKsTvYz0Y,2976
|
|
@@ -42,4 +42,4 @@ dbos/templates/hello/start_postgres_docker.py,sha256=lQVLlYO5YkhGPEgPqwGc7Y8uDKs
|
|
|
42
42
|
dbos/tracer.py,sha256=RPW9oxmX9tSc0Yq7O-FAhpQWBg1QT7Ni1Q06uwhtNDk,2237
|
|
43
43
|
dbos/utils.py,sha256=hWj9iWDrby2cVEhb0pG-IdnrxLqP64NhkaWUXiLc8bA,402
|
|
44
44
|
version/__init__.py,sha256=L4sNxecRuqdtSFdpUGX3TtBi9KL3k7YsZVIvv-fv9-A,1678
|
|
45
|
-
dbos-0.5.
|
|
45
|
+
dbos-0.5.0a4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|