From 819f46707982fdf80b9f1797fc221039b08ac445 Mon Sep 17 00:00:00 2001 From: Taleb Zeghmi Date: Fri, 10 Jan 2025 20:17:53 -0800 Subject: [PATCH 1/3] AIP-9061 lowercase cli params --- metaflow/plugins/aip/aip_cli.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/metaflow/plugins/aip/aip_cli.py b/metaflow/plugins/aip/aip_cli.py index d29bd2ba8d3..b6d72ef3528 100644 --- a/metaflow/plugins/aip/aip_cli.py +++ b/metaflow/plugins/aip/aip_cli.py @@ -415,13 +415,13 @@ def run( def _get_flow_parameters(kwargs, obj) -> Dict[str, Any]: def _convert_value(param: parameters.Parameter): - v = kwargs.get(param.name) + v = kwargs.get(param.name.lower()) return json.dumps(v) if param.kwargs.get("type") == JSONType else v flow_parameters = { param.name: _convert_value(param) for _, param in obj.flow._get_parameters() - if kwargs.get(param.name) is not None + if kwargs.get(param.name.lower()) is not None } return flow_parameters From da4b565ef6e9493f2d14986069abe675408e1ac7 Mon Sep 17 00:00:00 2001 From: Taleb Zeghmi Date: Sat, 11 Jan 2025 09:28:02 -0800 Subject: [PATCH 2/3] AIP-9061 code comment --- metaflow/plugins/aip/aip_cli.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/metaflow/plugins/aip/aip_cli.py b/metaflow/plugins/aip/aip_cli.py index b6d72ef3528..1a003fa25a7 100644 --- a/metaflow/plugins/aip/aip_cli.py +++ b/metaflow/plugins/aip/aip_cli.py @@ -415,12 +415,14 @@ def run( def _get_flow_parameters(kwargs, obj) -> Dict[str, Any]: def _convert_value(param: parameters.Parameter): + # AIP-9061(talebz): Black lowercases kwargs parameter names v = kwargs.get(param.name.lower()) return json.dumps(v) if param.kwargs.get("type") == JSONType else v flow_parameters = { param.name: _convert_value(param) for _, param in obj.flow._get_parameters() + # AIP-9061(talebz): Black lowercases kwargs parameter names if kwargs.get(param.name.lower()) is not None } return flow_parameters From ee5a3e13ef89044c102181caca130275baddf57b Mon Sep 17 00:00:00 2001 From: Taleb Zeghmi Date: Sat, 11 Jan 2025 09:39:33 -0800 Subject: [PATCH 3/3] comment update --- metaflow/plugins/aip/aip_cli.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/metaflow/plugins/aip/aip_cli.py b/metaflow/plugins/aip/aip_cli.py index 1a003fa25a7..6142b49c7e6 100644 --- a/metaflow/plugins/aip/aip_cli.py +++ b/metaflow/plugins/aip/aip_cli.py @@ -414,15 +414,14 @@ def run( def _get_flow_parameters(kwargs, obj) -> Dict[str, Any]: + # AIP-9061(talebz): Black lowercases kwargs parameter names, so we call lower() def _convert_value(param: parameters.Parameter): - # AIP-9061(talebz): Black lowercases kwargs parameter names v = kwargs.get(param.name.lower()) return json.dumps(v) if param.kwargs.get("type") == JSONType else v flow_parameters = { param.name: _convert_value(param) for _, param in obj.flow._get_parameters() - # AIP-9061(talebz): Black lowercases kwargs parameter names if kwargs.get(param.name.lower()) is not None } return flow_parameters