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/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
- """ "Write a trace message after making to target file and write metadata
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."""
@@ -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 cove
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
@@ -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 parameters when "
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
- It does not equal the on value in Workflow model, but it uses same logic
226
- to running release date with crontab interval.
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 (first_date := q.first_queue.date) > current_release:
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}"