hydraflow 0.10.1__py3-none-any.whl → 0.10.2__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/cli.py +22 -23
- hydraflow/executor/io.py +15 -0
- hydraflow/executor/job.py +16 -6
- {hydraflow-0.10.1.dist-info → hydraflow-0.10.2.dist-info}/METADATA +1 -1
- {hydraflow-0.10.1.dist-info → hydraflow-0.10.2.dist-info}/RECORD +8 -8
- {hydraflow-0.10.1.dist-info → hydraflow-0.10.2.dist-info}/WHEEL +0 -0
- {hydraflow-0.10.1.dist-info → hydraflow-0.10.2.dist-info}/entry_points.txt +0 -0
- {hydraflow-0.10.1.dist-info → hydraflow-0.10.2.dist-info}/licenses/LICENSE +0 -0
hydraflow/cli.py
CHANGED
@@ -2,54 +2,53 @@
|
|
2
2
|
|
3
3
|
from __future__ import annotations
|
4
4
|
|
5
|
-
from typing import
|
5
|
+
from typing import Annotated
|
6
6
|
|
7
7
|
import typer
|
8
8
|
from rich.console import Console
|
9
9
|
from typer import Argument, Option
|
10
10
|
|
11
|
-
from hydraflow.executor.io import load_config
|
12
|
-
|
13
|
-
if TYPE_CHECKING:
|
14
|
-
from hydraflow.executor.job import Job
|
11
|
+
from hydraflow.executor.io import get_job, load_config
|
15
12
|
|
16
13
|
app = typer.Typer(add_completion=False)
|
17
14
|
console = Console()
|
18
15
|
|
19
16
|
|
20
|
-
def get_job(name: str) -> Job:
|
21
|
-
cfg = load_config()
|
22
|
-
job = cfg.jobs[name]
|
23
|
-
|
24
|
-
if not job.name:
|
25
|
-
job.name = name
|
26
|
-
|
27
|
-
return job
|
28
|
-
|
29
|
-
|
30
17
|
@app.command()
|
31
18
|
def run(
|
32
19
|
name: Annotated[str, Argument(help="Job name.", show_default=False)],
|
20
|
+
*,
|
21
|
+
dry_run: Annotated[
|
22
|
+
bool,
|
23
|
+
Option("--dry-run", help="Perform a dry run"),
|
24
|
+
] = False,
|
33
25
|
) -> None:
|
34
26
|
"""Run a job."""
|
35
27
|
import mlflow
|
36
28
|
|
37
|
-
from hydraflow.executor.job import multirun
|
29
|
+
from hydraflow.executor.job import multirun, to_text
|
38
30
|
|
39
31
|
job = get_job(name)
|
40
|
-
|
41
|
-
|
32
|
+
if dry_run:
|
33
|
+
typer.echo(to_text(job))
|
34
|
+
else:
|
35
|
+
mlflow.set_experiment(job.name)
|
36
|
+
multirun(job)
|
42
37
|
|
43
38
|
|
44
39
|
@app.command()
|
45
40
|
def show(
|
46
|
-
name: Annotated[str, Argument(help="Job name.", show_default=False)],
|
41
|
+
name: Annotated[str, Argument(help="Job name.", show_default=False)] = "",
|
47
42
|
) -> None:
|
48
|
-
"""Show
|
49
|
-
from
|
43
|
+
"""Show the hydraflow config."""
|
44
|
+
from omegaconf import OmegaConf
|
50
45
|
|
51
|
-
|
52
|
-
|
46
|
+
if name:
|
47
|
+
cfg = get_job(name)
|
48
|
+
else:
|
49
|
+
cfg = load_config()
|
50
|
+
|
51
|
+
typer.echo(OmegaConf.to_yaml(cfg))
|
53
52
|
|
54
53
|
|
55
54
|
@app.callback(invoke_without_command=True)
|
hydraflow/executor/io.py
CHANGED
@@ -3,11 +3,15 @@
|
|
3
3
|
from __future__ import annotations
|
4
4
|
|
5
5
|
from pathlib import Path
|
6
|
+
from typing import TYPE_CHECKING
|
6
7
|
|
7
8
|
from omegaconf import OmegaConf
|
8
9
|
|
9
10
|
from .conf import HydraflowConf
|
10
11
|
|
12
|
+
if TYPE_CHECKING:
|
13
|
+
from .job import Job
|
14
|
+
|
11
15
|
|
12
16
|
def find_config_file() -> Path | None:
|
13
17
|
"""Find the hydraflow config file."""
|
@@ -32,3 +36,14 @@ def load_config() -> HydraflowConf:
|
|
32
36
|
cfg = OmegaConf.load(path)
|
33
37
|
|
34
38
|
return OmegaConf.merge(schema, cfg) # type: ignore
|
39
|
+
|
40
|
+
|
41
|
+
def get_job(name: str) -> Job:
|
42
|
+
"""Get a job from the config."""
|
43
|
+
cfg = load_config()
|
44
|
+
job = cfg.jobs[name]
|
45
|
+
|
46
|
+
if not job.name:
|
47
|
+
job.name = name
|
48
|
+
|
49
|
+
return job
|
hydraflow/executor/job.py
CHANGED
@@ -20,6 +20,7 @@ from __future__ import annotations
|
|
20
20
|
import importlib
|
21
21
|
import shlex
|
22
22
|
import subprocess
|
23
|
+
import sys
|
23
24
|
from subprocess import CalledProcessError
|
24
25
|
from typing import TYPE_CHECKING
|
25
26
|
|
@@ -99,6 +100,8 @@ def multirun(job: Job) -> None:
|
|
99
100
|
|
100
101
|
if job.run:
|
101
102
|
base_cmds = shlex.split(job.run)
|
103
|
+
if base_cmds[0] == "python" and sys.platform == "win32":
|
104
|
+
base_cmds[0] = sys.executable
|
102
105
|
|
103
106
|
for args in it:
|
104
107
|
cmds = [*base_cmds, *args]
|
@@ -132,24 +135,31 @@ def multirun(job: Job) -> None:
|
|
132
135
|
raise RuntimeError(msg) from e
|
133
136
|
|
134
137
|
|
135
|
-
def
|
136
|
-
"""
|
138
|
+
def to_text(job: Job) -> str:
|
139
|
+
"""Convert the job configuration to a string.
|
137
140
|
|
138
|
-
This function
|
141
|
+
This function returns the job configuration for a given job.
|
139
142
|
|
140
143
|
Args:
|
141
144
|
job (Job): The job configuration to show.
|
142
145
|
|
146
|
+
Returns:
|
147
|
+
str: The job configuration.
|
148
|
+
|
143
149
|
"""
|
150
|
+
text = ""
|
151
|
+
|
144
152
|
it = iter_batches(job)
|
145
153
|
|
146
154
|
if job.run:
|
147
155
|
base_cmds = shlex.split(job.run)
|
148
156
|
for args in it:
|
149
157
|
cmds = " ".join([*base_cmds, *args])
|
150
|
-
|
158
|
+
text += f"{cmds}\n"
|
151
159
|
|
152
160
|
elif job.call:
|
153
|
-
|
161
|
+
text = f"call: {job.call}\n"
|
154
162
|
for args in it:
|
155
|
-
|
163
|
+
text += f"args: {args}\n"
|
164
|
+
|
165
|
+
return text
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: hydraflow
|
3
|
-
Version: 0.10.
|
3
|
+
Version: 0.10.2
|
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,5 +1,5 @@
|
|
1
1
|
hydraflow/__init__.py,sha256=f2KO2iF7um-nNmayNyEr7TWG4UICOXy7YAN1d3qu0OY,936
|
2
|
-
hydraflow/cli.py,sha256=
|
2
|
+
hydraflow/cli.py,sha256=b-M368amGUblOOqOi7JuBsnzLuaNqgpTit9ZRj0qqac,1410
|
3
3
|
hydraflow/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
4
4
|
hydraflow/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
5
5
|
hydraflow/core/config.py,sha256=SJzjgsO_kzB78_whJ3lmy7GlZvTvwZONH1BJBn8zCuI,3817
|
@@ -14,11 +14,11 @@ hydraflow/entities/run_data.py,sha256=Y2_Lc-BdQ7nXhcEIjdHGHIkLrXsmAktOftESEwYOY8
|
|
14
14
|
hydraflow/entities/run_info.py,sha256=FRC6ICOlzB2u_xi_33Qs-YZLt677UotuNbYqI7XSmHY,1017
|
15
15
|
hydraflow/executor/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
16
16
|
hydraflow/executor/conf.py,sha256=q_FrPXQJCVGKS1FYnGRGqTUgMQeMBkaVPW2mtQc8oxk,384
|
17
|
-
hydraflow/executor/io.py,sha256=
|
18
|
-
hydraflow/executor/job.py,sha256=
|
17
|
+
hydraflow/executor/io.py,sha256=xV3m-nV9eKbu9Fb7u04J2bfmR_Ky3jTEJjq4QC2m6V4,954
|
18
|
+
hydraflow/executor/job.py,sha256=YZ9JuVrdAcG3_HvNngHy9NL4-3bjJTaColE_5efF8TU,4743
|
19
19
|
hydraflow/executor/parser.py,sha256=MO8VU0uVQZeku6kbw8Urid_5QEcnR8atd5h-yDP5OhQ,10147
|
20
|
-
hydraflow-0.10.
|
21
|
-
hydraflow-0.10.
|
22
|
-
hydraflow-0.10.
|
23
|
-
hydraflow-0.10.
|
24
|
-
hydraflow-0.10.
|
20
|
+
hydraflow-0.10.2.dist-info/METADATA,sha256=BidbFHVOZjuNytZBhYAg9_T5OBkmu4VNprJJFxnCqPI,4574
|
21
|
+
hydraflow-0.10.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
22
|
+
hydraflow-0.10.2.dist-info/entry_points.txt,sha256=XI0khPbpCIUo9UPqkNEpgh-kqK3Jy8T7L2VCWOdkbSM,48
|
23
|
+
hydraflow-0.10.2.dist-info/licenses/LICENSE,sha256=IGdDrBPqz1O0v_UwCW-NJlbX9Hy9b3uJ11t28y2srmY,1062
|
24
|
+
hydraflow-0.10.2.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|