Fix #367: reportgen crashes with AttributeError on Namespace.file#368
Open
idevasena wants to merge 2 commits into
Open
Fix #367: reportgen crashes with AttributeError on Namespace.file#368idevasena wants to merge 2 commits into
idevasena wants to merge 2 commits into
Conversation
…commands reports/history/lockfile subparsers do not call add_storage_type_arguments(), so their Namespace has no .file or .object attribute. The unconditional read and delete in parse_arguments() crashed with AttributeError. Gate the consolidation on attribute presence; downstream code already uses getattr(args, 'data_access_protocol', None). Fixes mlcommons#367 Signed-off-by: Devasena Inupakutika <devasena.i@samsung.com>
|
MLCommons CLA bot All contributors have signed the MLCommons CLA ✍️ ✅ |
FileSystemGuy
approved these changes
May 12, 2026
This was referenced May 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #367.
mlpstorage reports reportgen (and any other non-benchmark subcommand) crashed at startup with AttributeError: 'Namespace' object has no attribute 'file'. The CLI parser's data-access-protocol consolidation block read parsed_args.file and parsed_args.object unconditionally, but those attributes only exist on subcommands that call add_storage_type_arguments() — namely training, checkpointing, vectordb, and kvcache. The reports, history, and lockfile subcommands never define those flags, so their Namespace doesn't carry them.
This change guards the consolidation on attribute presence. Behavior on benchmark subcommands is preserved bit-for-bit; non-benchmark subcommands now parse cleanly and simply don't get a data_access_protocol attribute (downstream code already reads it via getattr(self.args, 'data_access_protocol', None) in
mlpstorage_py/benchmarks/dlio.py:136, so nothing else has to change).Regression context
The bug entered with commit
39e657d(PR #359, "Bug fixes and performance enhancements: object storage, checkpointing, Parquet loading"), which introduced the--file / --objectstorage-type flags and the consolidation block but didn't account for subparsers that don't opt into those flags.Root cause
In
mlpstorage_py/cli_parser.py, insideparse_arguments()afterparser.parse_args():Consolidate the data access protocol into a single field
A grep across the package confirms add_storage_type_arguments() (in mlpstorage_py/cli/common_args.py) is only invoked from training_args.py, checkpointing_args.py, vectordb_args.py, and kvcache_args.py. The reports, history, and lockfile subparsers never call it, so their parsed Namespace has no file or object attribute and the block above raises before any subcommand logic runs. The docstring of add_storage_type_arguments() already states the intended contract — benchmarks that don't use object storage "simply ignore the flags; those that do can check args.file / args.object" — but the parser's consolidation step didn't honor it.
Fix
Gate the consolidation block on attribute presence, and use getattr for the reads so a benchmark subcommand that defines only one of the two flags still works:
Consolidate the data access protocol into a single field.
Files changed
mlpstorage_py/cli_parser.py— guarded consolidation block (7 lines removed, 14 added)tests/unit/test_cli.py— addedTestParseArgumentsStorageFlagConsolidationwith 5 tests (3 regression tests for non-benchmark subcommands, 2 lock-in tests for benchmark subcommands)