Skip to content

Commit 30babbe

Browse files
committed
📄 docs: update docstring and mkdocs on logs session.
1 parent 206ef8e commit 30babbe

3 files changed

Lines changed: 30 additions & 12 deletions

File tree

docs/api/audits.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Audits
2+
3+
The Audits module include metadata audit logs for the workflow release method.
4+
5+
## FileAudit

docs/api/traces.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
# Logs
1+
# Traces
22

3-
The log module include audit log and trace log objects.
3+
The Traces module include trace log objects that is the stdout and stderr of the
4+
execution process.
45

5-
## FileAudit
6-
7-
## FileTraceLog
6+
## FileTrace

src/ddeutil/workflow/traces.py

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,11 @@ class PrefixMsg(BaseModel):
8888
def from_str(cls, msg: str) -> Self:
8989
"""Extract message prefix from an input message.
9090
91-
:param msg: A message that want to extract.
91+
Args:
92+
msg (str): A message that want to extract.
9293
93-
:rtype: PrefixMsg
94+
Returns:
95+
PrefixMsg: the validated model from a string message.
9496
"""
9597
return PrefixMsg.model_validate(
9698
obj=PREFIX_LOGS_REGEX.search(msg).groupdict()
@@ -231,18 +233,18 @@ class BaseTrace(BaseModel, ABC): # pragma: no cov
231233

232234
model_config = ConfigDict(frozen=True)
233235

234-
run_id: str = Field(default="A running ID")
235-
parent_run_id: Optional[str] = Field(
236-
default=None,
237-
description="A parent running ID",
238-
)
239236
extras: DictData = Field(
240237
default_factory=dict,
241238
description=(
242239
"An extra parameter that want to override on the core config "
243240
"values."
244241
),
245242
)
243+
run_id: str = Field(description="A running ID")
244+
parent_run_id: Optional[str] = Field(
245+
default=None,
246+
description="A parent running ID",
247+
)
246248

247249
@classmethod
248250
@abstractmethod
@@ -251,6 +253,17 @@ def find_traces(
251253
path: Optional[Path] = None,
252254
extras: Optional[DictData] = None,
253255
) -> Iterator[TraceData]: # pragma: no cov
256+
"""Return iterator of TraceData models from the target pointer.
257+
258+
Args:
259+
path (:obj:`Path`, optional): A pointer path that want to override.
260+
extras (:obj:`DictData`, optional): An extras parameter that want to
261+
override default engine config.
262+
263+
Returns:
264+
Iterator[TracData]: An iterator object that generate a TracData
265+
model.
266+
"""
254267
raise NotImplementedError(
255268
"Trace dataclass should implement `find_traces` class-method."
256269
)
@@ -322,6 +335,7 @@ def make_message(self, message: str) -> str:
322335

323336

324337
class ConsoleTrace(BaseTrace): # pragma: no cov
338+
"""Console Trace log model."""
325339

326340
@classmethod
327341
def find_traces(

0 commit comments

Comments
 (0)