Skip to content

Commit b6e0ee5

Browse files
committed
🎯 feat: add wrapped method for rerun.
1 parent 71dd98a commit b6e0ee5

5 files changed

Lines changed: 169 additions & 164 deletions

File tree

src/ddeutil/workflow/errors.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,4 +208,7 @@ class WorkflowCancelError(WorkflowError): ...
208208
class WorkflowTimeoutError(WorkflowError): ...
209209

210210

211+
class WorkflowSkipError(WorkflowError): ...
212+
213+
211214
class ParamError(WorkflowError): ...

src/ddeutil/workflow/result.py

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,17 @@
2222

2323
from .__types import DictData
2424
from .errors import (
25+
BaseError,
2526
ErrorData,
2627
JobCancelError,
27-
JobError,
2828
JobSkipError,
2929
ResultError,
3030
StageCancelError,
31-
StageError,
3231
StageNestedCancelError,
33-
StageNestedError,
3432
StageNestedSkipError,
3533
StageSkipError,
3634
WorkflowCancelError,
37-
WorkflowError,
35+
WorkflowSkipError,
3836
)
3937
from .traces import Trace, get_trace
4038
from .utils import default_gen_id
@@ -111,11 +109,11 @@ def validate_statuses(statuses: list[Status]) -> Status:
111109
Status: Final consolidated status based on workflow logic
112110
113111
Example:
114-
>>> # Mixed statuses - FAILED takes priority
112+
Case: Mixed statuses - FAILED takes priority
115113
>>> validate_statuses([SUCCESS, FAILED, SUCCESS])
116114
>>> # Returns: FAILED
117115
118-
>>> # All same status
116+
Case: All same status
119117
>>> validate_statuses([SUCCESS, SUCCESS, SUCCESS])
120118
>>> # Returns: SUCCESS
121119
"""
@@ -132,21 +130,7 @@ def validate_statuses(statuses: list[Status]) -> Status:
132130

133131

134132
def get_status_from_error(
135-
error: Union[
136-
StageError,
137-
StageCancelError,
138-
StageSkipError,
139-
StageNestedCancelError,
140-
StageNestedError,
141-
StageNestedSkipError,
142-
JobError,
143-
JobCancelError,
144-
JobSkipError,
145-
WorkflowError,
146-
WorkflowCancelError,
147-
Exception,
148-
BaseException,
149-
]
133+
error: Union[BaseError, Exception, BaseException]
150134
) -> Status:
151135
"""Get the Status from the error object.
152136
@@ -156,7 +140,10 @@ def get_status_from_error(
156140
Returns:
157141
Status: The status from the specific exception class.
158142
"""
159-
if isinstance(error, (StageNestedSkipError, StageSkipError, JobSkipError)):
143+
if isinstance(
144+
error,
145+
(StageNestedSkipError, StageSkipError, JobSkipError, WorkflowSkipError),
146+
):
160147
return SKIP
161148
elif isinstance(
162149
error,

0 commit comments

Comments
 (0)