Resource-aware local command execution for Elixir tooling and Mix workspaces. Blitz 0.5.0 has one scheduler for independent commands, per-project pipelines, and impact-aware CI. It is not a distributed job system, build cache, or release qualification engine.
{:blitz, "~> 0.5.0", runtime: false}
Use runtime: false for tooling. Restrict environments only when every caller
is confined to those environments. Tooling-only consumers with narrow Dialyzer
PLTs may need :blitz in plt_add_apps.
commands = for project <- ["apps/core", "apps/web"] do Blitz.command(id: project, command: "mix", args: ["test"], cd: project) end Blitz.run!([%{commands: commands}])
Every run is a stage plan. One stage is an independent command batch; multiple stages pipeline by command id. An id must be unique within its stage. The next command of that id starts only after the earlier command succeeds. Independent ids can overlap, even across stages.
projects = ["apps/core", "apps/web"] stages = for task <- ["compile", "test"] do %{commands: Enum.map(projects, fn project -> Blitz.command(id: project, command: "mix", args: [task], cd: project) end)} end Blitz.run!(stages)
Blitz.run/2 returns {:ok, grouped_results} or
{:error, %Blitz.Error{}, grouped_results}. Results follow input order within
stages; only commands that ran or failed admission appear. A failed id blocks its
later commands; unrelated ids continue by default. Set fail_fast?: true to
stop admitting work after the first failure. Already running commands finish.
run!/2 raises the aggregated error.
Commands take explicit argv, working directory, environment overrides, and an
optional output_path. Logs stream with command labels, retain bounded tails,
and report progress every ten seconds. For quiet automation use
announce?: false, emit_output?: false.
No worker counts are required. The scheduler detects CPU availability and memory headroom, accounts for all stages together, and fills compatible work as reservations are released. Default demands are derived from the executable. For atypical workloads, declare estimates, not host-specific concurrency:
Blitz.command( id: "qualification", command: "mix", args: ["test", "--only", "integration"], resources: [cpu: 3, memory_mib: 1536, priority: 10] )
Linux detects inherited CPU affinity, visible cgroup v1/v2 CPU quotas, and
live memory headroom (accounting for reclaimable inactive_file cache).
Darwin uses scheduler capacity and available-page estimates. CPU and memory
reservations are advisory admission budgets across all platforms: children
inherit the caller's OS constraints and the kernel schedules runnable threads
across available CPUs without pinning. An explicit budget such as
budget: [cpu: 2, memory_mib: 2048] lowers admission capacity when necessary.
See Resource scheduling for the precise
contract and limitations, including timeouts and process groups.
In the root project's mix.exs project configuration:
blitz_workspace: [ root: __DIR__, projects: [".", "apps/*"], tasks: [ deps_get: [args: ["deps.get"], preflight?: false], compile: [args: ["compile", "--warnings-as-errors"]], test: [args: ["test"], mix_env: "test"], dialyzer: [args: ["dialyzer"], resources: [cpu: 3, memory_mib: 2048]], docs: [args: ["docs", "--warnings-as-errors"]] ] ]
Run mix blitz.workspace test. Project specs can include sibling checkouts.
Workspace planning isolates deps and build paths, sets MIX_ENV
explicitly, and clears HEX_API_KEY by default (isolation.hex_home is opt-in). Task env accepts a function of the project/task
context or an MFA for explicit additional environment values. Task names are
atoms in configuration. The scheduler never chooses dependency sources.
mix blitz.workspace.impact test --dry-run explains which task states already
have passing coverage. Blitz.MixWorkspace.Impact.run_many!/3 plans multiple
families from one workspace snapshot and uses the same scheduler. See the
Impact CI, Test state, and
Downstream integration guides.
Blitz.run/2andrun!/2now accept stages and return grouped results.run_stages/2andrun_stages!/2are removed.- Remove workspace
parallelism, allmax_concurrencysettings, multipliers, overrides, and Blitz-specific-jflags. Use workloadresourcesonly when defaults are unsuitable. No compatibility adapters are provided. - Use
fail_fast?: truewhen a caller requires stopping new independent work after the first failure. Workspace and impact entry points use this policy.
mix format
mix compile --warnings-as-errors
mix test --warnings-as-errors
mix credo --strict
mix dialyzer
mix docs --warnings-as-errorsMIT licensed. See CHANGELOG.md.