A term is a unit of computation, which can have various state and a log output. Terms can be short-lived or long-running.
The type for computation terms. A
'a t is a term that evaluates to an
'a, fails, or explains what it's waiting for.
val return : 'a -> 'a t
return x is a term that evaluates successfully to
val fail : ('a, Format.formatter, unit, 'b t) Pervasives.format4 -> 'a
fail fmt is a term that fails with message
val pending : ('a, Format.formatter, unit, 'b t) Pervasives.format4 -> 'a
pending fmt is a term that reports it is waiting because of reason
val state : 'a t -> ('a, [ `Pending of string | `Failure of string ]) Pervasives.result t
state x immediately and successfully returns the current state of
val of_state : ('a, [< `Pending of string | `Failure of string ]) Pervasives.result -> 'a t
of_state x is a term which evaluates to
val catch : 'a t -> ('a, [ `Failure of string ]) Pervasives.result t
catch x successfully returns a result showing whether
x succeeded or failed.
of_lwt_quick x evaluates to the result of
x. Note that the result is never pending, so this is only for quick operations.
of_lwt_slow check is a term that evaluates
check () to get the current status. If
Error (`Pending (message, ready)), another check is scheduled when
pair a b evaluates to the pair of the results of successfully evaluating
b (in parallel). If
a is not successful, the result is the same as
a. Otherwise, if
b is not successful then the result is the same as
without_logs t evaluates to the same result as
t, but does not link to its logs. This is useful if
t's logs are already being reported as part of another job.
module Infix : sig ... end
list_map_p fn l will map the
l list of terms to
fn in parallel and return the result list when all of them have completed.
wait_for t ~while_pending ~on_failure evaluates successfully to unit if
t evaluates successfully. It is pending with reason
t is pending, and fails with error
t fails. This is useful in the case where one test case depends on another, to avoid reporting the same status twice. Consider wrapping with
t's logs will be reported as part of another job.
wait_for_all xs evaluates successfully to unit if all terms in the assoc list
xs evaluate successfully. Otherwise, it is pending or failed with a suitable message, based on the names of the terms it is waiting for. Consider wrapping with
xs's logs will be reported as part of another job.
job_id evaluates to the ID of the worker that evaluates the term. This is useful for logging.
val head : Target.t -> Datakit_github.Commit.t t
head target evaluates to the commit at the head
val branch_head : Datakit_github.Repo.t -> string -> Datakit_github.Commit.t t
branch_head repo b evaluates to the commit at the head of branch
b in the repository
val tag : Datakit_github.Repo.t -> string -> Datakit_github.Commit.t t
tag repo t evaluates to the commit of tag
t in the repository
ci_status ci target is the status reported by CI
target. Note that even if the CI is e.g. pending, this returns a successful result with the value
`Pending, not a pending result.
ci_target_url ci target is the target URL reported by CI