ddeutil-workflow 0.0.36__py3-none-any.whl → 0.0.38__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 -1
- ddeutil/workflow/api/api.py +3 -1
- ddeutil/workflow/api/log.py +59 -0
- ddeutil/workflow/api/repeat.py +1 -1
- ddeutil/workflow/api/routes/job.py +4 -2
- ddeutil/workflow/api/routes/logs.py +126 -17
- ddeutil/workflow/api/routes/schedules.py +6 -6
- ddeutil/workflow/api/routes/workflows.py +9 -7
- ddeutil/workflow/caller.py +9 -3
- ddeutil/workflow/conf.py +0 -60
- ddeutil/workflow/context.py +59 -0
- ddeutil/workflow/exceptions.py +14 -1
- ddeutil/workflow/job.py +310 -277
- ddeutil/workflow/logs.py +6 -1
- ddeutil/workflow/result.py +1 -1
- ddeutil/workflow/scheduler.py +11 -4
- ddeutil/workflow/stages.py +368 -111
- ddeutil/workflow/utils.py +27 -49
- ddeutil/workflow/workflow.py +137 -72
- {ddeutil_workflow-0.0.36.dist-info → ddeutil_workflow-0.0.38.dist-info}/METADATA +12 -6
- ddeutil_workflow-0.0.38.dist-info/RECORD +33 -0
- {ddeutil_workflow-0.0.36.dist-info → ddeutil_workflow-0.0.38.dist-info}/WHEEL +1 -1
- ddeutil_workflow-0.0.36.dist-info/RECORD +0 -31
- {ddeutil_workflow-0.0.36.dist-info → ddeutil_workflow-0.0.38.dist-info/licenses}/LICENSE +0 -0
- {ddeutil_workflow-0.0.36.dist-info → ddeutil_workflow-0.0.38.dist-info}/top_level.txt +0 -0
ddeutil/workflow/logs.py
CHANGED
@@ -234,7 +234,7 @@ class FileTraceLog(BaseTraceLog): # pragma: no cov
|
|
234
234
|
return f"({self.cut_id}) {message}"
|
235
235
|
|
236
236
|
def writer(self, message: str, is_err: bool = False) -> None:
|
237
|
-
"""
|
237
|
+
"""Write a trace message after making to target file and write metadata
|
238
238
|
in the same path of standard files.
|
239
239
|
|
240
240
|
The path of logging data will store by format:
|
@@ -279,6 +279,11 @@ class FileTraceLog(BaseTraceLog): # pragma: no cov
|
|
279
279
|
+ "\n"
|
280
280
|
)
|
281
281
|
|
282
|
+
async def awriter(
|
283
|
+
self, message: str, is_err: bool = False
|
284
|
+
): # pragma: no cov
|
285
|
+
"""TODO: Use `aiofiles` for make writer method support async."""
|
286
|
+
|
282
287
|
|
283
288
|
class SQLiteTraceLog(BaseTraceLog): # pragma: no cov
|
284
289
|
"""Trace Log object that write trace log to the SQLite database file."""
|
ddeutil/workflow/result.py
CHANGED
@@ -91,7 +91,7 @@ class Result:
|
|
91
91
|
@model_validator(mode="after")
|
92
92
|
def __prepare_trace(self) -> Self:
|
93
93
|
"""Prepare trace field that want to pass after its initialize step."""
|
94
|
-
if self.trace is None: # pragma: no
|
94
|
+
if self.trace is None: # pragma: no cov
|
95
95
|
self.trace: TraceLog = get_trace(self.run_id, self.parent_run_id)
|
96
96
|
|
97
97
|
return self
|
ddeutil/workflow/scheduler.py
CHANGED
@@ -83,6 +83,11 @@ class ScheduleWorkflow(BaseModel):
|
|
83
83
|
the Schedule model. it should not use Workflow model directly because on the
|
84
84
|
schedule config it can adjust crontab value that different from the Workflow
|
85
85
|
model.
|
86
|
+
|
87
|
+
This on field does not equal to the on field of Workflow model, but it
|
88
|
+
uses same logic to generate running release date with crontab object. It use
|
89
|
+
for override the on field if the schedule time was change but you do not
|
90
|
+
want to change on the workflow model.
|
86
91
|
"""
|
87
92
|
|
88
93
|
alias: Optional[str] = Field(
|
@@ -97,7 +102,7 @@ class ScheduleWorkflow(BaseModel):
|
|
97
102
|
values: DictData = Field(
|
98
103
|
default_factory=dict,
|
99
104
|
description=(
|
100
|
-
"A value that want to pass to the workflow
|
105
|
+
"A value that want to pass to the workflow params field when auto "
|
101
106
|
"calling release method."
|
102
107
|
),
|
103
108
|
alias="params",
|
@@ -222,8 +227,8 @@ class ScheduleWorkflow(BaseModel):
|
|
222
227
|
class Schedule(BaseModel):
|
223
228
|
"""Schedule Pydantic model that use to run with any scheduler package.
|
224
229
|
|
225
|
-
|
226
|
-
|
230
|
+
The workflows field of this model include ScheduleWorkflow objects that
|
231
|
+
enhance the workflow object by adding the alias and values fields.
|
227
232
|
"""
|
228
233
|
|
229
234
|
desc: Optional[str] = Field(
|
@@ -477,7 +482,9 @@ def schedule_task(
|
|
477
482
|
current_release: datetime = current_date.replace(
|
478
483
|
second=0, microsecond=0
|
479
484
|
)
|
480
|
-
if (
|
485
|
+
if (
|
486
|
+
first_date := q.first_queue.date
|
487
|
+
) > current_release: # pragma: no cov
|
481
488
|
result.trace.debug(
|
482
489
|
f"[WORKFLOW]: Skip schedule "
|
483
490
|
f"{first_date:%Y-%m-%d %H:%M:%S} for : {task.alias!r}"
|