This page explains how to create multi-level simulation hierarchies using branch chaining. Branch chaining allows simulations to target non-master parent branches, enabling complex simulation scenarios where one simulation builds upon another.Documentation Index
Fetch the complete documentation index at: https://docs.activeviam.com/llms.txt
Use this file to discover all available pages before exploring further.
What is branch chaining?
Branch chaining allows simulations to use any branch as a parent, not just the master branch. This creates a hierarchy of simulations where each simulation can build upon the results of a previous simulation. For example, in a financial risk analysis:- Simulation on branch A uses master as its parent and models a 2% interest rate increase.
- Simulation on branch B uses branch A as its parent and adds a market volatility scenario.
- Simulation on branch C uses branch B as its parent and applies portfolio adjustments.
How to create a branch chain
When creating a simulation, specify the parent branch in the simulation definition:What happens during execution?
When a simulation is executed on a branch, the workflow performs these steps:- Parent branch validation: If the target branch already exists with completed simulations, the workflow queries those simulations to determine the actual parent branch.
- Automatic correction: If the specified parent branch does not match the actual parent used by existing simulations on that branch, the workflow automatically corrects the parent branch reference. A warning is logged when this occurs.
- Branch creation: If the target branch does not exist, it is created using the specified parent branch. If the parent branch does not exist, the operation fails with a clear status instead of throwing an exception.
- Execution: The simulation executes on the target branch using the validated parent.
What are the edge cases?
The branch chaining implementation handles several edge cases:Non-existent parent branch
Attempting to create a branch with a non-existent parent returns a failure status. The simulation status is set toFAILED and an error is logged with the branch name and parent branch name.
Mismatched parent branch
When executing a simulation on an existing branch, if the specified parent does not match the parent used by other simulations on that branch, the parent is automatically corrected:Parent branch deletion
Deleting a parent branch does not affect child branches. Child branches remain intact with their data preserved. Simulations on child branches continue to function normally.What are the consistency guarantees?
The workflow ensures branch chain consistency:- All simulations on a given branch share the same parent branch.
- Parent branch references are validated and corrected automatically.
- Branch creation failures are handled gracefully without exceptions.
- Existing data is preserved when parent branches are deleted.
When to use branch chaining
Branch chaining is useful for scenarios that require:- Incremental simulations: Building scenarios layer by layer, where each layer depends on the previous one.
- Comparative analysis: Creating multiple variations from a common baseline scenario.
- Complex workflows: Modeling multi-step processes where each step modifies the output of the previous step.
- Rollback points: Creating intermediate branches that serve as checkpoints for further experimentation.
Example workflow
Here is a complete example showing how to create a simulation chain:How does branch chaining interact with permissions?
Branch permissions are inherited from the parent branch when a new branch is created. Users must have:- Read access to the parent branch to create a child branch.
- Write access to the target branch to execute simulations.