getFlow method allows you to retrieve the entire job hierarchy.
Using getFlow
The pattern to solve this requirement consists of using thegetFlow method:
Each child may have a
job property and, if they have children as well, they would have the children property.NodeOpts Interface
ThegetFlow method accepts a NodeOpts interface with the following properties:
JobNode Structure
The method returns aJobNode structure:
Limiting Results
You may need to limit the information retrieved if you have many children for one of the job nodes:Parameters
number
default:"10"
Maximum depth or levels to visit in the tree. Controls how deep the hierarchy traversal goes.
number
default:"20"
Maximum quantity of children per type (processed, unprocessed, failed, ignored) to retrieve for each node.
string
required
The ID of the root job to start the tree traversal from.
string
required
The queue name where the root job is located.
string
default:"bull"
The prefix used for the job keys in Redis.
Example Use Cases
Monitoring Flow Progress
Monitoring Flow Progress
Retrieve the entire flow tree to monitor the progress of a complex workflow:
Debugging Failed Flows
Debugging Failed Flows
Get the complete flow tree to identify which jobs failed:
Paginating Large Trees
Paginating Large Trees
Use depth and maxChildren to paginate through large job hierarchies:
