hydraflow 0.4.2__py3-none-any.whl → 0.4.4__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
hydraflow/context.py CHANGED
@@ -28,7 +28,7 @@ log = logging.getLogger(__name__)
28
28
 
29
29
  @contextmanager
30
30
  def log_run(
31
- config: object,
31
+ config: object | None,
32
32
  *,
33
33
  synchronous: bool | None = None,
34
34
  ) -> Iterator[None]:
@@ -54,7 +54,8 @@ def log_run(
54
54
  ```
55
55
 
56
56
  """
57
- log_params(config, synchronous=synchronous)
57
+ if config:
58
+ log_params(config, synchronous=synchronous)
58
59
 
59
60
  hc = HydraConfig.get()
60
61
  output_dir = Path(hc.runtime.output_dir)
@@ -139,7 +140,7 @@ def start_run( # noqa: PLR0913
139
140
  description=description,
140
141
  log_system_metrics=log_system_metrics,
141
142
  ) as run,
142
- log_run(config, synchronous=synchronous),
143
+ log_run(config if run_id is None else None, synchronous=synchronous),
143
144
  ):
144
145
  yield run
145
146
 
@@ -98,6 +98,32 @@ class RunCollection:
98
98
  def __bool__(self) -> bool:
99
99
  return bool(self._runs)
100
100
 
101
+ def __add__(self, other: RunCollection) -> RunCollection:
102
+ """Add another `RunCollection` to this one.
103
+
104
+ Args:
105
+ other (RunCollection): The `RunCollection` to add.
106
+
107
+ Returns:
108
+ A new `RunCollection` instance with the runs from both collections.
109
+
110
+ """
111
+ return self.__class__(self._runs + other._runs)
112
+
113
+ def __sub__(self, other: RunCollection) -> RunCollection:
114
+ """Subtract another `RunCollection` from this one.
115
+
116
+ Args:
117
+ other (RunCollection): The `RunCollection` to subtract.
118
+
119
+ Returns:
120
+ A new `RunCollection` instance with the runs that are in this collection
121
+ but not in the other.
122
+
123
+ """
124
+ runs = [run for run in self._runs if run not in other._runs] # noqa: SLF001
125
+ return self.__class__(runs)
126
+
101
127
  @classmethod
102
128
  def from_list(cls, runs: list[Run]) -> RunCollection:
103
129
  """Create a `RunCollection` instance from a list of MLflow `Run` instances."""
@@ -1,12 +1,12 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: hydraflow
3
- Version: 0.4.2
3
+ Version: 0.4.4
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
7
7
  Project-URL: Issues, https://github.com/daizutabi/hydraflow/issues
8
8
  Author-email: daizutabi <daizutabi@gmail.com>
9
- License-Expression: MIT
9
+ License: MIT
10
10
  License-File: LICENSE
11
11
  Classifier: Development Status :: 4 - Beta
12
12
  Classifier: Programming Language :: Python
@@ -1,16 +1,16 @@
1
1
  hydraflow/__init__.py,sha256=VbrHKs2Cg93QJ8K9WHYxkXmzOpb8o9ugiwV-mXDT0JE,908
2
2
  hydraflow/asyncio.py,sha256=-i1C8KAmNDImrjHnk92Csaa1mpjdK8Vp4ZVaQV-l94s,6634
3
3
  hydraflow/config.py,sha256=MNX9da5bPVDcjnpji7Cm9ndK6ura92pt361m4PRh6_E,4326
4
- hydraflow/context.py,sha256=a6bHmiY16hZ1wvzVzoa7eGDBFjz0GX0iuZNG0EW0wkE,8764
4
+ hydraflow/context.py,sha256=oLjXJMtRna9fDX5Llxv2eYkL2ppKfJ-nr3dz-Phka2k,8818
5
5
  hydraflow/mlflow.py,sha256=kWVK_Xw2hkRnTg33jSP3VW13UZF6_hBGhN52mPmLgvk,8753
6
6
  hydraflow/param.py,sha256=c5sc6NwD6DKwZzVwprXzZD5FSi6qRgSHkc6TXBKQEdg,4502
7
7
  hydraflow/progress.py,sha256=zvKX1HCN8_xDOsgYOEcLLhkhdPdep-U8vHrc0XZ-6SQ,6163
8
8
  hydraflow/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
- hydraflow/run_collection.py,sha256=zO7OARn0QOGeK3FQH8GnuuDKCnYFqn1fbsKnOuGCa9M,25938
9
+ hydraflow/run_collection.py,sha256=eBNGwtvkRKpOEqcwDUS1tkIFuxY_PVi6SEzzd1PwG5s,26774
10
10
  hydraflow/run_data.py,sha256=qeFX1iRvNAorXA9QQIjzr0o2_82TI44eZKp7llKG8GI,1549
11
11
  hydraflow/run_info.py,sha256=sMXOo20ClaRIommMEzuAbO_OrcXx7M1Yt4FMV7spxz0,998
12
12
  hydraflow/utils.py,sha256=Xq78F2iOkgi9JnCYfX1reQw_Y9K6o8oNYBDEwrf18cI,3552
13
- hydraflow-0.4.2.dist-info/METADATA,sha256=YFnNdasT6OaEKeQy8Uw7AH3uZ5ecjbDjvXSsclhvoJc,3840
14
- hydraflow-0.4.2.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
15
- hydraflow-0.4.2.dist-info/licenses/LICENSE,sha256=IGdDrBPqz1O0v_UwCW-NJlbX9Hy9b3uJ11t28y2srmY,1062
16
- hydraflow-0.4.2.dist-info/RECORD,,
13
+ hydraflow-0.4.4.dist-info/METADATA,sha256=eWPV912uKomuPfI4v3F7GBuBdGXDzj3qyKrXr1-7tiI,3829
14
+ hydraflow-0.4.4.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
15
+ hydraflow-0.4.4.dist-info/licenses/LICENSE,sha256=IGdDrBPqz1O0v_UwCW-NJlbX9Hy9b3uJ11t28y2srmY,1062
16
+ hydraflow-0.4.4.dist-info/RECORD,,