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.
@@ -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
- Execution --> Ok ┬--( handler )--> Result with `SUCCESS` or `CANCEL`
19
- |
20
- ├--( handler )--> Result with `FAILED` (Set `raise_error` flag)
21
- |
22
- ╰--( handler )---> Result with `SKIP`
18
+ Handler --> Ok --> Result
19
+ |-status: SUCCESS
20
+ ╰-context:
21
+ ╰-outputs: ...
23
22
 
24
- --> Error ---( handler )--> Raise StageError(...)
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="Retry number if stage execution get the error.",
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 powerfull stage of this package for run every
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`.