hydraflow 0.6.2__py3-none-any.whl → 0.7.0__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
@@ -286,105 +286,11 @@ class RunCollection:
286
286
  ),
287
287
  )
288
288
 
289
- def find(self, config: object | None = None, **kwargs) -> Run:
290
- """Find the first `Run` instance based on the provided configuration.
291
-
292
- This method filters the runs in the collection according to the
293
- specified configuration object and returns the first run that matches
294
- the provided parameters. If no run matches the criteria, a `ValueError`
295
- is raised.
296
-
297
- Args:
298
- config (object | None): The configuration object to identify the run.
299
- **kwargs: Additional key-value pairs to filter the runs.
300
-
301
- Returns:
302
- The first `Run` instance that matches the provided configuration.
303
-
304
- Raises:
305
- ValueError: If no run matches the criteria.
306
-
307
- See Also:
308
- `filter`: Perform the actual filtering logic.
309
-
310
- """
311
- try:
312
- return self.filter(config, **kwargs).first()
313
- except ValueError:
314
- raise ValueError("No run matches the provided configuration.")
315
-
316
- def try_find(self, config: object | None = None, **kwargs) -> Run | None:
317
- """Try to find the first `Run` instance based on the provided configuration.
318
-
319
- This method filters the runs in the collection according to the
320
- specified configuration object and returns the first run that matches
321
- the provided parameters. If no run matches the criteria, None is
322
- returned.
323
-
324
- Args:
325
- config (object | None): The configuration object to identify the run.
326
- **kwargs: Additional key-value pairs to filter the runs.
327
-
328
- Returns:
329
- The first `Run` instance that matches the provided configuration, or
330
- None if no runs match the criteria.
331
-
332
- See Also:
333
- `filter`: Perform the actual filtering logic.
334
-
335
- """
336
- return self.filter(config, **kwargs).try_first()
337
-
338
- def find_last(self, config: object | None = None, **kwargs) -> Run:
339
- """Find the last `Run` instance based on the provided configuration.
340
-
341
- This method filters the runs in the collection according to the
342
- specified configuration object and returns the last run that matches
343
- the provided parameters. If no run matches the criteria, a `ValueError`
344
- is raised.
345
-
346
- Args:
347
- config (object | None): The configuration object to identify the run.
348
- **kwargs: Additional key-value pairs to filter the runs.
349
-
350
- Returns:
351
- The last `Run` instance that matches the provided configuration.
352
-
353
- Raises:
354
- ValueError: If no run matches the criteria.
355
-
356
- See Also:
357
- `filter`: Perform the actual filtering logic.
358
-
359
- """
360
- try:
361
- return self.filter(config, **kwargs).last()
362
- except ValueError:
363
- raise ValueError("No run matches the provided configuration.")
364
-
365
- def try_find_last(self, config: object | None = None, **kwargs) -> Run | None:
366
- """Try to find the last `Run` instance based on the provided configuration.
367
-
368
- This method filters the runs in the collection according to the
369
- specified configuration object and returns the last run that matches
370
- the provided parameters. If no run matches the criteria, None is
371
- returned.
372
-
373
- Args:
374
- config (object | None): The configuration object to identify the run.
375
- **kwargs: Additional key-value pairs to filter the runs.
376
-
377
- Returns:
378
- The last `Run` instance that matches the provided configuration, or
379
- None if no runs match the criteria.
380
-
381
- See Also:
382
- `filter`: Perform the actual filtering logic.
383
-
384
- """
385
- return self.filter(config, **kwargs).try_last()
386
-
387
- def get(self, config: object | None = None, **kwargs) -> Run:
289
+ def get(
290
+ self,
291
+ config: object | Callable[[Run], bool] | None = None,
292
+ **kwargs,
293
+ ) -> Run:
388
294
  """Retrieve a specific `Run` instance based on the provided configuration.
389
295
 
390
296
  This method filters the runs in the collection according to the
@@ -393,7 +299,10 @@ class RunCollection:
393
299
  one run matches the criteria, a `ValueError` is raised.
394
300
 
395
301
  Args:
396
- config (object | None): The configuration object to identify the run.
302
+ config (object | Callable[[Run], bool] | None): The configuration object
303
+ to identify the run. This can be any object that provides key-value
304
+ pairs through the `iter_params` function, or a callable that
305
+ takes a `Run` object and returns a boolean value.
397
306
  **kwargs: Additional key-value pairs to filter the runs.
398
307
 
399
308
  Returns:
@@ -413,7 +322,11 @@ class RunCollection:
413
322
  msg = "The filtered collection does not contain exactly one run."
414
323
  raise ValueError(msg)
415
324
 
416
- def try_get(self, config: object | None = None, **kwargs) -> Run | None:
325
+ def try_get(
326
+ self,
327
+ config: object | Callable[[Run], bool] | None = None,
328
+ **kwargs,
329
+ ) -> Run | None:
417
330
  """Try to get a specific `Run` instance based on the provided configuration.
418
331
 
419
332
  This method filters the runs in the collection according to the
@@ -422,7 +335,10 @@ class RunCollection:
422
335
  If more than one run matches the criteria, a `ValueError` is raised.
423
336
 
424
337
  Args:
425
- config (object | None): The configuration object to identify the run.
338
+ config (object | Callable[[Run], bool] | None): The configuration object
339
+ to identify the run. This can be any object that provides key-value
340
+ pairs through the `iter_params` function, or a callable that
341
+ takes a `Run` object and returns a boolean value.
426
342
  **kwargs: Additional key-value pairs to filter the runs.
427
343
 
428
344
  Returns:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hydraflow
3
- Version: 0.6.2
3
+ Version: 0.7.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
@@ -4,11 +4,11 @@ hydraflow/context.py,sha256=3xfKhMozkKFqtWeOp9Gie0A5o5URMta4US6iVD5TcLU,6002
4
4
  hydraflow/mlflow.py,sha256=imD3XL0RTlpnKrkyvO8FNy_Bv6hwSfLiOu1yJuL40ck,8773
5
5
  hydraflow/param.py,sha256=yu1aMNXRLegXGDL-68vwIkfeDF9CaU784WZENGLwl7Q,4572
6
6
  hydraflow/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
- hydraflow/run_collection.py,sha256=w_GZdc_6yviwzRWLndWDSWB4DKyGyA9di9d9UpkkLZo,27926
7
+ hydraflow/run_collection.py,sha256=YCWg5Dz1j49xB2LA75onq5wsAeQQbifXpG4yPUwRN4I,24776
8
8
  hydraflow/run_data.py,sha256=dpyyfnuH9mCtIZeigMo1iFQo9bafMdEL4i4uI2l0UqY,1525
9
9
  hydraflow/run_info.py,sha256=Jf5wrIjRLIV1-k-obHDqwKHa6j_ZonrY8od-rXlbtMo,1024
10
10
  hydraflow/utils.py,sha256=a9i5PEJn8Ssowv9dqHadAihZXlsqtVjHZ9MZvkPq1bY,4747
11
- hydraflow-0.6.2.dist-info/METADATA,sha256=9a3blsQ91rNP1Ql4kFDc7tZxDMbdK5PzEAfP9ZyUY6A,4700
12
- hydraflow-0.6.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
13
- hydraflow-0.6.2.dist-info/licenses/LICENSE,sha256=IGdDrBPqz1O0v_UwCW-NJlbX9Hy9b3uJ11t28y2srmY,1062
14
- hydraflow-0.6.2.dist-info/RECORD,,
11
+ hydraflow-0.7.0.dist-info/METADATA,sha256=hfKlxd1X1BKemmK_ph-ylWe4JaBCSw5SnXxK4MIKBN0,4700
12
+ hydraflow-0.7.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
13
+ hydraflow-0.7.0.dist-info/licenses/LICENSE,sha256=IGdDrBPqz1O0v_UwCW-NJlbX9Hy9b3uJ11t28y2srmY,1062
14
+ hydraflow-0.7.0.dist-info/RECORD,,