Does one have to schedule a flow for it to run? I ...
# ask-community
j
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
Currently you would have to invoke (create_flow_run_from_deployment) the flow run via the api/python
j
is there a good documentation page on this?
r
rest api or the create_deployment from a python object to help programmatically
w
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
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
j
Okay this is very helpful, thank you all! Good meme too
j
@Will Raphaelson regarding possible automations for the future. Triggering a lambda would be nice
w
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
an action type that triggers a lambda in response to some observed conditions in Prefect: flow completed, flow crashed, ...