https://prefect.io logo
#prefect-community
Title
# prefect-community
s

Sean Conroy

12/12/2022, 5:18 PM
Hi...I need help printing task results using Prefect 1: seems like printing the output only prints the task name, not task result:
Copy code
from prefect import task, Flow

@task
def get_value():
    return 10

with Flow("task-results") as flow:
    v = get_value()
    print(v)

state = flow.run()
I get
<Task: get_value>
instead of
10
. What am I doing wrong?
1
z

Zanie

12/12/2022, 5:30 PM
In the
with Flow
block you are declaring your DAG, not running the flow. If you move your print value to a task, it’ll execute at runtime.
s

Sean Conroy

12/12/2022, 5:31 PM
Gotcha...thanks Michael. I'll give that a shot.