Fix pre-existing pipeline raises an exception

This commit is contained in:
allegroai 2022-06-06 13:12:02 +03:00
parent fe791e6e2c
commit cb36da3ded
2 changed files with 11 additions and 5 deletions

View File

@ -2955,9 +2955,15 @@ class PipelineDecorator(PipelineController):
kwargs[inspect_func.args[i]] = v kwargs[inspect_func.args[i]] = v
kwargs_artifacts.update( kwargs_artifacts.update(
{k: walk_nested_dict_tuple_list( {
v, lambda x: x._remoteref() if isinstance(x, LazyEvalWrapper) else x) k: walk_nested_dict_tuple_list(
for k, v in kwargs.items() if isinstance(v, LazyEvalWrapper)} v,
lambda x: x._remoteref() if isinstance(x, LazyEvalWrapper) else x,
stop_condition=lambda x: isinstance(x, LazyEvalWrapper) and x._remoteref(),
)
for k, v in kwargs.items()
if isinstance(v, LazyEvalWrapper)
}
) )
kwargs = {k: deepcopy(v) for k, v in kwargs.items() if not isinstance(v, LazyEvalWrapper)} kwargs = {k: deepcopy(v) for k, v in kwargs.items() if not isinstance(v, LazyEvalWrapper)}

View File

@ -221,9 +221,9 @@ def naive_nested_from_flat_dictionary(flat_dict, sep='/'):
} }
def walk_nested_dict_tuple_list(dict_list_tuple, callback): def walk_nested_dict_tuple_list(dict_list_tuple, callback, stop_condition=None):
nested = (dict, tuple, list) nested = (dict, tuple, list)
if not isinstance(dict_list_tuple, nested): if not isinstance(dict_list_tuple, nested) or (stop_condition and stop_condition(dict_list_tuple)):
return callback(dict_list_tuple) return callback(dict_list_tuple)
if isinstance(dict_list_tuple, dict): if isinstance(dict_list_tuple, dict):