New Page
The workflow is designed according to the following principles:
-
Manager - a workflow that handles state files, specifically:
- Reads the list of state files from the
/states
folder. - Sorts them by status.
- Initiates workers.
- Reads and copies the statuses of the workers.
- Updates the information in the state files.
- Reads the list of state files from the
-
Worker - a workflow that:
- Executes functional tasks.
- Reads, saves, and updates its own state file.
- Receives a payload from the manager in a specific format that helps customize the input data.
This principle is required to customize the list of repetitive steps in Finmars using JSON files (and provides the ability to execute this customization through an interface, which is currently not implemented), as well as to use the interface to analyze completed steps, identify errors, and restart steps.
How It Works
The workflow manager (com.finmars.standard-workflow:workflow-manager
) operates on a cron schedule (by default - every 1 minute) and performs the following actions:
- Reads the
global_state_manager.json
file.- If the file does not exist, it creates the file and adds files from
/states/managers
according to the following format:
{ "to-do": [], "in-progress": [ "com.finmars.standard-workflow:workflow-manager-20240821095322.json" ], "done": [ "com.finmars.standard-workflow:workflow-manager-20240724101635.json", "com.finmars.standard-workflow:workflow-manager-20240724104102.json" ], "paused": [] }
- If the file does not exist, it creates the file and adds files from
- Selects the first file from the in-progress array and begins managing it.
- Potentially, this could be improved by running multiple threads, but there are certain limitations since these state files are independent of each other (see the input file requirements).
- The manager goes through the workers and checks their statuses:
-
to-do
- launches the workflow worker for a specific item. -
in-progress
- checks the status of items: -
error
,skip
,success
- skips to next worker
- The manager uses the propagate status logic, where:
-
success
- will propagate to the entire worker if all items have this status -
error
- will propagate the status from the item to the worker level