Hello! I am having a particular problem with Prefe...
# prefect-community
t
Hello! I am having a particular problem with Prefect flows. When I create an extremely simple flow, with a single task (can be anything, just the identity function is fine), but pass in a parameter that is a NamedTuple with more than one entry, it doesn't parse the keys of the NamedTuple correctly. Instead of expanding them like a dictionary, it treats them all as a single entity. I'm happy to provide example code if needed.
z
Hi @tkanas, a reproducible example would be fantastic!
t
Copy code
@task
def fake_task(spec):
    return spec

with Flow('bla') as flow:
    param_1_specs = Parameter('param_1_specs')
    res = fake_task(param_1_specs)

class Complex(NamedTuple):
    r: int
    i: int

param_values={'param_1_specs': Complex(r=1, i=1)}

flow_result = flow.run(**param_values)
z
Thank you! Taking a look now.
After some digging, it looks like this issue is on our radar. A couple of notes: • as an immediate way to move forward, you should be able to use a dot dict instead of a NamedTuple • we have an issue open for this at the link below. If you have any opinions about the correct solution or your use case, we'd love to hear them here. https://github.com/PrefectHQ/prefect/issues/2118
t
Thank you!
z
Sure thing! Let us know if you have any more questions/issues. 🙂