Bernard Greyling
07/14/2020, 9:39 AMCloudFlowRunner
flows.
Locally I have a flow setup and registered to the cloud backend.
I can trigger the flow via the web-ui, however when running locally I get the following:
>> cloud_flow = CloudFlowRunner(flow)
>> flow_state = cloud_flow.run(return_tasks=flow.tasks)
>> flow_state
[2020-07-14 09:37:58] INFO - prefect.CloudFlowRunner | Beginning Flow run for 'Map Reduce'
<Failed: "Could not retrieve state from Prefect Cloud">
Am I missing something here?josh
07/14/2020, 11:08 AMFlowRunner
(mainly through calling `flow.run`)
When running with a backend (core’s server or Cloud) you will want to use Agents to deploy your flow runs. In this case you might want to be using the Local AgentBernard Greyling
07/14/2020, 11:12 AMjosh
07/14/2020, 11:17 AMBernard Greyling
07/14/2020, 11:20 AM>> flow_id = flow.register('My Project')
>> state = prefect.core.client.create_flow_run(flow_id=flow_id)
>> state
<state object>
josh
07/14/2020, 11:22 AMflow_id = flow.register('My Project')
flow_run_id = prefect.core.client.create_flow_run(flow_id=flow_id)
# call this whenever to get current run info including state
result = prefect.core.client.get_flow_run_info(flow_run_id=flow_run_id)
result.state
Bernard Greyling
07/14/2020, 11:24 AMfrom prefect.client.client import Client
# init client
client = Client()
# register flow
flow_id = flow.register('My Project')
# run and retrieve state
flow_run_id = client.create_flow_run(flow_id=flow_id)
result = client.get_flow_run_info(flow_run_id=flow_run_id)
result.state