I think I understand what is going on. There are a bunch of things that will break here.
1. Parameters can’t be functions. They need to be JSONSerializeable. This might work for
flow.run()
but will break for runs with Prefect Cloud because those are triggered by API requests. Instead, use a string as a default and pass it to an intermediate task to return the function/callable
2. I am unclear at the moment if
get_sequences_attr
is a task. If it is a task, you can’t use
for
loops on task outputs because
for
runs during the Flow
build
time, not during
flow.run()
. So the Flow is built, but the
for
loop doesn’t know how many items there are in the list if it’s a Task. A Task value (including Parameters) are created at runtime. Note the distinction of flow-build and flow-run time. If you need to loop over a task output, you should be looking at
mapping.
3. Assuming
sequence_attr
is some task output, you can’t do stuff like
sequence_attr.get_path()
. This is because that is evaluated during build time when it is still type Task. The value doesn’t exist until runtime. Instead, you need this method class to happen inside a task so logic is deferred. This will work though if
sequence_attr
is not a task and already defined during flow-build time.