Warn and resolve conflict when both blocksize and files_per_partition are specified - #1508
Conversation
… are specified (NVIDIA-NeMo#1401) Signed-off-by: Arivunidhi A <arivunidhi.a@gmail.com>
Greptile SummaryThis PR fixes a bug (#1401) where specifying both The fix adds an early conflict resolution in
Confidence Score: 5/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["FilePartitioningStage.__post_init__()"] --> B{"Both files_per_partition\nand blocksize set?"}
B -->|Yes| C["Log warning\nSet blocksize = None"]
B -->|No| D["Continue initialization"]
C --> D
D --> E["process() called"]
E --> F{"blocksize is set?"}
F -->|Yes| G["_get_file_list_with_sizes()\nReturns list[tuple[str, int]]"]
F -->|No| H["_get_file_list()\nReturns list[str]"]
G --> I{"files_per_partition set?"}
H --> I
I -->|Yes| J["_partition_by_count(files)\nExpects list[str]"]
I -->|No| K{"blocksize set?"}
K -->|Yes| L["_partition_by_size(files)\nExpects list[tuple[str, int]]"]
K -->|No| M["Default: 1 file per partition"]
J --> N["Create FileGroupTasks"]
L --> N
M --> N
Last reviewed commit: 93a0d4b |
sarahyurick
left a comment
There was a problem hiding this comment.
Thanks @ArivunidhiA ! Added a request.
| assert len(task.data) == 1 | ||
| assert task.data[0] == test_files[i] | ||
|
|
||
| def test_both_blocksize_and_files_per_partition_warns(self): |
There was a problem hiding this comment.
Can you add a check to ensure that the warning was raised too?
There was a problem hiding this comment.
Added a caplog assertion to verify the warning is raised. Thanks for the review!
…warns Address review feedback: verify that the warning message is actually logged when both blocksize and files_per_partition are specified, using caplog fixture consistent with existing test patterns.
|
/ok to test 93a0d4b |
sarahyurick
left a comment
There was a problem hiding this comment.
LGTM, thank you @ArivunidhiA !
|
Thanks for the review, I appreciate it! |
… are specified (NVIDIA-NeMo#1508) * Warn and resolve conflict when both blocksize and files_per_partition are specified (NVIDIA-NeMo#1401) Signed-off-by: Arivunidhi A <arivunidhi.a@gmail.com> * Add warning assertion to test_both_blocksize_and_files_per_partition_warns Address review feedback: verify that the warning message is actually logged when both blocksize and files_per_partition are specified, using caplog fixture consistent with existing test patterns. --------- Signed-off-by: Arivunidhi A <arivunidhi.a@gmail.com> Co-authored-by: Arivunidhi A <arivunidhi.a@gmail.com> Signed-off-by: Omkar Kabde <omkarkabde@gmail.com>
Description
Closes #1401
When both
blocksizeandfiles_per_partitionare specified inFilePartitioningStage, the stage calls_get_file_list_with_sizes()(returninglist[tuple[str, int]]) but then passes the result to_partition_by_count()which expectslist[str], causing a confusingValueError: Invalid file path or buffer object type: <class 'tuple'>.This adds an early check in
__post_init__that logs a warning and setsblocksize = Nonewhen both are provided, sofiles_per_partitiontakes precedence cleanly.Usage
Checklist