Commit da04300b authored by Tsahi Glik's avatar Tsahi Glik Committed by Facebook GitHub Bot
Browse files

fix OSS CLI tools

Summary:
Pull Request resolved: https://github.com/facebookresearch/d2go/pull/302

Fixing issue introduced in D35035813 (https://github.com/facebookresearch/d2go/commit/744d72d73b7103b8dd9ca69372a179b44ad7d733) that break the OSS cli tools defined in https://github.com/facebookresearch/d2go/blob/8098d160c0b38b796a2c164719650a50238a0f89/setup.py#L87-L92.
The cli alias in setup need a function without any args to call. So creating a new main_cli function

Reviewed By: wat3rBro

Differential Revision: D37210948

fbshipit-source-id: efb3df15e9933c617414a727e5b53553db170622
parent 17fc9270
......@@ -74,7 +74,7 @@ def run_with_cmdline_args(args):
)
def cli(args):
def cli(args=None):
parser = basic_argument_parser()
parser.add_argument(
"--predictor-path",
......@@ -100,8 +100,9 @@ def cli(args):
default=0,
help="Control the --caffe2_logging_print_net_summary in GlobalInit",
)
run_with_cmdline_args(parser.parse_args())
args = sys.argv[1:] if args is None else args
run_with_cmdline_args(parser.parse_args(args))
if __name__ == "__main__":
cli(sys.argv[1:])
cli()
......@@ -122,9 +122,10 @@ def get_parser():
return parser
def cli(args):
def cli(args=None):
args = sys.argv[1:] if args is None else args
run_with_cmdline_args(get_parser().parse_args(args))
if __name__ == "__main__":
cli(sys.argv[1:])
cli()
......@@ -92,7 +92,7 @@ def run_with_cmdline_args(args):
)
def cli(args):
def cli(args=None):
parser = basic_argument_parser(requires_output_dir=False)
parser.add_argument(
"--eval-only", action="store_true", help="perform evaluation only"
......@@ -102,6 +102,7 @@ def cli(args):
action="store_true",
help="whether to attempt to resume from the checkpoint directory",
)
args = sys.argv[1:] if args is None else args
run_with_cmdline_args(parser.parse_args(args))
......@@ -122,4 +123,4 @@ def build_cli_args(
if __name__ == "__main__":
cli(sys.argv[1:])
cli()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment