Hey guys, I'm Diogo and using Prefect for the firs...
# ask-community
d
Hey guys, I'm Diogo and using Prefect for the first time and already in love with it ❤️ . I'm doing a Flow calling another registered flow with
StartFlowRun
, but I can't get results from that flow. Looking at the code,
create_flow_run
ignores result arg: https://github.com/PrefectHQ/prefect/blob/96ef85470872593268c9498b57ac9f0b5a268e01/src/prefect/tasks/prefect/flow_run.py#L160 Do you know a way to get Flow results? Here a test code:
Copy code
from prefect.tasks.prefect import StartFlowRun
from prefect import Flow, task
from prefect.engine.results.local_result import LocalResult

graph_building = StartFlowRun(
      flow_name="test_flow",
      project_name="test_project",
      wait=True,
      result=LocalResult(".")
)
with Flow("Call Flow") as flow:
    end_flow = graph_building()

state = flow.run()
state.result[endflow].result #nothing here
d
Hey @Diogo Munaro, Welcome! 😄 Currently, the StartFlowRun only returns a Flow Run Id. We’re thinking more closely about how to return results back between flows. At this time, you’d have to upload the data you wish to pass to a known place and pull it into the parent flow from there.
I believe there’s a feature enhancement issue already open
Feel free to chime in there!
d
Thank you @Dylan! I was searching but I didn't found the issue... I believe that the documentation is a bit confusing about this behavior: https://docs.prefect.io/api/latest/tasks/prefect.html#startflowrun
wait
argument said that
if True, this task will wait until the flow run is complete, and then reflect the corresponding state as the state of this task.
, but state is not the same of the Flow triggered
d
So it does take on the State (i.e. Success, Failed) but it does not reflect the state result
d
🤔 but State here is not a full State object... do you know where is this issue?
d
the issue you’re running into is that, at this time, we don’t return a State Result
d
I know, but do you know about a Github issue for that?
d
Ah! My apologies one second
d
Another issue... for me
wait
is always waiting task and returning result instead of task ID... Do you know something about that?
z
Could you explain what you mean by that?
wait
as an argument to
StartFlowRun
still?
d
These 2 slices of code returns the same:
Copy code
from prefect.tasks.prefect import StartFlowRun
from prefect import Flow, task

graph_building = StartFlowRun(
      flow_name="test_flow",
      project_name="test_project",
      wait=True
)
with Flow("Call Flow") as flow:
    end_flow = graph_building()

state = flow.run()
state.result[endflow].result #nothing here
and
Copy code
from prefect.tasks.prefect import StartFlowRun
from prefect import Flow, task

graph_building = StartFlowRun(
      flow_name="test_flow",
      project_name="test_project",
      wait=False
)
with Flow("Call Flow") as flow:
    end_flow = graph_building()

state = flow.run()
state.result[endflow].result #nothing here
I was expecting that second one should return only execution id
ohhhhh Flow result is the same, but Task result is different... forget it and sorry