Queued flows¶
Update on the synQup core to have the feature to queue a flow, and a minor update on the UI to show the status of the flow. Where an additional status of queued and running is shown if the flow have the said status. This feature doesn’t support queuing a flow in the UI and a flow will only be queued via command (running flow:start without the --force-removal flag) or directly calling the endpoint to start a flow that is currently running.
We can easily update the UI to have an action there to queue a running flow. If we want to include that, a flow should be running in order to have the new action button “Queue” and the target endpoint is also the same as starting a flow. There is no need to update anything on the core to implement that.
A new table flow_execution_queue was created for this feature containing the fields:
{
flow_id: int,
flow_execution_id: int,
jdm_info: json,
dispatched: bool,
queued_by_user_id: int,
queued_by_text: varchar,
created_at: datetime,
updated_at: datetime
}
The feature also offers future update here where we want to queue a flow with different Job Dispatcher Mapping, that is why we have the jdm_info field to store the desired jdm. Where it will overwrite the current jdm when it is time for this flow_execution_queue to be dispatched.
For the process of the Queued Flows, If a running flow has been started again, it will create an entry on the new
table. When the current running flow has finished, a FlowExecutionDoneEvent Subscriber called
DispatchFlowQueueEventSubscriber will then dispatch the flow_execution_queue entry of that flow.
When Ending/Stopping a running flow that is also queued in the UI, aside from stopping the currently running flow,
it will also delete all the flow_execution_queue entries of that flow.
This feature also includes the new Class FlowManager, which has the startFlow method and is the first one
to be called in starting a flow. This new class is also the one who implements the new feature to queue a flow if
its running. The FlowExecutionManager still exists where we are also calling after executing the function of the
startFlow method.