hydraflow 0.13.1__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,11 +3,14 @@
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
9
  from typer import Argument, Exit, Option
10
10
 
11
+ if TYPE_CHECKING:
12
+ from hydraflow.executor.conf import Job
13
+
11
14
  app = typer.Typer(add_completion=False)
12
15
 
13
16
 
@@ -31,6 +34,10 @@ def run(
31
34
  args = args or []
32
35
  job = get_job(name)
33
36
 
37
+ if job.submit:
38
+ submit(job, args, dry_run=dry_run)
39
+ raise Exit
40
+
34
41
  if job.run:
35
42
  args = [*shlex.split(job.run), *args]
36
43
  it = iter_runs(args, iter_batches(job), dry_run=dry_run)
@@ -55,36 +62,16 @@ def run(
55
62
  typer.echo(f"{funcname}([{arg}])")
56
63
 
57
64
 
58
- @app.command(context_settings={"ignore_unknown_options": True})
59
- def submit(
60
- name: Annotated[str, Argument(help="Job name.", show_default=False)],
61
- *,
62
- args: Annotated[
63
- list[str] | None,
64
- Argument(help="Arguments to pass to the job.", show_default=False),
65
- ] = None,
66
- dry_run: Annotated[
67
- bool,
68
- Option("--dry-run", help="Perform a dry run."),
69
- ] = False,
70
- ) -> None:
65
+ def submit(job: Job, args: list[str], *, dry_run: bool) -> None:
71
66
  """Submit a job."""
72
- from hydraflow.executor.io import get_job
73
67
  from hydraflow.executor.job import iter_batches, submit
74
68
 
75
- args = args or []
76
- job = get_job(name)
77
-
78
- if not job.run:
79
- typer.echo(f"No run found in job: {job.name}.")
80
- raise Exit(1)
81
-
82
69
  if not dry_run:
83
70
  import mlflow
84
71
 
85
72
  mlflow.set_experiment(job.name)
86
73
 
87
- args = [*shlex.split(job.run), *args]
74
+ args = [*shlex.split(job.submit), *args]
88
75
  result = submit(args, iter_batches(job), dry_run=dry_run)
89
76
 
90
77
  if dry_run and isinstance(result, tuple):
@@ -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.1
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
@@ -1,5 +1,5 @@
1
1
  hydraflow/__init__.py,sha256=f2KO2iF7um-nNmayNyEr7TWG4UICOXy7YAN1d3qu0OY,936
2
- hydraflow/cli.py,sha256=DaxOfB2gGajFB4--USZL1QkH7j1MAgD2q0bjYmT09HU,3320
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.1.dist-info/METADATA,sha256=oDGZBZVuwfEnOa2p2ciybUVqUAKFmq7OToTvXjZ4W_o,4540
21
- hydraflow-0.13.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
22
- hydraflow-0.13.1.dist-info/entry_points.txt,sha256=XI0khPbpCIUo9UPqkNEpgh-kqK3Jy8T7L2VCWOdkbSM,48
23
- hydraflow-0.13.1.dist-info/licenses/LICENSE,sha256=IGdDrBPqz1O0v_UwCW-NJlbX9Hy9b3uJ11t28y2srmY,1062
24
- hydraflow-0.13.1.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,,