Squidie.Operations.Collector (squidie v0.3.7)

Copy Markdown View Source

Rebuilds a bulk, read-only operational view of runs and dispatch queues.

The collector loads each run and queue projection once so status and doctor reports can aggregate durable facts without repeated per-run queue rebuilds.

Summary

Functions

Collects operational projections using optional Squidie configuration and :now overrides.

Returns planned runnables that are missing from the selected queue projection.

Returns completed queue attempts that have not been applied to the run projection.

Types

queue()

@type queue() :: %{
  queue: String.t(),
  partition: String.t() | nil,
  projection: Squidie.Runtime.DispatchProtocol.Projection.t(),
  attempts: [Squidie.Runtime.DispatchProtocol.ActionAttempt.t()]
}

run()

@type run() :: %{
  run_id: String.t(),
  partition: String.t() | nil,
  workflow: String.t(),
  queue: String.t(),
  status: atom(),
  terminal?: boolean(),
  manual_state: map() | nil,
  planned_runnables: [map()],
  applied_runnable_keys: MapSet.t(String.t()),
  anomalies: [map()]
}

t()

@type t() :: %Squidie.Operations.Collector{
  catalog_anomalies: [map()],
  config: Squidie.Config.t(),
  now: DateTime.t(),
  queues: %{required(String.t()) => queue()},
  runs: [run()]
}

Functions

collect(overrides \\ [])

@spec collect(keyword()) :: {:ok, t()} | {:error, term()}

Collects operational projections using optional Squidie configuration and :now overrides.

pending_dispatches(run, queue)

@spec pending_dispatches(run(), queue()) :: [map()]

Returns planned runnables that are missing from the selected queue projection.

pending_results(run, queue)

@spec pending_results(run(), queue()) :: [
  Squidie.Runtime.DispatchProtocol.ActionAttempt.t()
]

Returns completed queue attempts that have not been applied to the run projection.