[FR] Make trace_dir a required argument (#135157)

Ensures users get a clean error if they forget to specify the dir, and
improves the help message.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/135157
Approved by: https://github.com/c-p-i-o, https://github.com/fduwjj
This commit is contained in:
Will Constable
2024-09-05 18:31:59 -07:00
committed by PyTorch MergeBot
parent a681260caf
commit 06e414d7fe
2 changed files with 3 additions and 3 deletions

View File

@ -17,9 +17,9 @@ class JobConfig:
self.parser = argparse.ArgumentParser( self.parser = argparse.ArgumentParser(
description="PyTorch Flight recorder analyzing script." description="PyTorch Flight recorder analyzing script."
) )
self.parser.add_argument( self.parser.add_argument(
"-d", "--dir", required=True, help="Directory with flight recorder dumps" "trace_dir",
help="Directory containing one trace file per rank, named with <prefix>_<rank>.",
) )
self.parser.add_argument( self.parser.add_argument(
"--selected-ranks", "--selected-ranks",

View File

@ -40,7 +40,7 @@ from tools.flight_recorder.components.types import types
def main(args: Optional[Sequence[str]] = None) -> None: def main(args: Optional[Sequence[str]] = None) -> None:
config = JobConfig() config = JobConfig()
args = config.parse_args(args) args = config.parse_args(args)
details, version = read_dir(args.prefix, args.dir) details, version = read_dir(args.prefix, args.trace_dir)
db = build_db(details, args, version) db = build_db(details, args, version)
if args.output: if args.output:
with open(args.output, "wb") as f: with open(args.output, "wb") as f: