package bistro

  1. Overview
  2. Docs
A library to build and run distributed scientific workflows

Install

Dune Dependency

Authors

Maintainers

Sources

bistro-0.6.0.tbz
sha256=146177faaaa9117a8e2bf0fd60cb658662c0aa992f35beb246e6fd0766050e66
sha512=553fe0c20f236316449b077a47e6e12626d193ba1916e9da233e5526dd39090e8677277e1c79baace3bdc940cb009f25431730a8efc00ae4ed9cc42a0add9609

doc/src/bistro.utils/toplevel_eval.ml.html

Source file toplevel_eval.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
open Bistro
open Bistro_engine

module Make(P : sig
    val np : int
    val mem : int
  end)() =
struct
  open P

  let with_workflow w ~f =
    let open Scheduler in
    let db = Db.init_exn "_bistro" in
    let loggers = [ Console_logger.create () ] in
    let sched = create ~np:np ~mem:(`GB mem) ~loggers db in
    let thread = eval_exn sched w in
    start sched ;
    try
      Lwt_main.run thread
      |> f
    with
    | Failure msg as e -> (print_endline msg ; raise e)

  let eval w = with_workflow w ~f:(fun x -> x)

  let with_pworkflow w ~f = with_workflow (Workflow.path w) ~f

  let path w =
    with_pworkflow w ~f:(fun x -> x)

  let sh fmt =
    Printf.kprintf (fun s -> ignore (Sys.command s)) fmt

  let rm w = with_pworkflow w ~f:(sh "rm %s")

  let file w =
    with_pworkflow w ~f:(sh "file %s")

  let less w =
    with_pworkflow w ~f:(sh "less %s")

  let wc w =
    with_pworkflow w ~f:(sh "wc %s")

  let firefox w =
    with_pworkflow w ~f:(sh "firefox --no-remote %s")

  let evince w =
    with_pworkflow w ~f:(sh "evince %s")

  let ls w =
    with_pworkflow w ~f:(sh "ls %s")
end
OCaml

Innovation. Community. Security.