hydraflow 0.13.0__py3-none-any.whl → 0.14.0__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 CHANGED
@@ -3,14 +3,15 @@
3
3
  from __future__ import annotations
4
4
 
5
5
  import shlex
6
- from typing import Annotated
6
+ from typing import TYPE_CHECKING, Annotated
7
7
 
8
8
  import typer
9
- from rich.console import Console
10
- from typer import Argument, Option
9
+ from typer import Argument, Exit, Option
10
+
11
+ if TYPE_CHECKING:
12
+ from hydraflow.executor.conf import Job
11
13
 
12
14
  app = typer.Typer(add_completion=False)
13
- console = Console()
14
15
 
15
16
 
16
17
  @app.command(context_settings={"ignore_unknown_options": True})
@@ -33,6 +34,10 @@ def run(
33
34
  args = args or []
34
35
  job = get_job(name)
35
36
 
37
+ if job.submit:
38
+ submit(job, args, dry_run=dry_run)
39
+ raise Exit
40
+
36
41
  if job.run:
37
42
  args = [*shlex.split(job.run), *args]
38
43
  it = iter_runs(args, iter_batches(job), dry_run=dry_run)
@@ -41,7 +46,7 @@ def run(
41
46
  it = iter_calls(args, iter_batches(job), dry_run=dry_run)
42
47
  else:
43
48
  typer.echo(f"No command found in job: {job.name}.")
44
- raise typer.Exit(1)
49
+ raise Exit(1)
45
50
 
46
51
  if not dry_run:
47
52
  import mlflow
@@ -57,36 +62,16 @@ def run(
57
62
  typer.echo(f"{funcname}([{arg}])")
58
63
 
59
64
 
60
- @app.command(context_settings={"ignore_unknown_options": True})
61
- def submit(
62
- name: Annotated[str, Argument(help="Job name.", show_default=False)],
63
- *,
64
- args: Annotated[
65
- list[str] | None,
66
- Argument(help="Arguments to pass to the job.", show_default=False),
67
- ] = None,
68
- dry_run: Annotated[
69
- bool,
70
- Option("--dry-run", help="Perform a dry run."),
71
- ] = False,
72
- ) -> None:
65
+ def submit(job: Job, args: list[str], *, dry_run: bool) -> None:
73
66
  """Submit a job."""
74
- from hydraflow.executor.io import get_job
75
67
  from hydraflow.executor.job import iter_batches, submit
76
68
 
77
- args = args or []
78
- job = get_job(name)
79
-
80
- if not job.run:
81
- typer.echo(f"No run found in job: {job.name}.")
82
- raise typer.Exit(1)
83
-
84
69
  if not dry_run:
85
70
  import mlflow
86
71
 
87
72
  mlflow.set_experiment(job.name)
88
73
 
89
- args = [*shlex.split(job.run), *args]
74
+ args = [*shlex.split(job.submit), *args]
90
75
  result = submit(args, iter_batches(job), dry_run=dry_run)
91
76
 
92
77
  if dry_run and isinstance(result, tuple):
@@ -124,4 +109,4 @@ def callback(
124
109
  import importlib.metadata
125
110
 
126
111
  typer.echo(f"hydraflow {importlib.metadata.version('hydraflow')}")
127
- raise typer.Exit
112
+ raise Exit
@@ -15,6 +15,7 @@ class Job:
15
15
  name: str = ""
16
16
  run: str = ""
17
17
  call: str = ""
18
+ submit: str = ""
18
19
  with_: str = ""
19
20
  steps: list[Step] = field(default_factory=list)
20
21
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hydraflow
3
- Version: 0.13.0
3
+ Version: 0.14.0
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
@@ -38,10 +38,9 @@ Classifier: Programming Language :: Python :: 3.13
38
38
  Requires-Python: >=3.10
39
39
  Requires-Dist: hydra-core>=1.3
40
40
  Requires-Dist: mlflow>=2.15
41
- Requires-Dist: omegaconf
41
+ Requires-Dist: omegaconf>=2.3
42
42
  Requires-Dist: python-ulid>=3.0.0
43
- Requires-Dist: rich
44
- Requires-Dist: typer
43
+ Requires-Dist: typer>=0.15
45
44
  Description-Content-Type: text/markdown
46
45
 
47
46
  # Hydraflow
@@ -1,5 +1,5 @@
1
1
  hydraflow/__init__.py,sha256=f2KO2iF7um-nNmayNyEr7TWG4UICOXy7YAN1d3qu0OY,936
2
- hydraflow/cli.py,sha256=nGFrZeQnn1h7lCbVhjBJwdrcDDGoqYpVFbqqwkLMzng,3385
2
+ hydraflow/cli.py,sha256=LrRHXiYln1OcH27Bf3Xf-5sesLl-eVV3YS8ZFJFpWa0,2942
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
@@ -13,12 +13,12 @@ hydraflow/entities/run_collection.py,sha256=4sfZWXaS7kqnVCo9GyB3pN6BaSUCkA-ZqSSl
13
13
  hydraflow/entities/run_data.py,sha256=lz8HPxG0iz1Jf9FU6HTFW4gcAc3N2pgMyAPqAIK6I74,1644
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
- hydraflow/executor/conf.py,sha256=2dv6_PlsynRmia-fGZlmBEVt8GopT0f32N13qY7tYnM,402
16
+ hydraflow/executor/conf.py,sha256=icGbLDh86KgkyiGXwDoEkmZpgAP3X8Jmu_PYqJoTooY,423
17
17
  hydraflow/executor/io.py,sha256=yZMcBVmAbPZZ82cAXhgiJfj9p8WvHmzOCMBg_vtEVek,1509
18
18
  hydraflow/executor/job.py,sha256=bmjlqE-cE7lyNFFKj1nUhxiQHKf7DsFkCSTD9iTEQ5I,5606
19
19
  hydraflow/executor/parser.py,sha256=_Rfund3FDgrXitTt_znsTpgEtMDqZ_ICynaB_Zje14Q,14561
20
- hydraflow-0.13.0.dist-info/METADATA,sha256=DcBL4IuQHdGIyEXTqFoDGlUdI2sgH0THpTuyFoB3Wg0,4549
21
- hydraflow-0.13.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
22
- hydraflow-0.13.0.dist-info/entry_points.txt,sha256=XI0khPbpCIUo9UPqkNEpgh-kqK3Jy8T7L2VCWOdkbSM,48
23
- hydraflow-0.13.0.dist-info/licenses/LICENSE,sha256=IGdDrBPqz1O0v_UwCW-NJlbX9Hy9b3uJ11t28y2srmY,1062
24
- hydraflow-0.13.0.dist-info/RECORD,,
20
+ hydraflow-0.14.0.dist-info/METADATA,sha256=8u8nSvKmLBhIfw4QWX9DpfC56wbb0_Dnhg1WTjBwazw,4540
21
+ hydraflow-0.14.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
22
+ hydraflow-0.14.0.dist-info/entry_points.txt,sha256=XI0khPbpCIUo9UPqkNEpgh-kqK3Jy8T7L2VCWOdkbSM,48
23
+ hydraflow-0.14.0.dist-info/licenses/LICENSE,sha256=IGdDrBPqz1O0v_UwCW-NJlbX9Hy9b3uJ11t28y2srmY,1062
24
+ hydraflow-0.14.0.dist-info/RECORD,,