Current.Engine
The main event loop.
type results = {
value : unit Current_term.Output.t;
jobs : actions Job.Map.t;
The jobs currently being used (whether running or finished).
*)}
val create :
?config:Config.t ->
?trace:(next:unit Lwt.t -> results -> unit Lwt.t) ->
(unit -> unit term) ->
t
create pipeline
is a new engine running pipeline
. The engine will evaluate t
's pipeline immediately, and again whenever one of its inputs changes.
Primitives should call this after using Current_incr.change
to run another step of the engine loop. This will (asynchronously) call Current_incr.propagate
and perform any end-of-propagation activities.
val thread : t -> 'a Lwt.t
thread t
is the engine's thread. Use this to monitor the engine (in case it crashes).
val update_metrics : t -> unit
update_metrics t
reports how many pipeline stages are in each state via Prometheus. Call this on each metrics collection if you have exactly one pipeline. The default web UI does this automatically.
on_disable fn
schedules fn ()
to be called after the next evaluation. You can increment a ref-count when calling this and then check it when the callback is called. If it is then zero, the operation is no longer required and you can e.g. cancel the job.
module Step : sig ... end