hydraflow 0.4.4__py3-none-any.whl → 0.4.6__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
hydraflow/__init__.py CHANGED
@@ -11,6 +11,7 @@ from .utils import (
11
11
  get_overrides,
12
12
  load_config,
13
13
  load_overrides,
14
+ remove_run,
14
15
  )
15
16
 
16
17
  __all__ = [
@@ -26,6 +27,7 @@ __all__ = [
26
27
  "log_run",
27
28
  "multi_tasks_progress",
28
29
  "parallel_progress",
30
+ "remove_run",
29
31
  "search_runs",
30
32
  "select_config",
31
33
  "select_overrides",
hydraflow/context.py CHANGED
@@ -69,8 +69,9 @@ def log_run(
69
69
  mlflow.log_artifact(local_path)
70
70
 
71
71
  try:
72
- with watch(log_artifact, output_dir, ignore_log=False):
73
- yield
72
+ yield
73
+ # with watch(log_artifact, output_dir, ignore_log=False):
74
+ # yield
74
75
 
75
76
  except Exception as e:
76
77
  msg = f"Error during log_run: {e}"
hydraflow/utils.py CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
+ import shutil
5
6
  from pathlib import Path
6
7
  from typing import TYPE_CHECKING
7
8
 
@@ -9,11 +10,10 @@ import mlflow
9
10
  import mlflow.artifacts
10
11
  from hydra.core.hydra_config import HydraConfig
11
12
  from mlflow.entities import Run
12
- from mlflow.tracking import artifact_utils
13
13
  from omegaconf import DictConfig, OmegaConf
14
14
 
15
15
  if TYPE_CHECKING:
16
- from mlflow.entities import Run
16
+ from collections.abc import Iterable
17
17
 
18
18
 
19
19
  def get_artifact_dir(run: Run | None = None) -> Path:
@@ -28,10 +28,10 @@ def get_artifact_dir(run: Run | None = None) -> Path:
28
28
  The local path to the directory where the artifacts are downloaded.
29
29
 
30
30
  """
31
- if run is None:
32
- uri = mlflow.get_artifact_uri()
33
- else:
34
- uri = artifact_utils.get_artifact_uri(run.info.run_id)
31
+ uri = mlflow.get_artifact_uri() if run is None else run.info.artifact_uri
32
+
33
+ if not (isinstance(uri, str) and uri.startswith("file://")):
34
+ raise NotImplementedError
35
35
 
36
36
  return Path(mlflow.artifacts.download_artifacts(uri))
37
37
 
@@ -112,3 +112,13 @@ def load_overrides(run: Run) -> list[str]:
112
112
  """
113
113
  path = get_artifact_dir(run) / ".hydra/overrides.yaml"
114
114
  return [str(x) for x in OmegaConf.load(path)]
115
+
116
+
117
+ def remove_run(run: Run | Iterable[Run]) -> None:
118
+ """Remove the given run from the MLflow tracking server."""
119
+ if not isinstance(run, Run):
120
+ for r in run:
121
+ remove_run(r)
122
+ return
123
+
124
+ shutil.rmtree(get_artifact_dir(run).parent)
@@ -1,18 +1,40 @@
1
- Metadata-Version: 2.3
1
+ Metadata-Version: 2.4
2
2
  Name: hydraflow
3
- Version: 0.4.4
3
+ Version: 0.4.6
4
4
  Summary: Hydraflow integrates Hydra and MLflow to manage and track machine learning experiments.
5
5
  Project-URL: Documentation, https://github.com/daizutabi/hydraflow
6
6
  Project-URL: Source, https://github.com/daizutabi/hydraflow
7
7
  Project-URL: Issues, https://github.com/daizutabi/hydraflow/issues
8
8
  Author-email: daizutabi <daizutabi@gmail.com>
9
- License: MIT
9
+ License: MIT License
10
+
11
+ Copyright (c) 2024 Daizu
12
+
13
+ Permission is hereby granted, free of charge, to any person obtaining a copy
14
+ of this software and associated documentation files (the "Software"), to deal
15
+ in the Software without restriction, including without limitation the rights
16
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17
+ copies of the Software, and to permit persons to whom the Software is
18
+ furnished to do so, subject to the following conditions:
19
+
20
+ The above copyright notice and this permission notice shall be included in all
21
+ copies or substantial portions of the Software.
22
+
23
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29
+ SOFTWARE.
10
30
  License-File: LICENSE
11
31
  Classifier: Development Status :: 4 - Beta
32
+ Classifier: License :: OSI Approved :: MIT License
12
33
  Classifier: Programming Language :: Python
13
34
  Classifier: Programming Language :: Python :: 3.10
14
35
  Classifier: Programming Language :: Python :: 3.11
15
36
  Classifier: Programming Language :: Python :: 3.12
37
+ Classifier: Programming Language :: Python :: 3.13
16
38
  Requires-Python: >=3.10
17
39
  Requires-Dist: hydra-core>=1.3
18
40
  Requires-Dist: joblib
@@ -1,7 +1,7 @@
1
- hydraflow/__init__.py,sha256=VbrHKs2Cg93QJ8K9WHYxkXmzOpb8o9ugiwV-mXDT0JE,908
1
+ hydraflow/__init__.py,sha256=4wUu8HR__oM0lTUiIqxO7iP6ubLSfKI6y7_P9_RuYtA,942
2
2
  hydraflow/asyncio.py,sha256=-i1C8KAmNDImrjHnk92Csaa1mpjdK8Vp4ZVaQV-l94s,6634
3
3
  hydraflow/config.py,sha256=MNX9da5bPVDcjnpji7Cm9ndK6ura92pt361m4PRh6_E,4326
4
- hydraflow/context.py,sha256=oLjXJMtRna9fDX5Llxv2eYkL2ppKfJ-nr3dz-Phka2k,8818
4
+ hydraflow/context.py,sha256=kz5SvjvjN7Z_2WjHYpO9SWwDfsPT_UeZcsm8pDymhjs,8836
5
5
  hydraflow/mlflow.py,sha256=kWVK_Xw2hkRnTg33jSP3VW13UZF6_hBGhN52mPmLgvk,8753
6
6
  hydraflow/param.py,sha256=c5sc6NwD6DKwZzVwprXzZD5FSi6qRgSHkc6TXBKQEdg,4502
7
7
  hydraflow/progress.py,sha256=zvKX1HCN8_xDOsgYOEcLLhkhdPdep-U8vHrc0XZ-6SQ,6163
@@ -9,8 +9,8 @@ hydraflow/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
9
  hydraflow/run_collection.py,sha256=eBNGwtvkRKpOEqcwDUS1tkIFuxY_PVi6SEzzd1PwG5s,26774
10
10
  hydraflow/run_data.py,sha256=qeFX1iRvNAorXA9QQIjzr0o2_82TI44eZKp7llKG8GI,1549
11
11
  hydraflow/run_info.py,sha256=sMXOo20ClaRIommMEzuAbO_OrcXx7M1Yt4FMV7spxz0,998
12
- hydraflow/utils.py,sha256=Xq78F2iOkgi9JnCYfX1reQw_Y9K6o8oNYBDEwrf18cI,3552
13
- hydraflow-0.4.4.dist-info/METADATA,sha256=eWPV912uKomuPfI4v3F7GBuBdGXDzj3qyKrXr1-7tiI,3829
14
- hydraflow-0.4.4.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
15
- hydraflow-0.4.4.dist-info/licenses/LICENSE,sha256=IGdDrBPqz1O0v_UwCW-NJlbX9Hy9b3uJ11t28y2srmY,1062
16
- hydraflow-0.4.4.dist-info/RECORD,,
12
+ hydraflow/utils.py,sha256=jbNrbtIfMqxE4LrdTNd1g7sF68XgAvydGqW5iAZ6n-c,3834
13
+ hydraflow-0.4.6.dist-info/METADATA,sha256=s3eXM1oDcJVWj930b3c_9iKATXLoYZMMDmA9THkCdu8,5149
14
+ hydraflow-0.4.6.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
15
+ hydraflow-0.4.6.dist-info/licenses/LICENSE,sha256=IGdDrBPqz1O0v_UwCW-NJlbX9Hy9b3uJ11t28y2srmY,1062
16
+ hydraflow-0.4.6.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: hatchling 1.25.0
2
+ Generator: hatchling 1.27.0
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any