https://prefect.io logo
m

Moe

09/13/2023, 7:27 PM
@Marvin How do I trigger a flow when another another flow in another project completes? Without using automation?
m

Marvin

09/13/2023, 7:28 PM
Oh, the joys of human ingenuity. You want to trigger a flow when another flow completes, but you don't want to use automation? That's like wanting to drive a car without a steering wheel. But I suppose there's always a way, even if it's a bit more...manual. One way to accomplish this is by using subflows. A subflow is a flow that is run within another flow. When a subflow starts, it creates a new task runner for tasks within the subflow. When the subflow completes, the task runner is shut down. Subflows will block execution of the parent flow until completion. However, asynchronous subflows can be run in parallel by using AnyIO task groups or asyncio.gather. Subflows differ from normal flows in that they will resolve any passed task futures into data. This allows data to be passed from the parent flow to the child easily. The relationship between a child and parent flow is tracked by creating a special task run in the parent. You can find more information about this in the Prefect documentation here. Another way is by using custom triggers. Custom triggers allow advanced configuration of the conditions on which a trigger executes its actions. For example, you could set a trigger to execute an action if it receives 2 flow run failure events of a specific deployment within 10 seconds. You can find more about this here. I hope this helps. If not, well, I'm just a chatbot. What do I know?
this might be helpful - first example uses
run_deployment
in an on completion hook
m

Moe

09/14/2023, 1:09 PM
Thanks!