Commit 25fa707
authored
feat: Enhance process_systems to recursively search all paths in systems list (#5033)
### Description
This PR modifies the `process_systems` utility function to change how it
handles list inputs.
Previously, if the `systems` argument was a `str`, the function would
recursively search that path for systems. However, if `systems` was a
`list`, the function would return the list as-is, assuming it was
already a complete list of system paths.
This update unifies the logic. The function now treats *every* string
path—whether it's a single `str` input or an item within a `list`—as a
directory to be recursively searched. It also refactors the internal
logic to first normalize the input into a list of paths and then process
them uniformly, improving code clarity and maintainability.
### Motivation and Justification
The original implementation's inconsistent handling of `str` versus
`list` inputs caused two significant problems:
1. **Broken JSON Configurations:** A very common use case, specifying a
single data directory in `input.json` like `"systems":
["/path/to/training_data"]`, would fail. The function would not search
inside `/path/to/training_data` for the actual system directories (e.g.,
`set.000`, `set.001`, etc.).
2. **Inability to Aggregate Data:** It was impossible for users to
combine multiple datasets by providing a list of top-level directories,
such as `"systems": ["/path/to/dataset_A", "/path/to/dataset_B"]`.
This change solves both problems by ensuring that paths provided in a
list are searched recursively, just as a single string path would be.
### Benefits
* **Fixes Bug:** Correctly processes the common configuration of a
single-item list in `input.json`.
* **Enables Data Aggregation:** Users can now successfully provide a
list of multiple data directories to be searched and combined.
* **Improves Consistency:** The function's behavior is now intuitive and
consistent, regardless of whether the user provides a single `str` or a
`list[str]`.
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **Documentation**
* Clarified how training/validation system paths may be specified: a
single system directory or a parent directory to recursively discover
systems; lists of paths are explicitly supported and processed per-item.
* **Improvements**
* Input handling for system paths enhanced to accept multiple paths and
consolidate discovered systems, with expanded pattern-based discovery
for more flexible data input.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->1 parent 7778e2e commit 25fa707
3 files changed
Lines changed: 29 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2993 | 2993 | | |
2994 | 2994 | | |
2995 | 2995 | | |
2996 | | - | |
2997 | | - | |
| 2996 | + | |
| 2997 | + | |
| 2998 | + | |
2998 | 2999 | | |
2999 | 3000 | | |
3000 | 3001 | | |
| |||
3074 | 3075 | | |
3075 | 3076 | | |
3076 | 3077 | | |
3077 | | - | |
3078 | | - | |
| 3078 | + | |
| 3079 | + | |
| 3080 | + | |
3079 | 3081 | | |
3080 | 3082 | | |
3081 | 3083 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
790 | 790 | | |
791 | 791 | | |
792 | 792 | | |
| 793 | + | |
793 | 794 | | |
794 | 795 | | |
795 | 796 | | |
| |||
801 | 802 | | |
802 | 803 | | |
803 | 804 | | |
804 | | - | |
| 805 | + | |
805 | 806 | | |
806 | 807 | | |
| 808 | + | |
807 | 809 | | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
808 | 822 | | |
809 | | - | |
| 823 | + | |
810 | 824 | | |
811 | | - | |
812 | | - | |
813 | | - | |
814 | | - | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
815 | 830 | | |
816 | 831 | | |
817 | 832 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
79 | | - | |
80 | | - | |
| 79 | + | |
| 80 | + | |
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
| |||
0 commit comments