hydraflow 0.10.2__py3-none-any.whl → 0.11.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.
@@ -5,9 +5,9 @@ from dataclasses import dataclass, field
5
5
 
6
6
  @dataclass
7
7
  class Step:
8
- args: str = ""
9
8
  batch: str = ""
10
- options: str = ""
9
+ args: str = ""
10
+ configs: str = ""
11
11
 
12
12
 
13
13
  @dataclass
@@ -15,6 +15,7 @@ class Job:
15
15
  name: str = ""
16
16
  run: str = ""
17
17
  call: str = ""
18
+ configs: str = ""
18
19
  steps: list[Step] = field(default_factory=list)
19
20
 
20
21
 
hydraflow/executor/job.py CHANGED
@@ -12,7 +12,7 @@ The module supports two execution modes:
12
12
  2. Python function calls
13
13
 
14
14
  Each job can consist of multiple steps, and each step can have its own
15
- arguments and options that will be expanded into multiple runs.
15
+ arguments and configurations that will be expanded into multiple runs.
16
16
  """
17
17
 
18
18
  from __future__ import annotations
@@ -31,27 +31,27 @@ from .parser import collect, expand
31
31
  if TYPE_CHECKING:
32
32
  from collections.abc import Iterator
33
33
 
34
- from .conf import Job, Step
34
+ from .conf import Job
35
35
 
36
36
 
37
- def iter_args(step: Step) -> Iterator[list[str]]:
37
+ def iter_args(batch: str, args: str) -> Iterator[list[str]]:
38
38
  """Iterate over combinations generated from parsed arguments.
39
39
 
40
40
  Generate all possible combinations of arguments by parsing and
41
41
  expanding each one, yielding them as an iterator.
42
42
 
43
43
  Args:
44
- step (Step): The step to parse.
44
+ batch (str): The batch to parse.
45
+ args (str): The arguments to parse.
45
46
 
46
47
  Yields:
47
48
  list[str]: a list of the parsed argument combinations.
48
49
 
49
50
  """
50
- args = collect(step.args)
51
- options = [o for o in step.options.split(" ") if o]
51
+ args_ = collect(args)
52
52
 
53
- for batch in expand(step.batch):
54
- yield [*options, *sorted([*batch, *args])]
53
+ for batch_ in expand(batch):
54
+ yield [*batch_, *args_]
55
55
 
56
56
 
57
57
  def iter_batches(job: Job) -> Iterator[list[str]]:
@@ -69,11 +69,14 @@ def iter_batches(job: Job) -> Iterator[list[str]]:
69
69
 
70
70
  """
71
71
  job_name = f"hydra.job.name={job.name}"
72
+ job_configs = shlex.split(job.configs)
72
73
 
73
74
  for step in job.steps:
74
- for args in iter_args(step):
75
+ configs = shlex.split(step.configs) or job_configs
76
+
77
+ for args in iter_args(step.batch, step.args):
75
78
  sweep_dir = f"hydra.sweep.dir=multirun/{ulid.ULID()}"
76
- yield ["--multirun", sweep_dir, job_name, *args]
79
+ yield ["--multirun", *args, job_name, sweep_dir, *configs]
77
80
 
78
81
 
79
82
  def multirun(job: Job) -> None:
@@ -162,4 +165,4 @@ def to_text(job: Job) -> str:
162
165
  for args in it:
163
166
  text += f"args: {args}\n"
164
167
 
165
- return text
168
+ return text.rstrip()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hydraflow
3
- Version: 0.10.2
3
+ Version: 0.11.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
@@ -13,12 +13,12 @@ hydraflow/entities/run_collection.py,sha256=E8IRBgxCnJE_IPCaSmS2mc9GtDXXLBfc7GHv
13
13
  hydraflow/entities/run_data.py,sha256=Y2_Lc-BdQ7nXhcEIjdHGHIkLrXsmAktOftESEwYOY8o,1602
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=q_FrPXQJCVGKS1FYnGRGqTUgMQeMBkaVPW2mtQc8oxk,384
16
+ hydraflow/executor/conf.py,sha256=SJNiQ87MXMlpDfdm0POcv55MY3GS5FUh5wT7u3XU3oU,406
17
17
  hydraflow/executor/io.py,sha256=xV3m-nV9eKbu9Fb7u04J2bfmR_Ky3jTEJjq4QC2m6V4,954
18
- hydraflow/executor/job.py,sha256=YZ9JuVrdAcG3_HvNngHy9NL4-3bjJTaColE_5efF8TU,4743
18
+ hydraflow/executor/job.py,sha256=yiVbAYgsZZtSTRER-H5pUopULeygzPNzKlSkl27yFI4,4856
19
19
  hydraflow/executor/parser.py,sha256=MO8VU0uVQZeku6kbw8Urid_5QEcnR8atd5h-yDP5OhQ,10147
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,,
20
+ hydraflow-0.11.0.dist-info/METADATA,sha256=MIDZ7Vec2SDAcj0S1SvghtlN5RQTpfR1N3MLlwoLD9A,4574
21
+ hydraflow-0.11.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
22
+ hydraflow-0.11.0.dist-info/entry_points.txt,sha256=XI0khPbpCIUo9UPqkNEpgh-kqK3Jy8T7L2VCWOdkbSM,48
23
+ hydraflow-0.11.0.dist-info/licenses/LICENSE,sha256=IGdDrBPqz1O0v_UwCW-NJlbX9Hy9b3uJ11t28y2srmY,1062
24
+ hydraflow-0.11.0.dist-info/RECORD,,