Have a simialar question to the above ^^ whats the...
# ask-community
d
Have a simialar question to the above ^^ whats the easiest way to trigger downstream flows from a completed flow? Use the prefet API to directly trigger?
d
Which uses the API, but is more convenient =]
d
thanks!
This is great for triggering the flow from another flow, I might be on an older version where it’s called
FlowRunTask
for executing this kind of trigger from outside of prefect, i would just use the client right?
Copy code
client = Client()
        flow = client.graphql(query).data.flow

        # verify that a flow has been returned
        if not flow:
            raise ValueError("Flow '{}' not found.".format(flow_name))

        # grab the ID for the most recent version
        flow_id = flow[0].id
        return client.create_flow_run(flow_id=flow_id, parameters=parameters)
how can i get an authenitcated client from outside of prefect context
just pass in api-server and api-token?
d
That’s right!
The advantage of the `FlowRunTask`/`StartFlowRun` is that you can pass
wait=True
and then the Task will take on the state of the Flow Run it kicked off (
Failed
,
Success
, etc) and you can take further actions based on that if you’d like
d
ah great, yeah this is a fire and forget use case
but good to know i could sync call it
👍 1
if i wanted to sync call from outside of prefect (lests say i hav ea python cli script that would trigger a flow, does the client create flow run method have a wait param?
d
It does not, I believe that’s part of the Task logic
d
for the start flow run task, if a project name isn’t provided is the expectation that the flow that’s triggered will share the project name with the flow that triggered it?