When is this applicable?
When developing a set of Virtualitics AI Platform Flows, you may need to chain Flows together. This article covers the steps necessary to run a Virtualitics AI Platform Flow as a step in a different one.
In order to trigger another Virtualitics AI Platform Flow from within a Step, you will need to implement the
on_run_success() function of the
Step abstract base class. Below is an example. This function can execute arbitrary callbacks on completion of a step.
In order to actually trigger a separate Flow, you will call the
trigger_flow_execution function from predict_backend.page.utils.
Using these two functions together, you can now successfully trigger a Flow at the completion of a Step in your original flow. Below is an example of triggering a flow named
from predict_backend.page.utils import trigger_flow_execution class SimpleStep(Step): def run(self, flow_metadata): pass def on_run_success(self, store_interface, *args, **kwargs): trigger_flow_execution('DashboardTestFlow', store_interface=store_interface)
When this step completes successfully a new Flow
DashboardTestFlow will be started. You can find the Flow in the Flows Management Console.
What to Expect (Validation)
If you go to the Flows Management Console, you will see that the second Flow ("Dashboard Test Flow") has successfully completed.