-
Notifications
You must be signed in to change notification settings - Fork 0
Parallel Execution and Dependencies
Beez runs work at two levels: within a phase+scope (among steps) and within a workflow (among phase+scope blocks). Understanding both helps you get speed without breaking ordering assumptions.
When Beez runs a phase+scope pair, it gathers all matching steps and splits them into levels:
- Steps with no dependency between them (and no
mutateconflict on the same files) are in the same level and may run in parallel. - Steps in different levels run one level after another.
If a level contains only one step, or if Beez is limited to one thread (-j 1), steps run sequentially.
phase=build, scope=default
Level 0 (parallel) Level 1 (parallel)
+----------+ +--------+
| compile | | link |
+----------+ +--------+
| gen-code |
+----------+
In this example compile and gen-code have no ordering constraint, so they can run together. link waits until level 0 finishes.
Use order(before, after) when one step must finish before another starts. The first argument runs before the second:
order("configure:setup", "build:compile")
order("build:compile", "test:unit")Step names in order() are the step name field, not phase:scope. Step names are globally unique in the registry; registering the same name again replaces the earlier step. order() only affects steps that run together in the same phase+scope group.
Typical chain for a build pipeline:
order("configure:setup", "build:compile")
order("build:compile", "test:unit")
order("build:compile", "test:integration")Here test:unit and test:integration both depend on build:compile. After compile finishes, those two tests can run in parallel in the same level.
Beez also infers dependencies when two steps in the same phase+scope mutate overlapping files (via mutate glob patterns). That prevents parallel runs from stomping the same paths.
If Beez cannot resolve ordering (for example a cycle in order()), the run fails with a step ordering error.
Workflow steps run sequentially by default. Each entry waits for the previous one to finish.
To run several phase+scope pairs at the same time, wrap them in parallel:
workflow("ci", {
{ parallel = {
{ phase = "generate", scope = "docs" },
{ phase = "generate", scope = "code" },
}},
{ phase = "compile", scope = "code" },
})Timeline:
Workflow step 1 (parallel)
generate:docs -----|
generate:code -----| (both at once)
v
Workflow step 2
compile:code -----
Parallel workflow steps are independent subtrees. Ordering between them is only what the workflow sequence defines.
A task with multiple actions runs them one by one:
task("check", {
"echo lint",
{ name = "compile" },
{ name = "test:unit" },
})There is no parallel form for tasks. Use a workflow if you need parallel phase+scope execution.
By default Beez uses one thread per CPU core. Override with -j / --threads:
beez -j 4 build
beez -j 1 build # force sequential execution inside each levelProject and user config can also set performance.max_threads.
Steps with a Lua run function (instead of a shell string) are executed like any other step regarding levels and order(). Keep callbacks short and predictable; heavy parallelism inside a callback is your responsibility (for example via ctx:spawn).
| Mechanism | What runs in parallel |
|---|---|
| Same level, same phase+scope | Steps without ordering or mutate conflict |
order(before, after) |
Forces before before after (different levels) |
mutate overlap |
Implicit ordering between conflicting steps |
Workflow { parallel = { ... } }
|
Multiple phase+scope pairs at once |
Workflow list (no parallel) |
Phase+scope pairs one after another |
| Task action list | Always sequential |
- Phases and Scopes - how phase+scope selects steps
-
First Pipeline - example with
order()and a workflow -
Artifact Patterns - how
input/output/mutateaffect skip behavior
Quick Reference · Glossary · FAQ
- Fundamentals
- Core Concepts
- Project Layout
- First Pipeline
- Phases and Scopes
- How Phases and Scopes Work
- Selecting with Phases and Scopes
- Designing Phases and Scopes
- Parallel Execution and Dependencies
- Configuration
- Configuration Overview
- Global User Config
- Project Config
- Environment Variables
- Performance Settings
- Cache Settings
- Config Reference
- CLI
- CLI Overview
- Running Targets
- Filtering by Phase
- Running a Single Step
- Listing Entities
- Output and Logging Flags
- Cache and Maintenance Flags
- Meta and Utility Commands
-
Project Scaffolding —
beez --init(embedded Tempify) - CLI Flag Reference
- Lua DSL
- DSL Overview
- Plugin System — Plugins, Config DSL, Standard-Workflows
- Step Declaration
- Task Declaration
- Workflow Declaration
- Order Declaration
- Configure Step
- ReqPack Declaration
- Beez API
- Step Context
- DSL Patterns
- Caching
- Caching Overview
- Step Cache
- Success Cache
- Glob Metadata Cache
- Artifact Patterns
- Cache Keys and Invalidation
- Cache Storage and Maintenance
- Caching Troubleshooting
- UI and Output
- Output Modes
- Progress and Animation
- Colors and Themes
- Run Summaries
- Logging and Log Files
- Development and Contribution
- Building and Setup
- Repository Layout
- Testing
- Code Quality
- Feature Development Workflow
- Submitting Changes