package bistro

  1. Overview
  2. Docs

A library to build scientific workflows.

This module introduces a type 'a worfklow that describe a set of inter-dependent actions that will eventually generate a target (file or directory). The 'a type represents the format of the file or the layout of the directory. Actions may be either command lines to be executed, or OCaml expressions to be evaluated.

To build workflows, use the EDSL module, that provide a set of combinators to write shell scripts easily. For instance, the following function shows how to create a gzipped file using the output of another workflow:

let gzip (x : 'a workflow) : 'a gz workflow =
  workflow ~descr:"unix.gzip" [
    cmd "gzip" [ string "-c" ; dep x ; string ">" dest ]
  ]

Note that a workflow is just a recipe to build some result. Building the workflow won't actually generate anything. In order to run the workflow, you have to run it using an execution engine like the one provided by bistro.engine.

type +'a workflow

The type representing a set of actions (shell scripts or (evaluations of OCaml expressions) to build a target of type 'a. The type 'a is a phantom type, which can be used to enforce static invariants.

type 'a directory = [
  1. | `directory of 'a
]

Conventional type to represent directory targets

class type ['a, 'b] file = object ... end

Conventional type to represent file targets. The object type is to represent properties of the file, like the type of encoding (text or binary) or the format.

class type 'a value = object ... end

Conventional type to represent OCaml values saved with the Marshal module.

type any_workflow =
  1. | Workflow : _ workflow -> any_workflow
    (*

    Encapsulate a workflow target type

    *)
module Path : sig ... end

Helper functions to represent paths as string lists. For absolute paths, the first element of the list is "/".

type u = private
  1. | Input of string * Path.t
  2. | Select of string * u * Path.t
  3. | Step of step

Workflow representation

and step = private {
  1. id : string;
  2. descr : string;
  3. deps : u list;
  4. action : action;
  5. np : int;
    (*

    Required number of processors

    *)
  6. mem : int;
    (*

    Required memory in MB

    *)
  7. version : int option;
    (*

    Version number of the wrapper

    *)
}
and action =
  1. | Exec of command
  2. | Eval of some_expression
and command =
  1. | Docker of docker_image * command
  2. | Simple_command of token list
  3. | And_list of command list
  4. | Or_list of command list
  5. | Pipe_list of command list
and token =
  1. | S of string
  2. | D of u
  3. | F of token list
  4. | DEST
  5. | TMP
  6. | NP
  7. | MEM
and some_expression =
  1. | Value : _ expression -> some_expression
  2. | File : unit expression -> some_expression
  3. | Directory : unit expression -> some_expression
and _ expression =
  1. | Expr_pure : {
    1. id : string;
    2. value : 'a;
    } -> 'a expression
  2. | Expr_app : ('a -> 'b) expression * 'a expression -> 'b expression
  3. | Expr_dest : string expression
  4. | Expr_tmp : string expression
  5. | Expr_np : int expression
  6. | Expr_mem : int expression
  7. | Expr_dep : _ workflow -> string expression
  8. | Expr_deps : _ workflow list -> string list expression
  9. | Expr_valdep : 'a value workflow -> 'a expression
  10. | Expr_valdeps : 'a value workflow list -> 'a list expression
and docker_image = private {
  1. dck_account : string;
  2. dck_name : string;
  3. dck_tag : string option;
  4. dck_registry : string option;
}

Name and version of an external dependency for a workflow

type (-'a, +'b) selector = private
  1. | Selector of Path.t

Describes the (relative) path from a 'a directory workflow target to some 'b workflow target. This is useful to construct new workflows by selecting a file or surdirectory in the result of a directory workflow.

module Workflow : sig ... end
module Template : sig ... end

Represents a text with special symbols

module EDSL : sig ... end

This module provides combinators to define new workflows that execute shell commands.

module EDSL' : sig ... end

This module provides an alternative DSL to construct workflows whose action is to evaluate an OCaml expression.

module Std : sig ... end

Standard definitions

OCaml

Innovation. Community. Security.