Hello,
I'm creating my first flow run on local for the first time, and i want to set it up with how (i think) my prod set up will interact with prefect. I have a work pool created and a local agent listening to it, and I deployed my Flow to prefect cloud like so:
if __name__ == "__main__":
deployment: Deployment = Deployment.build_from_flow(
flow=test_flow,
name="example",
version="1",
tags=["demo"],
work_pool_name='local_agent_work_pool'
)
deployment.apply()
I confirmed that the deployment worked in the Prefect Cloud UI.
In my flask endpoint, I am trying to submit the flow run to Prefect cloud like so, but it feels wrong:
@flask_route.route("/prefect", methods=['POST'])
def start_prefect_flow():
# prefect_client = get_client(
# # api_key='redacted'
# )
prefect_client = PrefectClient(
api='redacted',
api_key='redacted'
)
res = prefect_client.create_flow_run(test_flow)
print(res)
First, I don't think I should be creating the client this way, but unsure how else I should be passing my api/api key information to it. This is also returning a coroutine object instead of what I thought would be information about my flow run, but maybe that makes sense since I don't see a flow run being kicked off. Some assistance here would be super helpful!