From 66f36e8fe309d18501045445e2068f24ad0f015c Mon Sep 17 00:00:00 2001 From: Yicheng-Lu-llll Date: Sat, 11 Mar 2023 07:15:45 +0000 Subject: [PATCH] improve Signed-off-by: Yicheng-Lu-llll --- flytekit/core/type_engine.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/flytekit/core/type_engine.py b/flytekit/core/type_engine.py index bf31c30450..d76a9c3da1 100644 --- a/flytekit/core/type_engine.py +++ b/flytekit/core/type_engine.py @@ -985,10 +985,10 @@ def to_literal(self, ctx: FlyteContext, python_val: T, python_type: Type[T], exp if type(python_val) != list: raise TypeTransformerFailedError("Expected a list") - if self.is_batchable(python_type): + if ListTransformer.is_batchable(python_type): batchSize = len(python_val) # default batch size # parse annotated to get the number of items saved in a pickle file. - if get_origin(python_type) is Annotated: + if get_origin(python_type) is Annotated and type(get_args(python_type)[1]) == int: batchSize = get_args(python_type)[1] lit_list = [TypeEngine.to_literal(ctx, python_val[i : i + batchSize], FlytePickle, expected.collection_type) for i in range(0, len(python_val), batchSize)] # type: ignore else: