Hugo Slepicka
10/12/2021, 6:32 PMflow.run() , instead of it running on the registered server with the local agent it is running on my notebook.
I could not find on the docs how to trigger the execution of the registered flow using the local server. Could you point me to an example or docs (which I likely missed)?
What I am looking for is a way to execute the registered flow on my server via Python.Kevin Kho
Client and do Client.create_flow_run. There are also two tasks for StartFlowRun and create_flow_run that can be found hereKevin Kho
run() method.Kevin Kho
Hugo Slepicka
10/12/2021, 6:37 PMstate = flow.run(executor=executor)
with:
from prefect.tasks.prefect.flow_run import StartFlowRun
state = StartFlowRun().run(flow_name="Distgen->Astra&Impact", project_name="lume-orchestration")
?Kevin Kho
Hugo Slepicka
10/12/2021, 6:41 PMHugo Slepicka
10/12/2021, 6:43 PMKevin Kho
wait=True, for fetching results back, you need to use the GraphQL API.
So a while ago I mentioned there is also a create_flow_run task. There are three tasks which go together. create_flow_run, wait_for_flow_run and get_task_run_result. All are in the task library. create_flow_run and wait_for_flow_run were meant to decouple the StartFlowRun(…,wait=True). Basically to fetch results you want the get_task_run_resultKevin Kho
task.run() for these if they are outside of a flowHugo Slepicka
10/12/2021, 7:10 PMKevin Kho
Kevin Kho
Kevin Kho
Hugo Slepicka
10/12/2021, 7:13 PMtask_slug would be: brainy-ocelot and etc?Kevin Kho
Hugo Slepicka
10/12/2021, 11:57 PMfrom prefect.backend import FlowRunView
flow_run = FlowRunView.from_flow_run_id(state)
all_tasks = flow_run.get_all_task_runs()
g, a, i = [all_tasks[x].get_result() for x in range(3)]
Here is what I was doing: https://github.com/hhslepicka/lume-prefect-demo/blob/main/lume-flow-server.ipynb
Let me know if you have suggestions! Thanks again for the guidance.