|
18 | 18 | import datetime |
19 | 19 | import pathlib |
20 | 20 | from collections.abc import Awaitable, Callable |
| 21 | +from typing import Any |
21 | 22 |
|
22 | 23 | import atr.models.sql as sql |
23 | 24 | import atr.tasks.checks as checks |
@@ -71,6 +72,26 @@ async def _add( |
71 | 72 | inputs_hash=None, |
72 | 73 | ) |
73 | 74 |
|
| 75 | + async def exception( |
| 76 | + self, message: str, data: Any, primary_rel_path: str | None = None, member_rel_path: str | None = None |
| 77 | + ) -> sql.CheckResult: |
| 78 | + return await self._add(sql.CheckResultStatus.EXCEPTION, message, data, primary_rel_path, member_rel_path) |
| 79 | + |
| 80 | + async def failure( |
| 81 | + self, message: str, data: Any, primary_rel_path: str | None = None, member_rel_path: str | None = None |
| 82 | + ) -> sql.CheckResult: |
| 83 | + return await self._add(sql.CheckResultStatus.FAILURE, message, data, primary_rel_path, member_rel_path) |
| 84 | + |
| 85 | + async def success( |
| 86 | + self, message: str, data: Any, primary_rel_path: str | None = None, member_rel_path: str | None = None |
| 87 | + ) -> sql.CheckResult: |
| 88 | + return await self._add(sql.CheckResultStatus.SUCCESS, message, data, primary_rel_path, member_rel_path) |
| 89 | + |
| 90 | + async def warning( |
| 91 | + self, message: str, data: Any, primary_rel_path: str | None = None, member_rel_path: str | None = None |
| 92 | + ) -> sql.CheckResult: |
| 93 | + return await self._add(sql.CheckResultStatus.WARNING, message, data, primary_rel_path, member_rel_path) |
| 94 | + |
74 | 95 |
|
75 | 96 | def get_recorder(recorder: checks.Recorder) -> Callable[[], Awaitable[checks.Recorder]]: |
76 | 97 | async def _recorder() -> checks.Recorder: |
|
0 commit comments