Hello everyone :wave: I have a problem with my wo...
# ask-the-community
p
Hello everyone 👋 I have a problem with my workflow. I try to run the following tasks.
Copy code
@dataclass_json
@dataclass
class Input:
    metric: str
    data: dict = field(default_factory=dict)

@task
def load_configs() -> List[Input]:
    folder_name = "metrics"
    config_files = extract_config_files(folder_name=folder_name)
    configs: List[Input] = []
    for config_file in config_files:
        with open(config_file, "r") as file:
            config = Input(config_file, yaml.safe_load(file))
            configs.append(config)
    return configs


@task
def check_type(configs: List[Input]):
    print(type(configs))
    print(type(configs[0]))
    return type(configs)

@workflow  # type: ignore
def start_workflow() -> str:
    configs: List[Input] = load_configs()

    check_type(configs=configs)
I see that my first task,
load_configs()
, finishes successfully and it returns correctly the list of objects but the next task,
check_type
, it complains about
only generic univariate typing.list[t] type is supported.
I found these similar cases [1], [2] but I do not think that it is applicable to my situation. Any help or idea why I am getting this error? Thank you in advance 🙏
s
I don't think list of dataclasses type is supported yet. @Kevin Su, can you confirm?
p
I think that the problem is not with the dataclass. When I define the dataclass with simple types, it works correctly. Like below:
Copy code
@dataclass_json
@dataclass
class Input:
    metric: str
    data: str
The problem should be related to the dict most probably?
s
Can you replace
dict
with
dict[your_key_type, your_value_type]
?
k
yes, could you try typing.Dict[str, typing.Any] instead
p
I also had tried that but still did not workout 😕
s
If that's the case, could you create an issue? Please specify all the steps to reproduce the error. Are you seeing this error with the latest version of flytekit? [flyte-bug]