liblaf-cherries 0.0.10__tar.gz → 0.0.12__tar.gz
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.
- {liblaf_cherries-0.0.10 → liblaf_cherries-0.0.12}/PKG-INFO +1 -1
- {liblaf_cherries-0.0.10 → liblaf_cherries-0.0.12}/src/liblaf/cherries/__init__.pyi +5 -3
- {liblaf_cherries-0.0.10 → liblaf_cherries-0.0.12}/src/liblaf/cherries/_run.py +11 -3
- {liblaf_cherries-0.0.10 → liblaf_cherries-0.0.12}/src/liblaf/cherries/_version.py +2 -2
- {liblaf_cherries-0.0.10 → liblaf_cherries-0.0.12}/src/liblaf/cherries/plugin/__init__.pyi +4 -0
- {liblaf_cherries-0.0.10 → liblaf_cherries-0.0.12}/src/liblaf/cherries/plugin/_abc.py +11 -2
- {liblaf_cherries-0.0.10 → liblaf_cherries-0.0.12}/src/liblaf/cherries/plugin/_dvc.py +2 -2
- {liblaf_cherries-0.0.10 → liblaf_cherries-0.0.12}/src/liblaf/cherries/plugin/_git.py +2 -2
- {liblaf_cherries-0.0.10 → liblaf_cherries-0.0.12}/src/liblaf/cherries/plugin/_logging.py +2 -2
- {liblaf_cherries-0.0.10 → liblaf_cherries-0.0.12}/src/liblaf/cherries/plugin/_mlflow.py +13 -3
- {liblaf_cherries-0.0.10 → liblaf_cherries-0.0.12}/src/liblaf/cherries/plugin/_run.py +1 -0
- {liblaf_cherries-0.0.10 → liblaf_cherries-0.0.12}/.gitignore +0 -0
- {liblaf_cherries-0.0.10 → liblaf_cherries-0.0.12}/LICENSE +0 -0
- {liblaf_cherries-0.0.10 → liblaf_cherries-0.0.12}/docs/README.md +0 -0
- {liblaf_cherries-0.0.10 → liblaf_cherries-0.0.12}/pyproject.toml +0 -0
- {liblaf_cherries-0.0.10 → liblaf_cherries-0.0.12}/src/liblaf/cherries/__init__.py +0 -0
- {liblaf_cherries-0.0.10 → liblaf_cherries-0.0.12}/src/liblaf/cherries/_config.py +0 -0
- {liblaf_cherries-0.0.10 → liblaf_cherries-0.0.12}/src/liblaf/cherries/_version.pyi +0 -0
- {liblaf_cherries-0.0.10 → liblaf_cherries-0.0.12}/src/liblaf/cherries/info/__init__.py +0 -0
- {liblaf_cherries-0.0.10 → liblaf_cherries-0.0.12}/src/liblaf/cherries/info/__init__.pyi +0 -0
- {liblaf_cherries-0.0.10 → liblaf_cherries-0.0.12}/src/liblaf/cherries/info/_exp_name.py +0 -0
- {liblaf_cherries-0.0.10 → liblaf_cherries-0.0.12}/src/liblaf/cherries/info/_git.py +0 -0
- {liblaf_cherries-0.0.10 → liblaf_cherries-0.0.12}/src/liblaf/cherries/pathutils/__init__.py +0 -0
- {liblaf_cherries-0.0.10 → liblaf_cherries-0.0.12}/src/liblaf/cherries/pathutils/__init__.pyi +0 -0
- {liblaf_cherries-0.0.10 → liblaf_cherries-0.0.12}/src/liblaf/cherries/pathutils/_convert.py +0 -0
- {liblaf_cherries-0.0.10 → liblaf_cherries-0.0.12}/src/liblaf/cherries/pathutils/_path.py +0 -0
- {liblaf_cherries-0.0.10 → liblaf_cherries-0.0.12}/src/liblaf/cherries/pathutils/_special.py +0 -0
- {liblaf_cherries-0.0.10 → liblaf_cherries-0.0.12}/src/liblaf/cherries/plugin/__init__.py +0 -0
- {liblaf_cherries-0.0.10 → liblaf_cherries-0.0.12}/src/liblaf/cherries/presets/__init__.py +0 -0
- {liblaf_cherries-0.0.10 → liblaf_cherries-0.0.12}/src/liblaf/cherries/presets/__init__.pyi +0 -0
- {liblaf_cherries-0.0.10 → liblaf_cherries-0.0.12}/src/liblaf/cherries/presets/_default.py +0 -0
- {liblaf_cherries-0.0.10 → liblaf_cherries-0.0.12}/src/liblaf/cherries/py.typed +0 -0
- {liblaf_cherries-0.0.10 → liblaf_cherries-0.0.12}/src/liblaf/cherries/typed.py +0 -0
- {liblaf_cherries-0.0.10 → liblaf_cherries-0.0.12}/src/liblaf/cherries/utils/__init__.py +0 -0
- {liblaf_cherries-0.0.10 → liblaf_cherries-0.0.12}/src/liblaf/cherries/utils/__init__.pyi +0 -0
- {liblaf_cherries-0.0.10 → liblaf_cherries-0.0.12}/src/liblaf/cherries/utils/_functools.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
from . import info, pathutils, plugin, presets, utils
|
2
2
|
from ._config import BaseConfig
|
3
|
-
from ._run import run
|
3
|
+
from ._run import end, run, start
|
4
4
|
from .pathutils import (
|
5
5
|
as_os_path,
|
6
6
|
as_path,
|
@@ -27,8 +27,8 @@ from .plugin import (
|
|
27
27
|
LogParam,
|
28
28
|
Plugin,
|
29
29
|
Run,
|
30
|
+
RunStatus,
|
30
31
|
Start,
|
31
|
-
end,
|
32
32
|
log_artifact,
|
33
33
|
log_artifacts,
|
34
34
|
log_input,
|
@@ -37,8 +37,8 @@ from .plugin import (
|
|
37
37
|
log_output,
|
38
38
|
log_outputs,
|
39
39
|
log_param,
|
40
|
+
log_src,
|
40
41
|
set_tag,
|
41
|
-
start,
|
42
42
|
)
|
43
43
|
|
44
44
|
__all__ = [
|
@@ -52,6 +52,7 @@ __all__ = [
|
|
52
52
|
"LoggingStart",
|
53
53
|
"Plugin",
|
54
54
|
"Run",
|
55
|
+
"RunStatus",
|
55
56
|
"Start",
|
56
57
|
"as_os_path",
|
57
58
|
"as_path",
|
@@ -73,6 +74,7 @@ __all__ = [
|
|
73
74
|
"log_output",
|
74
75
|
"log_outputs",
|
75
76
|
"log_param",
|
77
|
+
"log_src",
|
76
78
|
"outputs",
|
77
79
|
"params",
|
78
80
|
"path",
|
@@ -13,9 +13,17 @@ def run[C: pydantic.BaseModel, T](main: Callable[[C], T]) -> T:
|
|
13
13
|
cls: type[C] = next(iter(type_hints.values()))
|
14
14
|
cfg: C = cls()
|
15
15
|
run.log_param("cherries.config", cfg.model_dump(mode="json"))
|
16
|
-
|
17
|
-
|
18
|
-
|
16
|
+
try:
|
17
|
+
ret: T = main(cfg)
|
18
|
+
except BaseException as e:
|
19
|
+
if isinstance(e, KeyboardInterrupt):
|
20
|
+
run.end("KILLED")
|
21
|
+
raise
|
22
|
+
run.end("FAILED")
|
23
|
+
raise
|
24
|
+
else:
|
25
|
+
run.end()
|
26
|
+
return ret
|
19
27
|
|
20
28
|
|
21
29
|
def start() -> plugin.Run:
|
@@ -5,6 +5,7 @@ from ._abc import (
|
|
5
5
|
LogMetric,
|
6
6
|
LogParam,
|
7
7
|
Plugin,
|
8
|
+
RunStatus,
|
8
9
|
Start,
|
9
10
|
)
|
10
11
|
from ._dvc import DvcEnd, DvcLogArtifact, DvcLogArtifacts
|
@@ -30,6 +31,7 @@ from ._run import (
|
|
30
31
|
log_output,
|
31
32
|
log_outputs,
|
32
33
|
log_param,
|
34
|
+
log_src,
|
33
35
|
run,
|
34
36
|
set_tag,
|
35
37
|
start,
|
@@ -57,6 +59,7 @@ __all__ = [
|
|
57
59
|
"MlflowStart",
|
58
60
|
"Plugin",
|
59
61
|
"Run",
|
62
|
+
"RunStatus",
|
60
63
|
"Start",
|
61
64
|
"end",
|
62
65
|
"log_artifact",
|
@@ -67,6 +70,7 @@ __all__ = [
|
|
67
70
|
"log_output",
|
68
71
|
"log_outputs",
|
69
72
|
"log_param",
|
73
|
+
"log_src",
|
70
74
|
"run",
|
71
75
|
"set_tag",
|
72
76
|
"start",
|
@@ -1,6 +1,7 @@
|
|
1
1
|
from __future__ import annotations
|
2
2
|
|
3
3
|
import bisect
|
4
|
+
import enum
|
4
5
|
import functools
|
5
6
|
import operator
|
6
7
|
from collections.abc import Iterable
|
@@ -8,12 +9,20 @@ from pathlib import Path
|
|
8
9
|
from typing import Any, override
|
9
10
|
|
10
11
|
import attrs
|
12
|
+
import mlflow
|
13
|
+
import mlflow.entities
|
11
14
|
from loguru import logger
|
12
15
|
|
13
16
|
from liblaf.cherries import pathutils as _path
|
14
17
|
from liblaf.cherries.typed import PathLike
|
15
18
|
|
16
19
|
|
20
|
+
class RunStatus(enum.StrEnum):
|
21
|
+
FAILED = mlflow.entities.RunStatus.to_string(mlflow.entities.RunStatus.FAILED)
|
22
|
+
FINISHED = mlflow.entities.RunStatus.to_string(mlflow.entities.RunStatus.FINISHED)
|
23
|
+
KILLED = mlflow.entities.RunStatus.to_string(mlflow.entities.RunStatus.KILLED)
|
24
|
+
|
25
|
+
|
17
26
|
@functools.total_ordering
|
18
27
|
@attrs.define
|
19
28
|
class Plugin[**P, T]:
|
@@ -64,8 +73,8 @@ class Plugin[**P, T]:
|
|
64
73
|
@attrs.define
|
65
74
|
class End(Plugin):
|
66
75
|
@override
|
67
|
-
def __call__(self) -> None:
|
68
|
-
return super().__call__()
|
76
|
+
def __call__(self, status: RunStatus = RunStatus.FINISHED) -> None:
|
77
|
+
return super().__call__(status)
|
69
78
|
|
70
79
|
|
71
80
|
@attrs.define
|
@@ -7,13 +7,13 @@ import attrs
|
|
7
7
|
from liblaf.cherries import pathutils as _path
|
8
8
|
from liblaf.cherries.typed import PathLike
|
9
9
|
|
10
|
-
from ._abc import End, LogArtifact, LogArtifacts
|
10
|
+
from ._abc import End, LogArtifact, LogArtifacts, RunStatus
|
11
11
|
|
12
12
|
|
13
13
|
@attrs.define
|
14
14
|
class DvcEnd(End):
|
15
15
|
@override
|
16
|
-
def __call__(self) -> None:
|
16
|
+
def __call__(self, status: RunStatus = RunStatus.FINISHED) -> None:
|
17
17
|
sp.run(["dvc", "status"], check=True)
|
18
18
|
sp.run(["dvc", "push"], check=True)
|
19
19
|
|
@@ -5,7 +5,7 @@ from environs import env
|
|
5
5
|
|
6
6
|
from liblaf.cherries import info as _info
|
7
7
|
|
8
|
-
from ._abc import End, Start
|
8
|
+
from ._abc import End, RunStatus, Start
|
9
9
|
from ._run import run
|
10
10
|
|
11
11
|
|
@@ -14,7 +14,7 @@ class GitEnd(End):
|
|
14
14
|
dry_run: bool = env.bool("LIBLAF_CHERRIES_GIT_DRY_RUN", default=False)
|
15
15
|
|
16
16
|
@override
|
17
|
-
def __call__(self) -> None:
|
17
|
+
def __call__(self, status: RunStatus = RunStatus.FINISHED) -> None:
|
18
18
|
git_auto_commit(
|
19
19
|
"chore(cherries): auto commit (on run end)", dry_run=self.dry_run
|
20
20
|
)
|
@@ -5,14 +5,14 @@ from loguru import logger
|
|
5
5
|
|
6
6
|
from liblaf import grapes
|
7
7
|
|
8
|
-
from ._abc import End, Start
|
8
|
+
from ._abc import End, RunStatus, Start
|
9
9
|
from ._run import run
|
10
10
|
|
11
11
|
|
12
12
|
@attrs.define
|
13
13
|
class LoggingEnd(End):
|
14
14
|
@override
|
15
|
-
def __call__(self) -> None:
|
15
|
+
def __call__(self, status: RunStatus = RunStatus.FINISHED) -> None:
|
16
16
|
logger.complete()
|
17
17
|
run.log_artifact(run.exp_dir / "run.log")
|
18
18
|
run.log_artifact(run.exp_dir / "run.log.jsonl")
|
@@ -3,19 +3,29 @@ from typing import Any, override
|
|
3
3
|
|
4
4
|
import attrs
|
5
5
|
import mlflow
|
6
|
+
import mlflow.entities
|
6
7
|
|
7
8
|
from liblaf.cherries import info as _info
|
8
9
|
from liblaf.cherries import pathutils as _path
|
9
10
|
from liblaf.cherries.typed import PathLike
|
10
11
|
|
11
|
-
from ._abc import
|
12
|
+
from ._abc import (
|
13
|
+
End,
|
14
|
+
LogArtifact,
|
15
|
+
LogArtifacts,
|
16
|
+
LogMetric,
|
17
|
+
LogParam,
|
18
|
+
RunStatus,
|
19
|
+
SetTag,
|
20
|
+
Start,
|
21
|
+
)
|
12
22
|
|
13
23
|
|
14
24
|
@attrs.define
|
15
25
|
class MlflowEnd(End):
|
16
26
|
@override
|
17
|
-
def __call__(self) -> None:
|
18
|
-
mlflow.end_run()
|
27
|
+
def __call__(self, status: RunStatus = RunStatus.FINISHED) -> None:
|
28
|
+
mlflow.end_run(status)
|
19
29
|
|
20
30
|
|
21
31
|
@attrs.define
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{liblaf_cherries-0.0.10 → liblaf_cherries-0.0.12}/src/liblaf/cherries/pathutils/__init__.pyi
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|