Is there a simple method of grabbing a property of...
# ask-community
j
Is there a simple method of grabbing a property of an object returned by a task to pass as the input to a downstream task, without having a task explicitly to just pull out that property? E.g.
Copy code
@task
def task1():
    return Object(foo='bar')

@task
def task2(foo: str):
    // Do something

@task
def getfoo(o: Object):
    return o.foo

with Flow('my-flow'):
    task1_result = task1()

    // This fails
    task2(task1_result.foo)

    // This works, but is annoying
    task2(getfoo(task1_result))
k
I think this is a limitation of the design of current Prefect Core because the Flow block is not deferred and constructs the graph. The
task1_result()
is still a Task here and it only resolves during Flow execution to the object. I think this should be doable in Prefect Orion (Prefect 2.0)
j
Got it, thx