Hi all, if I am trying to run a Flow run through a...
# prefect-community
s
Hi all, if I am trying to run a Flow run through a normal IDE debugger but keep seeing the value of Task outputs assigned to variables as <Task:name> types, am I returning the value of tasks wrongly or using the debugger wrong?
c
Hi @Steve Vandervalk! That appears to be the repr of the task. For example, in IPython:
Copy code
from prefect import Task

print(Task(name="Chris"))
# <Task: Chris>
s
Hey! yep understood. I'm trying to do a normal debugger flow but I guess I'm unclear where the flow actually returns and assigns a Tasks output to the variable?
if that makes sense
c
hmm I don’t think I’m following quite yet; would you mind sharing a code example of what you’re referring to?
s
Copy code
with Flow("Mapbox API Travel Time Retrieval and Processing") as flow:

    download_geojson_blob_task = DownloadBlobFromAzure()

    azure_blob_name = "travel_time_segments.geojson"
    azure_container = "ottawa-mapbox-travel-time-inputs"

    travel_time_segments_geojson = download_geojson_blob_task(
        blob_name=azure_blob_name,
        azure_credentials_secret="AZ_CREDS",
        container=azure_container,
    )
Copy code
...state = flow.run(executor=LocalExecutor())
something as simple as that
but not specific to instantiated tasks, functions with @task decorator are the same
c
that Flow code makes sense to me - does it not run as you expect?
s
it runs but I'd like to insert a break point but the variable I assign a task to is that type instead of the returned dict or what have you
so I clearly don't understand something about prefect
c
gotcha; where are you inserting your breakpoint?
s
the line after assignment say
inside the Flow
c
so Prefect builds up a deferred computational graph, meaning your code is never run until you call
flow.run
- so inputting a breakpoint within the build step of a Flow will not contain any results / data since nothing has run yet
s
right that makes sense
should I step through then after the .run call
c
the data that is exchanged between tasks are always exchanged via Prefect States; when you call
flow.run
a Prefect State is returned whose
result
attribute is a dictionary mapping Tasks -> task states, which have a
result
attribute themselves containing the return value from that task run
s
ah
c
so using your code above, you could do:
Copy code
flow_state = flow.run()
flow_state.result[travel_time_segments_geojson].result
to actually extract the return value of that task
s
so prefect captures it all
thanks, that's an excellent explanation
c
awesome - glad I could help!
@Marvin archive “How can I inspect the outputs from my tasks?”