Baton.Config (Baton v0.1.0)

Copy Markdown View Source

Runtime configuration and repo resolution.

Repo

The repo is read from Oban's own configuration, so Baton always uses the same repo as the jobs it orchestrates:

Baton.Config.repo()         # default Oban instance
Baton.Config.repo(MyOban)   # named instance

Host configuration

config :baton,
  oban_name: Oban,                 # default
  pubsub: MyApp.PubSub,            # required if using the dashboard/events
  pricing: Baton.Pricing.Default,
  snooze_seconds: 30,
  stale_executing_threshold_seconds: 600

Summary

Functions

The configured LLM client module used by Baton.Debug.call_llm/3.

Configured Oban instance name (default: Oban).

The configured pricing module (a Baton.Pricing implementation).

The Phoenix.PubSub server used for live step events.

Resolve the Ecto repo from Oban's config.

Snooze interval (seconds) when a dependency is still pending.

Age (seconds) past which an executing dep is treated as failed (default 600).

Functions

llm_client()

@spec llm_client() :: module() | nil

The configured LLM client module used by Baton.Debug.call_llm/3.

Must export complete/2 taking (messages, opts) and returning {:ok, response} or {:error, reason}. Returns nil if unconfigured, in which case call_llm/3 raises a helpful error.

config :baton, llm_client: MyApp.LLM

oban_name()

@spec oban_name() :: atom()

Configured Oban instance name (default: Oban).

pricing()

@spec pricing() :: module()

The configured pricing module (a Baton.Pricing implementation).

pubsub()

@spec pubsub() :: atom() | nil

The Phoenix.PubSub server used for live step events.

Returns nil if not configured; Baton.Events no-ops when nil, so the engine runs fine without Phoenix.

repo(name \\ nil)

@spec repo(atom() | nil) :: module()

Resolve the Ecto repo from Oban's config.

snooze_seconds()

@spec snooze_seconds() :: pos_integer()

Snooze interval (seconds) when a dependency is still pending.

stale_executing_threshold_seconds()

@spec stale_executing_threshold_seconds() :: pos_integer()

Age (seconds) past which an executing dep is treated as failed (default 600).

Must exceed your longest step's runtime

A dependency that has been executing for longer than this is assumed stuck and is cancelled, cascading to its dependents (see Baton.Check). If a healthy step can legitimately run longer than this threshold — e.g. a long LLM completion whose Baton.LLMWorker :timeout is raised above 600s — set this higher than that step's timeout, or the engine will cancel a running step and fail the workflow. Keep threshold > longest step timeout.