ddeutil-workflow 0.0.67__py3-none-any.whl → 0.0.69__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 +14 -12
- ddeutil/workflow/api/__init__.py +20 -19
- ddeutil/workflow/api/log_conf.py +59 -0
- ddeutil/workflow/api/routes/__init__.py +3 -3
- ddeutil/workflow/api/routes/job.py +42 -16
- ddeutil/workflow/api/routes/logs.py +8 -8
- ddeutil/workflow/api/routes/workflows.py +12 -11
- ddeutil/workflow/audits.py +374 -0
- ddeutil/workflow/cli.py +80 -15
- ddeutil/workflow/conf.py +9 -52
- ddeutil/workflow/event.py +6 -5
- ddeutil/workflow/result.py +10 -1
- ddeutil/workflow/stages.py +38 -9
- ddeutil/workflow/{logs.py → traces.py} +168 -387
- ddeutil/workflow/utils.py +1 -52
- ddeutil/workflow/workflow.py +8 -16
- {ddeutil_workflow-0.0.67.dist-info → ddeutil_workflow-0.0.69.dist-info}/METADATA +31 -29
- ddeutil_workflow-0.0.69.dist-info/RECORD +30 -0
- {ddeutil_workflow-0.0.67.dist-info → ddeutil_workflow-0.0.69.dist-info}/WHEEL +1 -1
- ddeutil/workflow/api/logs.py +0 -59
- ddeutil_workflow-0.0.67.dist-info/RECORD +0 -29
- {ddeutil_workflow-0.0.67.dist-info → ddeutil_workflow-0.0.69.dist-info}/entry_points.txt +0 -0
- {ddeutil_workflow-0.0.67.dist-info → ddeutil_workflow-0.0.69.dist-info}/licenses/LICENSE +0 -0
- {ddeutil_workflow-0.0.67.dist-info → ddeutil_workflow-0.0.69.dist-info}/top_level.txt +0 -0
ddeutil/workflow/stages.py
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
# Licensed under the MIT License. See LICENSE in the project root for
|
4
4
|
# license information.
|
5
5
|
# ------------------------------------------------------------------------------
|
6
|
-
"""Stages module include all stage model that implemented to be the minimum execution
|
6
|
+
r"""Stages module include all stage model that implemented to be the minimum execution
|
7
7
|
layer of this workflow core engine. The stage handle the minimize task that run
|
8
8
|
in a thread (same thread at its job owner) that mean it is the lowest executor that
|
9
9
|
you can track logs.
|
@@ -15,17 +15,39 @@ have a lot of use-case, and it should does not worry about it error output.
|
|
15
15
|
So, I will create `handler_execute` for any exception class that raise from
|
16
16
|
the stage execution method.
|
17
17
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
╰--( handler )---> Result with `SKIP`
|
18
|
+
Handler --> Ok --> Result
|
19
|
+
|-status: SUCCESS
|
20
|
+
╰-context:
|
21
|
+
╰-outputs: ...
|
23
22
|
|
24
|
-
-->
|
23
|
+
--> Ok --> Result
|
24
|
+
╰-status: CANCEL
|
25
|
+
|
26
|
+
--> Ok --> Result
|
27
|
+
╰-status: SKIP
|
28
|
+
|
29
|
+
--> Ok --> Result
|
30
|
+
|-status: FAILED
|
31
|
+
╰-errors:
|
32
|
+
|-name: ...
|
33
|
+
╰-message: ...
|
25
34
|
|
26
35
|
On the context I/O that pass to a stage object at execute process. The
|
27
36
|
execute method receives a `params={"params": {...}}` value for passing template
|
28
37
|
searching.
|
38
|
+
|
39
|
+
All stages model inherit from `BaseStage` or `AsyncBaseStage` models that has the
|
40
|
+
base fields:
|
41
|
+
|
42
|
+
| field | alias | data type | default | description |
|
43
|
+
|-----------|-------|-------------|:--------:|-----------------------------------------------------------------------|
|
44
|
+
| id | | str \| None | `None` | A stage ID that use to keep execution output or getting by job owner. |
|
45
|
+
| name | | str | | A stage name that want to log when start execution. |
|
46
|
+
| condition | if | str \| None | `None` | A stage condition statement to allow stage executable. |
|
47
|
+
| extras | | dict | `dict()` | An extra parameter that override core config values. |
|
48
|
+
|
49
|
+
It has a special base class is `BaseRetryStage` that inherit from `AsyncBaseStage`
|
50
|
+
that use to handle retry execution when it got any error with `retry` field.
|
29
51
|
"""
|
30
52
|
from __future__ import annotations
|
31
53
|
|
@@ -450,6 +472,13 @@ class BaseStage(BaseModel, ABC):
|
|
450
472
|
"""
|
451
473
|
return False
|
452
474
|
|
475
|
+
def docs(self) -> str: # pragma: no cov
|
476
|
+
"""Return generated document that will be the interface of this stage.
|
477
|
+
|
478
|
+
:rtype: str
|
479
|
+
"""
|
480
|
+
return self.desc
|
481
|
+
|
453
482
|
|
454
483
|
class BaseAsyncStage(BaseStage, ABC):
|
455
484
|
"""Base Async Stage model to make any stage model allow async execution for
|
@@ -594,7 +623,7 @@ class BaseRetryStage(BaseAsyncStage, ABC): # pragma: no cov
|
|
594
623
|
default=0,
|
595
624
|
ge=0,
|
596
625
|
lt=20,
|
597
|
-
description="
|
626
|
+
description="A retry number if stage execution get the error.",
|
598
627
|
)
|
599
628
|
|
600
629
|
def _execute(
|
@@ -1249,7 +1278,7 @@ class CallStage(BaseRetryStage):
|
|
1249
1278
|
function complexly that you can for your objective to invoked by this stage
|
1250
1279
|
object.
|
1251
1280
|
|
1252
|
-
This stage is the most
|
1281
|
+
This stage is the most powerful stage of this package for run every
|
1253
1282
|
use-case by a custom requirement that you want by creating the Python
|
1254
1283
|
function and adding it to the caller registry value by importer syntax like
|
1255
1284
|
`module.caller.registry` not path style like `module/caller/registry`.
|