hydraflow 0.2.11__py3-none-any.whl → 0.2.13__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
hydraflow/mlflow.py CHANGED
@@ -22,6 +22,7 @@ from __future__ import annotations
22
22
  from pathlib import Path
23
23
  from typing import TYPE_CHECKING
24
24
 
25
+ import joblib
25
26
  import mlflow
26
27
  from hydra.core.hydra_config import HydraConfig
27
28
  from mlflow.entities import ViewType
@@ -146,7 +147,9 @@ def search_runs(
146
147
  return RunCollection(runs) # type: ignore
147
148
 
148
149
 
149
- def list_runs(experiment_names: list[str] | None = None) -> RunCollection:
150
+ def list_runs(
151
+ experiment_names: str | list[str] | None = None, n_jobs: int = 0
152
+ ) -> RunCollection:
150
153
  """
151
154
  List all runs for the specified experiments.
152
155
 
@@ -166,10 +169,33 @@ def list_runs(experiment_names: list[str] | None = None) -> RunCollection:
166
169
  the "Default" experiment.
167
170
 
168
171
  Returns:
169
- A `RunCollection` object containing the runs for the specified experiments.
172
+ RunCollection: A `RunCollection` instance containing the runs for the
173
+ specified experiments.
170
174
  """
171
- if experiment_names == []:
175
+ if isinstance(experiment_names, str):
176
+ experiment_names = [experiment_names]
177
+
178
+ elif experiment_names == []:
172
179
  experiments = mlflow.search_experiments()
173
180
  experiment_names = [e.name for e in experiments if e.name != "Default"]
174
181
 
175
- return search_runs(experiment_names=experiment_names)
182
+ if n_jobs == 0:
183
+ return search_runs(experiment_names=experiment_names)
184
+
185
+ if experiment_names is None:
186
+ raise NotImplementedError
187
+
188
+ run_ids = []
189
+
190
+ for name in experiment_names:
191
+ if experiment := mlflow.get_experiment_by_name(name):
192
+ loc = experiment.artifact_location
193
+
194
+ if isinstance(loc, str) and loc.startswith("file://"):
195
+ path = Path(mlflow.artifacts.download_artifacts(loc))
196
+ run_ids.extend(file.stem for file in path.iterdir() if file.is_dir())
197
+
198
+ it = (joblib.delayed(mlflow.get_run)(run_id) for run_id in run_ids)
199
+ runs = joblib.Parallel(n_jobs, prefer="threads")(it)
200
+ runs = sorted(runs, key=lambda run: run.info.start_time) # type: ignore
201
+ return RunCollection(runs) # type: ignore
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: hydraflow
3
- Version: 0.2.11
3
+ Version: 0.2.13
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
@@ -13,8 +13,6 @@ Classifier: Programming Language :: Python
13
13
  Classifier: Programming Language :: Python :: 3.10
14
14
  Classifier: Programming Language :: Python :: 3.11
15
15
  Classifier: Programming Language :: Python :: 3.12
16
- Classifier: Topic :: Documentation
17
- Classifier: Topic :: Software Development :: Documentation
18
16
  Requires-Python: >=3.10
19
17
  Requires-Dist: hydra-core>1.3
20
18
  Requires-Dist: joblib
@@ -3,10 +3,10 @@ hydraflow/asyncio.py,sha256=jdXuEFC6f7L_Dq6beASFZPQSvCnGimVxU-PRFsNc5U0,6241
3
3
  hydraflow/config.py,sha256=6TCKNQZ3sSrIEvl245T2udwFuknejyN1dMcIVmOHdrQ,2102
4
4
  hydraflow/context.py,sha256=G7JMrG70sgBH2qILXl5nkGWNUoRggj518JWUq0ZiJ9E,7776
5
5
  hydraflow/info.py,sha256=Vj2sT66Ric63mmaq7Yu8nDFhsGQYO3MCHrxFpapDufc,3458
6
- hydraflow/mlflow.py,sha256=Q8RGijSURTjRkEDxzi_2Tk9KOx3QK__al5aArGQriHA,7249
6
+ hydraflow/mlflow.py,sha256=QlJlhsOAJ3t9hcvQRUgeE5od6g1AbyFNYQIxkq1FCoM,8140
7
7
  hydraflow/progress.py,sha256=uaxS9UnwsikOPB_Ho-5mXdBYz3Zedj-SL9FzT094wjY,6623
8
8
  hydraflow/run_collection.py,sha256=V5lGdGHYgsSpBOYGaVEL1mpKJvdiEshBL0KmmZ8qeZo,29161
9
- hydraflow-0.2.11.dist-info/METADATA,sha256=skZKh1wvBJWSLXE7iB6q2Gv_NsegcuJQjmmv8KgFg8s,4182
10
- hydraflow-0.2.11.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
11
- hydraflow-0.2.11.dist-info/licenses/LICENSE,sha256=IGdDrBPqz1O0v_UwCW-NJlbX9Hy9b3uJ11t28y2srmY,1062
12
- hydraflow-0.2.11.dist-info/RECORD,,
9
+ hydraflow-0.2.13.dist-info/METADATA,sha256=DRWv1h7QW68HH7BGkyiMbIha1d-VlV95eO-X4PRj44U,4088
10
+ hydraflow-0.2.13.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
11
+ hydraflow-0.2.13.dist-info/licenses/LICENSE,sha256=IGdDrBPqz1O0v_UwCW-NJlbX9Hy9b3uJ11t28y2srmY,1062
12
+ hydraflow-0.2.13.dist-info/RECORD,,