ddeutil-workflow 0.0.83__py3-none-any.whl → 0.0.85__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 +4 -4
- ddeutil/workflow/audits.py +8 -6
- ddeutil/workflow/conf.py +4 -17
- ddeutil/workflow/errors.py +31 -19
- ddeutil/workflow/job.py +276 -156
- ddeutil/workflow/plugins/providers/az.py +2 -2
- ddeutil/workflow/stages.py +700 -330
- ddeutil/workflow/traces.py +125 -185
- ddeutil/workflow/utils.py +14 -3
- ddeutil/workflow/workflow.py +49 -37
- {ddeutil_workflow-0.0.83.dist-info → ddeutil_workflow-0.0.85.dist-info}/METADATA +13 -16
- {ddeutil_workflow-0.0.83.dist-info → ddeutil_workflow-0.0.85.dist-info}/RECORD +17 -17
- {ddeutil_workflow-0.0.83.dist-info → ddeutil_workflow-0.0.85.dist-info}/WHEEL +0 -0
- {ddeutil_workflow-0.0.83.dist-info → ddeutil_workflow-0.0.85.dist-info}/entry_points.txt +0 -0
- {ddeutil_workflow-0.0.83.dist-info → ddeutil_workflow-0.0.85.dist-info}/licenses/LICENSE +0 -0
- {ddeutil_workflow-0.0.83.dist-info → ddeutil_workflow-0.0.85.dist-info}/top_level.txt +0 -0
ddeutil/workflow/workflow.py
CHANGED
@@ -41,6 +41,7 @@ from pydantic.functional_serializers import field_serializer
|
|
41
41
|
from pydantic.functional_validators import field_validator, model_validator
|
42
42
|
from typing_extensions import Self
|
43
43
|
|
44
|
+
from . import DRYRUN
|
44
45
|
from .__types import DictData
|
45
46
|
from .audits import NORMAL, RERUN, Audit, ReleaseType, get_audit
|
46
47
|
from .conf import YamlParser, dynamic
|
@@ -66,7 +67,7 @@ from .utils import (
|
|
66
67
|
extract_id,
|
67
68
|
gen_id,
|
68
69
|
get_dt_now,
|
69
|
-
|
70
|
+
pop_sys_extras,
|
70
71
|
)
|
71
72
|
|
72
73
|
|
@@ -98,7 +99,10 @@ class Workflow(BaseModel):
|
|
98
99
|
description="An extra parameters that want to override config values.",
|
99
100
|
)
|
100
101
|
name: str = Field(description="A workflow name.")
|
101
|
-
type: Literal["Workflow"] = Field(
|
102
|
+
type: Literal["Workflow"] = Field(
|
103
|
+
default="Workflow",
|
104
|
+
description="A type of this config data that will use by discriminator",
|
105
|
+
)
|
102
106
|
desc: Optional[str] = Field(
|
103
107
|
default=None,
|
104
108
|
description=(
|
@@ -244,14 +248,12 @@ class Workflow(BaseModel):
|
|
244
248
|
f"{self.name!r}."
|
245
249
|
)
|
246
250
|
|
247
|
-
# NOTE: Force update internal extras for handler circle execution.
|
248
|
-
self.extras.update({"__sys_break_circle_exec": self.name})
|
249
|
-
|
250
251
|
return self
|
251
252
|
|
252
253
|
@field_serializer("extras")
|
253
254
|
def __serialize_extras(self, extras: DictData) -> DictData:
|
254
|
-
|
255
|
+
"""Serialize extra parameter."""
|
256
|
+
return {k: extras[k] for k in extras if not k.startswith("__sys_")}
|
255
257
|
|
256
258
|
def detail(self) -> DictData: # pragma: no cov
|
257
259
|
"""Return the detail of this workflow for generate markdown."""
|
@@ -264,8 +266,10 @@ class Workflow(BaseModel):
|
|
264
266
|
author (str | None, default None): An author name.
|
265
267
|
"""
|
266
268
|
|
267
|
-
def align_newline(value: str) -> str:
|
269
|
+
def align_newline(value: Optional[str]) -> str:
|
268
270
|
space: str = " " * 16
|
271
|
+
if value is None:
|
272
|
+
return ""
|
269
273
|
return value.rstrip("\n").replace("\n", f"\n{space}")
|
270
274
|
|
271
275
|
info: str = (
|
@@ -452,7 +456,17 @@ class Workflow(BaseModel):
|
|
452
456
|
extras=self.extras,
|
453
457
|
)
|
454
458
|
|
455
|
-
if release_type ==
|
459
|
+
if release_type == RERUN:
|
460
|
+
# TODO: It will load previous audit and use this data to run with
|
461
|
+
# the `rerun` method.
|
462
|
+
raise NotImplementedError(
|
463
|
+
"Release does not support for rerun type yet. Please use the "
|
464
|
+
"`rerun` method instead."
|
465
|
+
)
|
466
|
+
elif release_type == DRYRUN:
|
467
|
+
self.extras.update({"__sys_release_dryrun_mode": True})
|
468
|
+
trace.debug("[RELEASE]: Mark dryrun mode to the extra params.")
|
469
|
+
elif release_type == NORMAL and audit.is_pointed(data=audit_data):
|
456
470
|
trace.info("[RELEASE]: Skip this release because it already audit.")
|
457
471
|
return Result(
|
458
472
|
run_id=run_id,
|
@@ -462,14 +476,6 @@ class Workflow(BaseModel):
|
|
462
476
|
extras=self.extras,
|
463
477
|
)
|
464
478
|
|
465
|
-
if release_type == RERUN:
|
466
|
-
# TODO: It will load previous audit and use this data to run with
|
467
|
-
# the `rerun` method.
|
468
|
-
raise NotImplementedError(
|
469
|
-
"Release does not support for rerun type yet. Please use the "
|
470
|
-
"`rerun` method instead."
|
471
|
-
)
|
472
|
-
|
473
479
|
rs: Result = self.execute(
|
474
480
|
params=values,
|
475
481
|
run_id=parent_run_id,
|
@@ -478,27 +484,29 @@ class Workflow(BaseModel):
|
|
478
484
|
catch(context, status=rs.status, updated=rs.context)
|
479
485
|
trace.info(f"[RELEASE]: End {name!r} : {release:%Y-%m-%d %H:%M:%S}")
|
480
486
|
trace.debug(f"[RELEASE]: Writing audit: {name!r}.")
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
487
|
+
if release_type != DRYRUN:
|
488
|
+
(
|
489
|
+
audit.save(
|
490
|
+
data=audit_data
|
491
|
+
| {
|
492
|
+
"context": context,
|
493
|
+
"runs_metadata": (
|
494
|
+
(runs_metadata or {})
|
495
|
+
| rs.info
|
496
|
+
| {
|
497
|
+
"timeout": timeout,
|
498
|
+
"original_name": self.name,
|
499
|
+
"audit_excluded": audit_excluded,
|
500
|
+
}
|
501
|
+
),
|
502
|
+
},
|
503
|
+
excluded=audit_excluded,
|
504
|
+
)
|
497
505
|
)
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
506
|
+
|
507
|
+
# NOTE: Pop system extra parameters.
|
508
|
+
pop_sys_extras(self.extras, scope="release")
|
509
|
+
return Result.from_trace(trace).catch(
|
502
510
|
status=rs.status,
|
503
511
|
context=catch(
|
504
512
|
context,
|
@@ -513,7 +521,6 @@ class Workflow(BaseModel):
|
|
513
521
|
**(context["errors"] if "errors" in context else {}),
|
514
522
|
},
|
515
523
|
),
|
516
|
-
extras=remove_sys_extras(self.extras),
|
517
524
|
)
|
518
525
|
|
519
526
|
def execute_job(
|
@@ -719,6 +726,8 @@ class Workflow(BaseModel):
|
|
719
726
|
extras=self.extras,
|
720
727
|
)
|
721
728
|
|
729
|
+
# NOTE: Force update internal extras for handler circle execution.
|
730
|
+
self.extras.update({"__sys_exec_break_circle": self.name})
|
722
731
|
with ThreadPoolExecutor(max_job_parallel, "wf") as executor:
|
723
732
|
futures: list[Future] = []
|
724
733
|
|
@@ -747,6 +756,7 @@ class Workflow(BaseModel):
|
|
747
756
|
backoff_sleep = 0.01
|
748
757
|
|
749
758
|
if check == FAILED: # pragma: no cov
|
759
|
+
pop_sys_extras(self.extras)
|
750
760
|
return Result(
|
751
761
|
run_id=run_id,
|
752
762
|
parent_run_id=parent_run_id,
|
@@ -841,6 +851,7 @@ class Workflow(BaseModel):
|
|
841
851
|
for i, s in enumerate(sequence_statuses, start=0):
|
842
852
|
statuses[total + 1 + skip_count + i] = s
|
843
853
|
|
854
|
+
pop_sys_extras(self.extras)
|
844
855
|
st: Status = validate_statuses(statuses)
|
845
856
|
return Result(
|
846
857
|
run_id=run_id,
|
@@ -862,6 +873,7 @@ class Workflow(BaseModel):
|
|
862
873
|
|
863
874
|
time.sleep(0.0025)
|
864
875
|
|
876
|
+
pop_sys_extras(self.extras)
|
865
877
|
return Result(
|
866
878
|
run_id=run_id,
|
867
879
|
parent_run_id=parent_run_id,
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: ddeutil-workflow
|
3
|
-
Version: 0.0.
|
3
|
+
Version: 0.0.85
|
4
4
|
Summary: Lightweight workflow orchestration with YAML template
|
5
5
|
Author-email: ddeutils <korawich.anu@gmail.com>
|
6
6
|
License: MIT
|
@@ -303,21 +303,18 @@ it will use default value and do not raise any error to you.
|
|
303
303
|
> The config value that you will set on the environment should combine with
|
304
304
|
> prefix, component, and name which is `WORKFLOW_{component}_{name}` (Upper case).
|
305
305
|
|
306
|
-
| Name | Component | Default
|
307
|
-
|
308
|
-
| **REGISTRY_CALLER** | CORE | `.`
|
309
|
-
| **REGISTRY_FILTER** | CORE | `ddeutil.workflow.templates`
|
310
|
-
| **CONF_PATH** | CORE | `./conf`
|
311
|
-
| **STAGE_DEFAULT_ID** | CORE | `false`
|
312
|
-
| **GENERATE_ID_SIMPLE_MODE** | CORE | `true`
|
313
|
-
| **DEBUG_MODE** | LOG | `true`
|
314
|
-
| **TIMEZONE** | LOG | `Asia/Bangkok`
|
315
|
-
| **
|
316
|
-
| **
|
317
|
-
| **
|
318
|
-
| **TRACE_HANDLERS** | LOG | `[{"type": "console"}]` | A pointer URL of trace log that use to emit log message. Now uses optimized handler by default. |
|
319
|
-
| **AUDIT_CONF** | LOG | `{"type": "file", "path": "./audits"}` | A pointer URL of audit log that use to write audit metrix. |
|
320
|
-
| **AUDIT_ENABLE_WRITE** | LOG | `true` | A flag that enable writing audit log after end execution in the workflow release step. |
|
306
|
+
| Name | Component | Default | Description |
|
307
|
+
|:----------------------------|:---------:|:---------------------------------------|:---------------------------------------------------------------------------------------|
|
308
|
+
| **REGISTRY_CALLER** | CORE | `.` | List of importable string for the call stage. |
|
309
|
+
| **REGISTRY_FILTER** | CORE | `ddeutil.workflow.templates` | List of importable string for the filter template. |
|
310
|
+
| **CONF_PATH** | CORE | `./conf` | The config path that keep all template `.yaml` files. |
|
311
|
+
| **STAGE_DEFAULT_ID** | CORE | `false` | A flag that enable default stage ID that use for catch an execution output. |
|
312
|
+
| **GENERATE_ID_SIMPLE_MODE** | CORE | `true` | A flog that enable generating ID with `md5` algorithm. |
|
313
|
+
| **DEBUG_MODE** | LOG | `true` | A flag that enable logging with debug level mode. |
|
314
|
+
| **TIMEZONE** | LOG | `Asia/Bangkok` | A Timezone string value that will pass to `ZoneInfo` object. |
|
315
|
+
| **TRACE_HANDLERS** | LOG | `[{"type": "console"}]` | A Json string of list of trace handler config data that use to emit log message. |
|
316
|
+
| **AUDIT_CONF** | LOG | `{"type": "file", "path": "./audits"}` | A Json string of audit config data that use to write audit metrix. |
|
317
|
+
| **AUDIT_ENABLE_WRITE** | LOG | `true` | A flag that enable writing audit log after end execution in the workflow release step. |
|
321
318
|
|
322
319
|
## :rocket: Deployment
|
323
320
|
|
@@ -1,20 +1,20 @@
|
|
1
|
-
ddeutil/workflow/__about__.py,sha256=
|
1
|
+
ddeutil/workflow/__about__.py,sha256=Txvkda5tF4nwp4Yt6KNhSDmJxbz--KaFp-CbDWuvGlY,60
|
2
2
|
ddeutil/workflow/__cron.py,sha256=-1tqZG7GtUmusdl6NTy_Ck7nM_tGYTXYB7TB7tKeO60,29184
|
3
|
-
ddeutil/workflow/__init__.py,sha256=
|
3
|
+
ddeutil/workflow/__init__.py,sha256=p9BkDM0O3LpPchvpYCuUojsDOEEknM__tdAmpRHRQog,3454
|
4
4
|
ddeutil/workflow/__main__.py,sha256=Nqk5aO-HsZVKV2BmuJYeJEufJluipvCD9R1k2kMoJ3Y,8581
|
5
5
|
ddeutil/workflow/__types.py,sha256=IOKuJCxTUPHh8Z2JoLu_K7a85oq0VOcKBhpabiJ6qEE,5001
|
6
|
-
ddeutil/workflow/audits.py,sha256=
|
7
|
-
ddeutil/workflow/conf.py,sha256=
|
8
|
-
ddeutil/workflow/errors.py,sha256=
|
6
|
+
ddeutil/workflow/audits.py,sha256=R-EEQ84Xt_bFl1w00mSlr6jGHdyBTTciKJ3wrS39_7w,26940
|
7
|
+
ddeutil/workflow/conf.py,sha256=pOqELGKvB7Pmu-iUNbQCc6R4dxC1YhpTP-RjNPiS7u0,17288
|
8
|
+
ddeutil/workflow/errors.py,sha256=15GWARGs1rEnlH4JfIL_OQkCmASMRdanNMSGaARPsuc,6031
|
9
9
|
ddeutil/workflow/event.py,sha256=OumcZBlOZD0_J53GS4V2XJEqQ9HEcIl3UicQrCyL46M,14684
|
10
|
-
ddeutil/workflow/job.py,sha256=
|
10
|
+
ddeutil/workflow/job.py,sha256=Xcc4anoHJdUT9IaSj8HPHrKoa9qZJucphvGfFgWjmvw,51177
|
11
11
|
ddeutil/workflow/params.py,sha256=y9f6DEIyae1j4awbj3Kbeq75-U2UPFlKv9K57Hdo_Go,17188
|
12
12
|
ddeutil/workflow/result.py,sha256=0W3z5wAs3Dyr8r2vRMY5hl1MkvdsyXWJmQD4NmsDDOM,10194
|
13
13
|
ddeutil/workflow/reusables.py,sha256=SBLJSxR8ELoWJErBfSMZS3Rr1O_93T-fFBpfn2AvxuA,25007
|
14
|
-
ddeutil/workflow/stages.py,sha256=
|
15
|
-
ddeutil/workflow/traces.py,sha256=
|
16
|
-
ddeutil/workflow/utils.py,sha256=
|
17
|
-
ddeutil/workflow/workflow.py,sha256=
|
14
|
+
ddeutil/workflow/stages.py,sha256=PwL_VlK8dnNrWKT0y7TmsD8Zbp_D705a0FQ10SQHCoU,143580
|
15
|
+
ddeutil/workflow/traces.py,sha256=quNko9OqB-ZHd4IcbfFKTeCA4Ccf1XZAVEHDYx05K34,70500
|
16
|
+
ddeutil/workflow/utils.py,sha256=Hqdh6I3OD4N0Kuehn9qWVOg54pO3BG3rgIacCrN7jqk,12298
|
17
|
+
ddeutil/workflow/workflow.py,sha256=yMlCG5f1GOsuVwzUwtOqyRcmsm2R_PPXz1uMJzBkv_c,43220
|
18
18
|
ddeutil/workflow/api/__init__.py,sha256=5DzYL3ngceoRshh5HYCSVWChqNJSiP01E1bEd8XxPi0,4799
|
19
19
|
ddeutil/workflow/api/log_conf.py,sha256=WfS3udDLSyrP-C80lWOvxxmhd_XWKvQPkwDqKblcH3E,1834
|
20
20
|
ddeutil/workflow/api/routes/__init__.py,sha256=JRaJZB0D6mgR17MbZo8yLtdYDtD62AA8MdKlFqhG84M,420
|
@@ -24,12 +24,12 @@ ddeutil/workflow/api/routes/workflows.py,sha256=0pEZEsIrscRFBXG9gf6nttKw0aNbcdw7
|
|
24
24
|
ddeutil/workflow/plugins/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
25
25
|
ddeutil/workflow/plugins/providers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
26
26
|
ddeutil/workflow/plugins/providers/aws.py,sha256=61uIFBEWt-_D5Sui24qUPier1Hiqlw_RP_eY-rXBCKc,31551
|
27
|
-
ddeutil/workflow/plugins/providers/az.py,sha256=
|
27
|
+
ddeutil/workflow/plugins/providers/az.py,sha256=86xuJh3rGvpGuDYD0c-inc7UcyiKQ28U_gMCUfgB5SQ,34879
|
28
28
|
ddeutil/workflow/plugins/providers/container.py,sha256=DSN0RWxMjTJN5ANheeMauDaPa3X6Z2E1eGUcctYkENw,22134
|
29
29
|
ddeutil/workflow/plugins/providers/gcs.py,sha256=KgAOdMBvdbMLTH_z_FwVriBFtZfKEYx8_34jzUOVjTY,27460
|
30
|
-
ddeutil_workflow-0.0.
|
31
|
-
ddeutil_workflow-0.0.
|
32
|
-
ddeutil_workflow-0.0.
|
33
|
-
ddeutil_workflow-0.0.
|
34
|
-
ddeutil_workflow-0.0.
|
35
|
-
ddeutil_workflow-0.0.
|
30
|
+
ddeutil_workflow-0.0.85.dist-info/licenses/LICENSE,sha256=nGFZ1QEhhhWeMHf9n99_fdt4vQaXS29xWKxt-OcLywk,1085
|
31
|
+
ddeutil_workflow-0.0.85.dist-info/METADATA,sha256=PjMSLS8IcDUCYS9SiovxEbuvUMAER_BkHA_t0oFIxNY,14080
|
32
|
+
ddeutil_workflow-0.0.85.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
33
|
+
ddeutil_workflow-0.0.85.dist-info/entry_points.txt,sha256=qDTpPSauL0ciO6T4iSVt8bJeYrVEkkoEEw_RlGx6Kgk,63
|
34
|
+
ddeutil_workflow-0.0.85.dist-info/top_level.txt,sha256=m9M6XeSWDwt_yMsmH6gcOjHZVK5O0-vgtNBuncHjzW4,8
|
35
|
+
ddeutil_workflow-0.0.85.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|