Is there a way to run a task quickly in-line durin...
# ask-community
c
Is there a way to run a task quickly in-line during the flow orchestration block? I'm currently using .run() to attempt to execute a PrefectSecret because it contains a dict that I need info from, and the secrets don't seem iterable on their own.
k
Yep! Like
task(lambda x: len(x))(input)
would work in the Flow block
c
so if I wanted to unpack a secret to reference in the flow, I just wrap it in task()?
k
Oh I see what you mean. No you can’t evaluate it like that using
task.run()
in the Flow block because that it was the Flow block is doing. For a dict you either need an intermediate task to unpack it or pass the whole dict to the subsequent task You might be able to do:
val1, va2 = task(lambda x: (x['val1'], x['val2']), nout=2)(input_Dict)
But yeah, that’s basically having an intermediate task to do it.
c
Okay, it'll probably have to be a whole task then because there's logic that picks a a keypair out of that secret dict
Thanks!