Botica.Runner.Executor (Botica v2.0.0)

Copy Markdown View Source

Executes health checks in parallel with timeout support.

This module provides the core execution engine for Botica checks, running them in parallel while respecting timeout constraints.

Summary

Functions

Executes all checks in parallel and returns structured results.

Executes checks sequentially (for debugging or ordered execution).

Functions

execute(config)

@spec execute(Botica.Types.config()) ::
  {:ok, [Botica.Types.result()]} | {:error, String.t()}

Executes all checks in parallel and returns structured results.

Options

  • :timeout - Global timeout in milliseconds for each check (default: 30_000)
  • :stop_on_first_error - Stop executing remaining checks after first error
  • :continue_on_error - Continue executing checks even if some fail (default: true)

Per-check timeouts

Individual checks can specify their own timeout in their definition:

%{
  id: :slow_check,
  timeout: 5000,  # This check gets 5 seconds instead of global 30s
  check: fn -> ... end
}

Timeout behavior

When a check times out, it returns an error result with a descriptive message. The timeout is applied per-check, not for the entire run.

execute(config, opts)

@spec execute(Botica.Types.config(), Botica.Types.executor_options()) ::
  {:ok, [Botica.Types.result()]} | {:error, String.t()}

execute_sequential(config)

@spec execute_sequential(Botica.Types.config()) ::
  {:ok, [Botica.Types.result()]} | {:error, String.t()}

Executes checks sequentially (for debugging or ordered execution).