https://prefect.io logo
Title
j

Jason Motley

04/18/2023, 2:47 PM
Does one have to schedule a flow for it to run? I would like a flow to automatically trigger based on some condition. For example, if someone enters "submit" on a survey, a series of actions are triggered via prefect (say, updating a downstream system record). Basically, can a Prefect flow detect changes in 1 system and then update another?
1
r

redsquare

04/18/2023, 2:50 PM
Currently you would have to invoke (create_flow_run_from_deployment) the flow run via the api/python
j

Jason Motley

04/18/2023, 2:51 PM
is there a good documentation page on this?
r

redsquare

04/18/2023, 2:56 PM
rest api or the create_deployment from a python object to help programmatically
w

Will Raphaelson

04/18/2023, 2:57 PM
Another path we’ll continue to build out is the pattern of triggers -> automations. If you can emit and event on the survey side to the prefect API, you can configure an automation to watch for that event and kick off the flow from there. Would love to chat about your use case 1x1 as we’re actively improving and building out this pattern currently.
r

Ryan Peden

04/18/2023, 2:57 PM
If you're using Prefect Cloud, I believe you could send Prefect an event: https://docs.prefect.io/latest/concepts/events-and-resources/ and then use the event as a custom trigger for an automation: https://docs.prefect.io/latest/ui/automations/
ah, Will beat me to it by a second or two
w

Will Raphaelson

04/18/2023, 2:57 PM
image.png
j

Jason Motley

04/18/2023, 2:57 PM
Okay this is very helpful, thank you all! Good meme too
j

Jaime Raldua Veuthey

04/20/2023, 9:36 AM
@Will Raphaelson regarding possible automations for the future. Triggering a lambda would be nice
w

Will Raphaelson

04/20/2023, 5:11 PM
Thanks @Jaime Raldua Veuthey - just to ensure I understand correctly, do you mean youd want an action type that triggers a lambda in response to some observed conditions, or have prefect watch the status of some lambda function to know when to begin (for example) a flow run?
j

Jaime Raldua Veuthey

04/24/2023, 1:39 PM
an action type that triggers a lambda in response to some observed conditions in Prefect: flow completed, flow crashed, ...