From a3d44aa81f0a926b30d647235e3fa526025f2adb Mon Sep 17 00:00:00 2001 From: allegroai <> Date: Thu, 29 Dec 2022 13:17:25 +0200 Subject: [PATCH] Fix connect list of dicts parsed incorrectly in remote --- clearml/backend_interface/task/args.py | 3 ++- clearml/utilities/proxy_object.py | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/clearml/backend_interface/task/args.py b/clearml/backend_interface/task/args.py index 59aec84e..422683d2 100644 --- a/clearml/backend_interface/task/args.py +++ b/clearml/backend_interface/task/args.py @@ -10,6 +10,7 @@ from typing import Tuple, Type, Union from ...backend_api import Session from ...binding.args import call_original_argparser +from ...utilities.proxy_object import get_type_from_basic_type_str class _Arguments(object): @@ -517,7 +518,7 @@ class _Arguments(object): v_type = type(v) elif parameters_type.get(k): v_type_str = parameters_type.get(k) - v_type = next((t for t in (bool, int, float, str, list, tuple) if t.__name__ == v_type_str), str) + v_type = get_type_from_basic_type_str(v_type_str) else: # this will be type(None), we deal with it later v_type = type(v) diff --git a/clearml/utilities/proxy_object.py b/clearml/utilities/proxy_object.py index 2d8042b4..2b72df49 100644 --- a/clearml/utilities/proxy_object.py +++ b/clearml/utilities/proxy_object.py @@ -148,6 +148,23 @@ def cast_basic_type(value, type_str): return value +def get_type_from_basic_type_str(type_str): + # default to str + if not type_str: + return str + + if str(type_str).startswith("list/"): + v_type = list + elif str(type_str).startswith("tuple/"): + v_type = tuple + elif str(type_str).startswith("dict/"): + v_type = dict + else: + v_type = next((t for t in (bool, int, float, str, list, tuple, dict) if t.__name__ == type_str), str) + + return v_type + + def get_basic_type(value): basic_types = (float, int, bool, six.string_types, list, tuple, dict)