ddeutil-workflow 0.0.78__py3-none-any.whl → 0.0.80__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.
- ddeutil/workflow/__about__.py +1 -1
- ddeutil/workflow/__init__.py +2 -6
- ddeutil/workflow/api/routes/job.py +2 -2
- ddeutil/workflow/api/routes/logs.py +5 -5
- ddeutil/workflow/api/routes/workflows.py +3 -3
- ddeutil/workflow/audits.py +547 -176
- ddeutil/workflow/cli.py +19 -1
- ddeutil/workflow/conf.py +10 -20
- ddeutil/workflow/event.py +15 -6
- ddeutil/workflow/job.py +147 -74
- ddeutil/workflow/params.py +172 -58
- ddeutil/workflow/plugins/__init__.py +0 -0
- ddeutil/workflow/plugins/providers/__init__.py +0 -0
- ddeutil/workflow/plugins/providers/aws.py +908 -0
- ddeutil/workflow/plugins/providers/az.py +1003 -0
- ddeutil/workflow/plugins/providers/container.py +703 -0
- ddeutil/workflow/plugins/providers/gcs.py +826 -0
- ddeutil/workflow/result.py +6 -4
- ddeutil/workflow/reusables.py +151 -95
- ddeutil/workflow/stages.py +28 -28
- ddeutil/workflow/traces.py +1697 -541
- ddeutil/workflow/utils.py +109 -67
- ddeutil/workflow/workflow.py +42 -30
- {ddeutil_workflow-0.0.78.dist-info → ddeutil_workflow-0.0.80.dist-info}/METADATA +39 -19
- ddeutil_workflow-0.0.80.dist-info/RECORD +36 -0
- ddeutil_workflow-0.0.78.dist-info/RECORD +0 -30
- {ddeutil_workflow-0.0.78.dist-info → ddeutil_workflow-0.0.80.dist-info}/WHEEL +0 -0
- {ddeutil_workflow-0.0.78.dist-info → ddeutil_workflow-0.0.80.dist-info}/entry_points.txt +0 -0
- {ddeutil_workflow-0.0.78.dist-info → ddeutil_workflow-0.0.80.dist-info}/licenses/LICENSE +0 -0
- {ddeutil_workflow-0.0.78.dist-info → ddeutil_workflow-0.0.80.dist-info}/top_level.txt +0 -0
ddeutil/workflow/stages.py
CHANGED
@@ -114,7 +114,7 @@ from .reusables import (
|
|
114
114
|
not_in_template,
|
115
115
|
param2template,
|
116
116
|
)
|
117
|
-
from .traces import
|
117
|
+
from .traces import TraceManager, get_trace
|
118
118
|
from .utils import (
|
119
119
|
delay,
|
120
120
|
dump_all,
|
@@ -304,7 +304,7 @@ class BaseStage(BaseModel, ABC):
|
|
304
304
|
parent_run_id: str = run_id
|
305
305
|
run_id: str = run_id or gen_id(self.iden, unique=True)
|
306
306
|
context: DictData = {"status": WAIT}
|
307
|
-
trace:
|
307
|
+
trace: TraceManager = get_trace(
|
308
308
|
run_id, parent_run_id=parent_run_id, extras=self.extras
|
309
309
|
)
|
310
310
|
try:
|
@@ -634,7 +634,7 @@ class BaseAsyncStage(BaseStage, ABC):
|
|
634
634
|
parent_run_id: StrOrNone = run_id
|
635
635
|
run_id: str = run_id or gen_id(self.iden, unique=True)
|
636
636
|
context: DictData = {}
|
637
|
-
trace:
|
637
|
+
trace: TraceManager = get_trace(
|
638
638
|
run_id, parent_run_id=parent_run_id, extras=self.extras
|
639
639
|
)
|
640
640
|
try:
|
@@ -777,7 +777,7 @@ class BaseRetryStage(BaseAsyncStage, ABC): # pragma: no cov
|
|
777
777
|
current_retry: int = 0
|
778
778
|
exception: Exception
|
779
779
|
catch(context, status=WAIT)
|
780
|
-
trace:
|
780
|
+
trace: TraceManager = get_trace(
|
781
781
|
run_id, parent_run_id=parent_run_id, extras=self.extras
|
782
782
|
)
|
783
783
|
|
@@ -850,7 +850,7 @@ class BaseRetryStage(BaseAsyncStage, ABC): # pragma: no cov
|
|
850
850
|
current_retry: int = 0
|
851
851
|
exception: Exception
|
852
852
|
catch(context, status=WAIT)
|
853
|
-
trace:
|
853
|
+
trace: TraceManager = get_trace(
|
854
854
|
run_id, parent_run_id=parent_run_id, extras=self.extras
|
855
855
|
)
|
856
856
|
|
@@ -982,7 +982,7 @@ class EmptyStage(BaseAsyncStage):
|
|
982
982
|
Returns:
|
983
983
|
Result: The execution result with status and context data.
|
984
984
|
"""
|
985
|
-
trace:
|
985
|
+
trace: TraceManager = get_trace(
|
986
986
|
run_id, parent_run_id=parent_run_id, extras=self.extras
|
987
987
|
)
|
988
988
|
message: str = (
|
@@ -1035,7 +1035,7 @@ class EmptyStage(BaseAsyncStage):
|
|
1035
1035
|
Returns:
|
1036
1036
|
Result: The execution result with status and context data.
|
1037
1037
|
"""
|
1038
|
-
trace:
|
1038
|
+
trace: TraceManager = get_trace(
|
1039
1039
|
run_id, parent_run_id=parent_run_id, extras=self.extras
|
1040
1040
|
)
|
1041
1041
|
message: str = (
|
@@ -1200,7 +1200,7 @@ class BashStage(BaseRetryStage):
|
|
1200
1200
|
Returns:
|
1201
1201
|
Result: The execution result with status and context data.
|
1202
1202
|
"""
|
1203
|
-
trace:
|
1203
|
+
trace: TraceManager = get_trace(
|
1204
1204
|
run_id, parent_run_id=parent_run_id, extras=self.extras
|
1205
1205
|
)
|
1206
1206
|
bash: str = param2template(
|
@@ -1264,7 +1264,7 @@ class BashStage(BaseRetryStage):
|
|
1264
1264
|
Returns:
|
1265
1265
|
Result: The execution result with status and context data.
|
1266
1266
|
"""
|
1267
|
-
trace:
|
1267
|
+
trace: TraceManager = get_trace(
|
1268
1268
|
run_id, parent_run_id=parent_run_id, extras=self.extras
|
1269
1269
|
)
|
1270
1270
|
bash: str = param2template(
|
@@ -1405,7 +1405,7 @@ class PyStage(BaseRetryStage):
|
|
1405
1405
|
Returns:
|
1406
1406
|
Result: The execution result with status and context data.
|
1407
1407
|
"""
|
1408
|
-
trace:
|
1408
|
+
trace: TraceManager = get_trace(
|
1409
1409
|
run_id, parent_run_id=parent_run_id, extras=self.extras
|
1410
1410
|
)
|
1411
1411
|
trace.info("[STAGE]: Prepare `globals` and `locals` variables.")
|
@@ -1486,7 +1486,7 @@ class PyStage(BaseRetryStage):
|
|
1486
1486
|
Returns:
|
1487
1487
|
Result: The execution result with status and context data.
|
1488
1488
|
"""
|
1489
|
-
trace:
|
1489
|
+
trace: TraceManager = get_trace(
|
1490
1490
|
run_id, parent_run_id=parent_run_id, extras=self.extras
|
1491
1491
|
)
|
1492
1492
|
await trace.ainfo("[STAGE]: Prepare `globals` and `locals` variables.")
|
@@ -1631,7 +1631,7 @@ class CallStage(BaseRetryStage):
|
|
1631
1631
|
Returns:
|
1632
1632
|
Result: The execution result with status and context data.
|
1633
1633
|
"""
|
1634
|
-
trace:
|
1634
|
+
trace: TraceManager = get_trace(
|
1635
1635
|
run_id, parent_run_id=parent_run_id, extras=self.extras
|
1636
1636
|
)
|
1637
1637
|
call_func: TagFunc = self.get_caller(params=params)()
|
@@ -1750,7 +1750,7 @@ class CallStage(BaseRetryStage):
|
|
1750
1750
|
Returns:
|
1751
1751
|
Result: The execution result with status and context data.
|
1752
1752
|
"""
|
1753
|
-
trace:
|
1753
|
+
trace: TraceManager = get_trace(
|
1754
1754
|
run_id, parent_run_id=parent_run_id, extras=self.extras
|
1755
1755
|
)
|
1756
1756
|
call_func: TagFunc = self.get_caller(params=params)()
|
@@ -1884,7 +1884,7 @@ class CallStage(BaseRetryStage):
|
|
1884
1884
|
"Validate argument from the caller function raise invalid type."
|
1885
1885
|
) from e
|
1886
1886
|
except TypeError as e:
|
1887
|
-
trace:
|
1887
|
+
trace: TraceManager = get_trace(
|
1888
1888
|
run_id, parent_run_id=parent_run_id, extras=extras
|
1889
1889
|
)
|
1890
1890
|
trace.warning(
|
@@ -2009,7 +2009,7 @@ class TriggerStage(BaseNestedStage):
|
|
2009
2009
|
"""
|
2010
2010
|
from .workflow import Workflow
|
2011
2011
|
|
2012
|
-
trace:
|
2012
|
+
trace: TraceManager = get_trace(
|
2013
2013
|
run_id, parent_run_id=parent_run_id, extras=self.extras
|
2014
2014
|
)
|
2015
2015
|
_trigger: str = param2template(self.trigger, params, extras=self.extras)
|
@@ -2114,7 +2114,7 @@ class ParallelStage(BaseNestedStage):
|
|
2114
2114
|
|
2115
2115
|
:rtype: tuple[Status, DictData]
|
2116
2116
|
"""
|
2117
|
-
trace:
|
2117
|
+
trace: TraceManager = get_trace(
|
2118
2118
|
run_id, parent_run_id=parent_run_id, extras=self.extras
|
2119
2119
|
)
|
2120
2120
|
trace.debug(f"[STAGE]: Execute Branch: {branch!r}")
|
@@ -2244,7 +2244,7 @@ class ParallelStage(BaseNestedStage):
|
|
2244
2244
|
Returns:
|
2245
2245
|
Result: The execution result with status and context data.
|
2246
2246
|
"""
|
2247
|
-
trace:
|
2247
|
+
trace: TraceManager = get_trace(
|
2248
2248
|
run_id, parent_run_id=parent_run_id, extras=self.extras
|
2249
2249
|
)
|
2250
2250
|
event: Event = event or Event()
|
@@ -2383,7 +2383,7 @@ class ForEachStage(BaseNestedStage):
|
|
2383
2383
|
|
2384
2384
|
:rtype: tuple[Status, Result]
|
2385
2385
|
"""
|
2386
|
-
trace:
|
2386
|
+
trace: TraceManager = get_trace(
|
2387
2387
|
run_id, parent_run_id=parent_run_id, extras=self.extras
|
2388
2388
|
)
|
2389
2389
|
trace.debug(f"[STAGE]: Execute Item: {item!r}")
|
@@ -2520,7 +2520,7 @@ class ForEachStage(BaseNestedStage):
|
|
2520
2520
|
Returns:
|
2521
2521
|
Result: The execution result with status and context data.
|
2522
2522
|
"""
|
2523
|
-
trace:
|
2523
|
+
trace: TraceManager = get_trace(
|
2524
2524
|
run_id, parent_run_id=parent_run_id, extras=self.extras
|
2525
2525
|
)
|
2526
2526
|
event: Event = event or Event()
|
@@ -2705,7 +2705,7 @@ class UntilStage(BaseNestedStage):
|
|
2705
2705
|
:rtype: tuple[Status, DictData, T]
|
2706
2706
|
:return: Return a pair of Result and changed item.
|
2707
2707
|
"""
|
2708
|
-
trace:
|
2708
|
+
trace: TraceManager = get_trace(
|
2709
2709
|
run_id, parent_run_id=parent_run_id, extras=self.extras
|
2710
2710
|
)
|
2711
2711
|
trace.debug(f"[STAGE]: Execute Loop: {loop} (Item {item!r})")
|
@@ -2847,7 +2847,7 @@ class UntilStage(BaseNestedStage):
|
|
2847
2847
|
Returns:
|
2848
2848
|
Result: The execution result with status and context data.
|
2849
2849
|
"""
|
2850
|
-
trace:
|
2850
|
+
trace: TraceManager = get_trace(
|
2851
2851
|
run_id, parent_run_id=parent_run_id, extras=self.extras
|
2852
2852
|
)
|
2853
2853
|
event: Event = event or Event()
|
@@ -2999,7 +2999,7 @@ class CaseStage(BaseNestedStage):
|
|
2999
2999
|
|
3000
3000
|
:rtype: DictData
|
3001
3001
|
"""
|
3002
|
-
trace:
|
3002
|
+
trace: TraceManager = get_trace(
|
3003
3003
|
run_id, parent_run_id=parent_run_id, extras=self.extras
|
3004
3004
|
)
|
3005
3005
|
trace.debug(f"[STAGE]: Execute Case: {case!r}")
|
@@ -3080,7 +3080,7 @@ class CaseStage(BaseNestedStage):
|
|
3080
3080
|
Returns:
|
3081
3081
|
Result: The execution result with status and context data.
|
3082
3082
|
"""
|
3083
|
-
trace:
|
3083
|
+
trace: TraceManager = get_trace(
|
3084
3084
|
run_id, parent_run_id=parent_run_id, extras=self.extras
|
3085
3085
|
)
|
3086
3086
|
|
@@ -3178,7 +3178,7 @@ class RaiseStage(BaseAsyncStage):
|
|
3178
3178
|
Returns:
|
3179
3179
|
Result: The execution result with status and context data.
|
3180
3180
|
"""
|
3181
|
-
trace:
|
3181
|
+
trace: TraceManager = get_trace(
|
3182
3182
|
run_id, parent_run_id=parent_run_id, extras=self.extras
|
3183
3183
|
)
|
3184
3184
|
message: str = param2template(self.message, params, extras=self.extras)
|
@@ -3209,7 +3209,7 @@ class RaiseStage(BaseAsyncStage):
|
|
3209
3209
|
Returns:
|
3210
3210
|
Result: The execution result with status and context data.
|
3211
3211
|
"""
|
3212
|
-
trace:
|
3212
|
+
trace: TraceManager = get_trace(
|
3213
3213
|
run_id, parent_run_id=parent_run_id, extras=self.extras
|
3214
3214
|
)
|
3215
3215
|
message: str = param2template(self.message, params, extras=self.extras)
|
@@ -3290,7 +3290,7 @@ class DockerStage(BaseStage): # pragma: no cov
|
|
3290
3290
|
"by `pip install docker` first."
|
3291
3291
|
) from None
|
3292
3292
|
|
3293
|
-
trace:
|
3293
|
+
trace: TraceManager = get_trace(
|
3294
3294
|
run_id, parent_run_id=parent_run_id, extras=self.extras
|
3295
3295
|
)
|
3296
3296
|
client = DockerClient(
|
@@ -3390,7 +3390,7 @@ class DockerStage(BaseStage): # pragma: no cov
|
|
3390
3390
|
Returns:
|
3391
3391
|
Result: The execution result with status and context data.
|
3392
3392
|
"""
|
3393
|
-
trace:
|
3393
|
+
trace: TraceManager = get_trace(
|
3394
3394
|
run_id, parent_run_id=parent_run_id, extras=self.extras
|
3395
3395
|
)
|
3396
3396
|
trace.info(f"[STAGE]: Docker: {self.image}:{self.tag}")
|
@@ -3500,7 +3500,7 @@ class VirtualPyStage(PyStage): # pragma: no cov
|
|
3500
3500
|
Returns:
|
3501
3501
|
Result: The execution result with status and context data.
|
3502
3502
|
"""
|
3503
|
-
trace:
|
3503
|
+
trace: TraceManager = get_trace(
|
3504
3504
|
run_id, parent_run_id=parent_run_id, extras=self.extras
|
3505
3505
|
)
|
3506
3506
|
run: str = param2template(dedent(self.run), params, extras=self.extras)
|