hydraflow 0.7.0__py3-none-any.whl → 0.7.3__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.
hydraflow/__init__.py CHANGED
@@ -1,10 +1,11 @@
1
1
  """Integrate Hydra and MLflow to manage and track machine learning experiments."""
2
2
 
3
- from .config import select_config, select_overrides
4
- from .context import chdir_artifact, log_run, start_run
5
- from .mlflow import list_runs, search_runs, set_experiment
6
- from .run_collection import RunCollection
7
- from .utils import (
3
+ from hydraflow.config import select_config, select_overrides
4
+ from hydraflow.context import chdir_artifact, log_run, start_run
5
+ from hydraflow.main import main
6
+ from hydraflow.mlflow import list_runs, search_runs, set_experiment
7
+ from hydraflow.run_collection import RunCollection
8
+ from hydraflow.utils import (
8
9
  get_artifact_dir,
9
10
  get_artifact_path,
10
11
  get_hydra_output_dir,
@@ -25,6 +26,7 @@ __all__ = [
25
26
  "load_config",
26
27
  "load_overrides",
27
28
  "log_run",
29
+ "main",
28
30
  "remove_run",
29
31
  "search_runs",
30
32
  "select_config",
hydraflow/main.py ADDED
@@ -0,0 +1,54 @@
1
+ """main decorator."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from functools import wraps
6
+ from typing import TYPE_CHECKING, Any
7
+
8
+ import hydra
9
+ from hydra.core.config_store import ConfigStore
10
+ from mlflow.entities import RunStatus
11
+
12
+ import hydraflow
13
+
14
+ if TYPE_CHECKING:
15
+ from collections.abc import Callable
16
+
17
+ from mlflow.entities import Run
18
+
19
+ FINISHED = RunStatus.to_string(RunStatus.FINISHED)
20
+
21
+
22
+ def main(
23
+ node: Any,
24
+ config_name: str = "config",
25
+ *,
26
+ chdir: bool = False,
27
+ force_new_run: bool = False,
28
+ skip_finished: bool = True,
29
+ ):
30
+ """Main decorator."""
31
+
32
+ def decorator(app: Callable[[Run, Any], None]) -> Callable[[], None]:
33
+ ConfigStore.instance().store(name=config_name, node=node)
34
+
35
+ @wraps(app)
36
+ @hydra.main(version_base=None, config_name=config_name)
37
+ def inner_app(cfg: object) -> None:
38
+ hydraflow.set_experiment()
39
+
40
+ if force_new_run:
41
+ run = None
42
+ else:
43
+ rc = hydraflow.search_runs()
44
+ run = rc.try_get(cfg, override=True)
45
+
46
+ if skip_finished and run and run.info.status == FINISHED:
47
+ return
48
+
49
+ with hydraflow.start_run(cfg, run=run, chdir=chdir) as run:
50
+ app(run, cfg)
51
+
52
+ return inner_app
53
+
54
+ return decorator
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hydraflow
3
- Version: 0.7.0
3
+ Version: 0.7.3
4
4
  Summary: Hydraflow integrates Hydra and MLflow to manage and track machine learning experiments.
5
5
  Project-URL: Documentation, https://daizutabi.github.io/hydraflow/
6
6
  Project-URL: Source, https://github.com/daizutabi/hydraflow
@@ -1,6 +1,7 @@
1
- hydraflow/__init__.py,sha256=VPIPNNCyjMAkWBbdvB7Ltwe3QWoc2FwuqkV8uJM5JoM,809
1
+ hydraflow/__init__.py,sha256=rujOGabEPPhPfyqTHynem3unqIEQ1haTWWSMuu2LuoQ,898
2
2
  hydraflow/config.py,sha256=MNX9da5bPVDcjnpji7Cm9ndK6ura92pt361m4PRh6_E,4326
3
3
  hydraflow/context.py,sha256=3xfKhMozkKFqtWeOp9Gie0A5o5URMta4US6iVD5TcLU,6002
4
+ hydraflow/main.py,sha256=hroncI_SNpNgEtdxLgzI397J5S2Amv7J0atnPxwBePM,1314
4
5
  hydraflow/mlflow.py,sha256=imD3XL0RTlpnKrkyvO8FNy_Bv6hwSfLiOu1yJuL40ck,8773
5
6
  hydraflow/param.py,sha256=yu1aMNXRLegXGDL-68vwIkfeDF9CaU784WZENGLwl7Q,4572
6
7
  hydraflow/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -8,7 +9,7 @@ hydraflow/run_collection.py,sha256=YCWg5Dz1j49xB2LA75onq5wsAeQQbifXpG4yPUwRN4I,2
8
9
  hydraflow/run_data.py,sha256=dpyyfnuH9mCtIZeigMo1iFQo9bafMdEL4i4uI2l0UqY,1525
9
10
  hydraflow/run_info.py,sha256=Jf5wrIjRLIV1-k-obHDqwKHa6j_ZonrY8od-rXlbtMo,1024
10
11
  hydraflow/utils.py,sha256=a9i5PEJn8Ssowv9dqHadAihZXlsqtVjHZ9MZvkPq1bY,4747
11
- hydraflow-0.7.0.dist-info/METADATA,sha256=hfKlxd1X1BKemmK_ph-ylWe4JaBCSw5SnXxK4MIKBN0,4700
12
- hydraflow-0.7.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
13
- hydraflow-0.7.0.dist-info/licenses/LICENSE,sha256=IGdDrBPqz1O0v_UwCW-NJlbX9Hy9b3uJ11t28y2srmY,1062
14
- hydraflow-0.7.0.dist-info/RECORD,,
12
+ hydraflow-0.7.3.dist-info/METADATA,sha256=KjVoai7-XIgkZGrDe-wHJYVHxba9NxewwdswDmRHvpI,4700
13
+ hydraflow-0.7.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
14
+ hydraflow-0.7.3.dist-info/licenses/LICENSE,sha256=IGdDrBPqz1O0v_UwCW-NJlbX9Hy9b3uJ11t28y2srmY,1062
15
+ hydraflow-0.7.3.dist-info/RECORD,,