package current_rpc

  1. Overview
  2. Docs

Module Current_rpc.EngineSource

Client-side API to contact an engine service.

Sourcetype t = [ `Engine_f0961466d2f9bbf5 ] Capnp_rpc_lwt.Capability.t

Existing Methods

Sourceval active_jobs : t -> (Job.id list, [> `Capnp of Capnp_rpc.Error.t ]) result Lwt.t

active_jobs t lists the OCurrent jobs that are still being used in the pipeline. This includes completed jobs, as long as OCurrent is still ensuring they are up-to-date.

Sourceval job : t -> Job.id -> Job.t

job t id is the job with the given ID. This does not have to be an active job (but only active jobs can be rebuilt). If the job ID is unknown, this operation will resolve to a suitable error.

Query & History

Sourcetype query_params = {
  1. op : string option;
    (*

    Filter by operation type

    *)
  2. ok : bool option;
    (*

    Filter by success/failure

    *)
  3. rebuild : bool option;
    (*

    Filter by rebuild-needed flag

    *)
  4. job_prefix : string option;
    (*

    Filter by job ID prefix (e.g., date "2024-01-15")

    *)
}
Sourcetype history_entry = {
  1. job_id : string;
  2. build : int64;
  3. outcome : (string, string) result;
    (*

    Ok value or Error message

    *)
  4. ready : float;
    (*

    Unix timestamp when queued

    *)
  5. running : float option;
    (*

    Unix timestamp when started, if ever

    *)
  6. finished : float;
    (*

    Unix timestamp when finished

    *)
  7. rebuild : bool;
    (*

    Whether a rebuild was requested

    *)
}
Sourceval query : t -> query_params -> (history_entry list, [> `Capnp of Capnp_rpc.Error.t ]) result Lwt.t

query t params queries the job history database with the given filters. Returns matching entries sorted by finished time (most recent first).

Sourceval ops : t -> (string list, [> `Capnp of Capnp_rpc.Error.t ]) result Lwt.t

ops t lists all known operation types (e.g., "docker-build", "git-clone").

Pipeline Overview

Sourcetype stats = {
  1. ok : int;
  2. waiting_for_confirmation : int;
  3. ready : int;
  4. running : int;
  5. failed : int;
  6. blocked : int;
}
Sourcetype pipeline_state =
  1. | Success
  2. | Failed of string
  3. | Active of [ `Ready | `Running | `Waiting_for_confirmation ]
Sourceval pipeline_stats : t -> (stats, [> `Capnp of Capnp_rpc.Error.t ]) result Lwt.t

pipeline_stats t returns counts of pipeline stages in each state.

Sourceval pipeline_state : t -> (pipeline_state, [> `Capnp of Capnp_rpc.Error.t ]) result Lwt.t

pipeline_state t returns the overall pipeline state.

Sourceval pipeline_dot : t -> (string, [> `Capnp of Capnp_rpc.Error.t ]) result Lwt.t

pipeline_dot t returns the pipeline graph in Graphviz DOT format.

Configuration

Sourcetype confirm_level =
  1. | Harmless
  2. | Mostly_harmless
  3. | Average
  4. | Above_average
  5. | Dangerous
Sourceval get_confirm_level : t -> (confirm_level option, [> `Capnp of Capnp_rpc.Error.t ]) result Lwt.t

get_confirm_level t returns the current confirmation threshold, or None if no confirmation is required.

Sourceval set_confirm_level : t -> confirm_level option -> (unit, [> `Capnp of Capnp_rpc.Error.t ]) result Lwt.t

set_confirm_level t level sets the confirmation threshold. Pass None to disable confirmation.

Bulk Operations

Sourcetype rebuild_result = {
  1. succeeded : string list;
  2. failed : string list;
}
Sourceval rebuild_all : t -> string list -> (rebuild_result, [> `Capnp of Capnp_rpc.Error.t ]) result Lwt.t

rebuild_all t job_ids attempts to rebuild multiple jobs at once. Returns lists of job IDs that succeeded or failed to be queued for rebuild.