Hi! I've been having some issues with flyte not r...
# ask-the-community
j
Hi! I've been having some issues with flyte not respecting types of data between tasks. https://github.com/flyteorg/flyte/issues/4740 https://github.com/flyteorg/flyte/issues/4505 Its making it so I need to have hard casting between task and introducing weird bugs. Is this something I'm missing or i a known issue?
k
Cc @Yee / @Haytham Abuelfutuh the problem of protobuf struct
But this seems odd to be up converting to string
y
dict[int, float] gets represented not as a protobuf struct in the backend but as a literal map. The flyte literal map key types are always str
you can try leaving off the types - a pure
dict
will trigger the proto struct transformer.
or make the object a dataclass.
j
good, and what about the int being casted to flat? Need to make that one a dataclass too?
When using
dict
instead of
Dict[int, str]
it still gets casted to str @Yee
Copy code
from flytekit import task, workflow

@task
def create_dict() -> dict:
    sample_dict = {1: 1.1, 2: 2.2, 3: 3.3}
    print(sample_dict.keys())
    return sample_dict

@task
def process_dict(input_dict: dict):
    print(input_dict.keys())

@workflow
def workflow() -> None:
    dict_created = create_dict()
    process_dict(input_dict=dict_created)
The second print will still have str keys 😞
any update on these?