Good morning, whats the easiest way start a flow f...
# prefect-community
r
Good morning, whats the easiest way start a flow from python that is already registered?
d
Hi @Richard Hughes! The easiest way is to call
flow.run()
😄 Do you need to start a flow via API with Prefect Cloud or Server?
r
yes, I want to start a flow via the api it will be from either cloud or server.
d
Got it!
You should be able to kick off flows runs that way 👍
We also have a
FlowRunTask
in the Task library if you need to kick off flow runs from a flow run 💥
We also have a CLI that ships with prefect, so you can kick off flow runs without python!
r
@Dylan - is this the one I should use?
Copy code
prefect.client.client.Client.create_flow_run()
What if I don't know the flow_id and only the flow_name? I need to query the flow_id
d
@Richard Hughes You can also pass a
version_group_id
instead of an
id
. The version group persists across all versions of your flow and will always run the latest
That way, you only need to know that id once
r
is that found in the gui or graphql or where do I find this nubmer?
d
You’ll need to set it when you register the flow
OR actually
I think it might have one
one sec
I believe this is set to the
flow_group_id
by default
Which you can find in Flow Details tile in the UI
If not, you can set the
version_group_id
to whatever string you’d like at registration time. Just pass
version_group_id
to
flow.register()
r
yes, I was just looking at that, it can be string and not a guid? I can use just the name for that flow?
d
That’ correct! You can use the flow’s name if you’d like
r
@Dylan thanks!
d
Of course!