https://prefect.io logo
d

DJ Erraballi

11/06/2020, 5:54 PM
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

Dylan

11/06/2020, 5:57 PM
Which uses the API, but is more convenient =]
d

DJ Erraballi

11/06/2020, 6:05 PM
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

Dylan

11/06/2020, 7:05 PM
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

DJ Erraballi

11/06/2020, 7:29 PM
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

Dylan

11/06/2020, 7:43 PM
It does not, I believe that’s part of the Task logic
d

DJ Erraballi

11/09/2020, 5:43 PM
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?
3 Views