From 435c537bcad747bcd3505ac0ae171ef5c546d7f9 Mon Sep 17 00:00:00 2001 From: allegroai Date: Thu, 13 May 2021 15:06:22 +0300 Subject: [PATCH] Add --debug --- clearml_serving/__main__.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/clearml_serving/__main__.py b/clearml_serving/__main__.py index b0b32a7..ac591b4 100644 --- a/clearml_serving/__main__.py +++ b/clearml_serving/__main__.py @@ -37,7 +37,7 @@ def cmd_triton(args): if not args.id and not args.name: raise ValueError("Serving service must have a name, use --name ") - if args.id: + if args.id and not args.project and not args.name: a_serving = ServingService(task_id=args.id) else: a_serving = ServingService(task_project=args.project, task_name=args.name, engine_type='triton') @@ -87,10 +87,11 @@ def cmd_launch(args): a_serving.launch_engine(queue_name=args.queue) -def cli(): +def cli(verbosity): title = 'clearml-serving - CLI for launching ClearML serving engine' print(title) parser = ArgumentParser(prog='clearml-serving', description=title) + parser.add_argument('--debug', action='store_true', help='Print debug messages') subparsers = parser.add_subparsers(help='Serving engine commands', dest='command') # create the launch command @@ -142,6 +143,7 @@ def cli(): parser_trt.set_defaults(func=cmd_triton) args = parser.parse_args() + verbosity['debug'] = args.debug args = restore_state(args) if args.command: @@ -151,12 +153,15 @@ def cli(): def main(): + verbosity = dict(debug=False) try: - cli() + cli(verbosity) except KeyboardInterrupt: print('\nUser aborted') except Exception as ex: print('\nError: {}'.format(ex)) + if verbosity.get('debug'): + raise ex exit(1)