From ad5b2eb283367e46bd303e438195031b7a0ebda4 Mon Sep 17 00:00:00 2001 From: Jiaxiao Zheng Date: Fri, 27 Dec 2019 17:07:38 -0800 Subject: [PATCH] [Components] Roll forward of #2697 for real. (#2779) * Fix * clean up --- .../component_sdk/python/kfp_component/launcher/__main__.py | 4 ++-- .../component_sdk/python/kfp_component/launcher/launcher.py | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/components/gcp/container/component_sdk/python/kfp_component/launcher/__main__.py b/components/gcp/container/component_sdk/python/kfp_component/launcher/__main__.py index 20445e995aa..04f7d4b8cd2 100644 --- a/components/gcp/container/component_sdk/python/kfp_component/launcher/__main__.py +++ b/components/gcp/container/component_sdk/python/kfp_component/launcher/__main__.py @@ -28,7 +28,7 @@ def main(): parser.add_argument('file_or_module', type=str, help='Either a python file path or a module name.') parser.add_argument( - 'ui_metadata_path', + '--ui_metadata_path', type=str, default='/mlpipeline-ui-metadata.json', help='Path for the file where the mlpipeline-ui-metadata.json data ' @@ -39,7 +39,7 @@ def main(): if args.ui_metadata_path: os.environ['KFP_UI_METADATA_PATH'] = args.ui_metadata_path - launch(args.file_or_module, [args.args, args.ui_metadata_path]) + launch(args.file_or_module, args.args) if __name__ == '__main__': main() \ No newline at end of file diff --git a/components/gcp/container/component_sdk/python/kfp_component/launcher/launcher.py b/components/gcp/container/component_sdk/python/kfp_component/launcher/launcher.py index 1527942ad89..362e0ebfed1 100644 --- a/components/gcp/container/component_sdk/python/kfp_component/launcher/launcher.py +++ b/components/gcp/container/component_sdk/python/kfp_component/launcher/launcher.py @@ -28,8 +28,6 @@ def launch(file_or_module, args): Returns: The return value from the launched function. """ - if not isinstance(args, list): - args = [args] try: module = importlib.import_module(file_or_module) except Exception: @@ -44,4 +42,4 @@ def launch(file_or_module, args): except Exception: logging.error('Failed to find the module or file: {}'.format(file_or_module)) sys.exit(1) - return fire.Fire(module, command=[] + args, name=module.__name__) \ No newline at end of file + return fire.Fire(module, command=args, name=module.__name__) \ No newline at end of file