what is recommended way to launch a separate flow ...
# ask-community
j
what is recommended way to launch a separate flow run within a flow for Prefect2 ? In Prefect 0.x, it had create_flow_run(flow_name), but don’t see that in Prefect2.x. Is there way to launch a flow run based on its name?
n
hi @Joe Uhm - that's
run_deployment
now
Copy code
from prefect.deployments import run_deployment

# if we have some-flow/some-deployment already created
flow_run = run_deployment("some-flow/some-deployment", parameters={"foo": 42})
# pass timeout=0 to avoid waiting for the flow run to complete as the caller
👍 1
j
@Nate if you don’t have the deployment name, does it accept like this, run_deployment(“some-flow/*“, parameters={foo”:42}) ? i just want to run the latest or single deployed flow
by flow name only
or, look up all the existing deployments of a flow, to pick one
@Nate is there way to look up list of all deployment names of a flow?
within flow code
n
yep you can use the client