Skip to content

Commit

Permalink
utils: dry_run in Term and Repo
Browse files Browse the repository at this point in the history
  • Loading branch information
pveber committed Nov 15, 2017
1 parent e6b0f25 commit c7cbed6
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/utils/repo.ml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ let to_term ?(precious = []) ~outdir items =
let build ?np ?mem ?logger ?keep_all ?precious ?bistro_dir ~outdir repo =
Term.run ?np ?mem ?logger ?keep_all ?bistro_dir (to_term ~outdir ?precious repo)

let dry_run ?precious repo =
Term.dry_run (to_term ~outdir:"res" ?precious repo)

let add_prefix prefix items =
List.map items ~f:(function
| Repo_item (p, w) -> Repo_item (prefix @ p, w)
Expand Down
4 changes: 4 additions & 0 deletions lib/utils/repo.mli
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,7 @@ val build :
?precious:Bistro.any_workflow list ->
?bistro_dir:string ->
outdir:string -> t -> unit

val dry_run :
?precious:Bistro.any_workflow list ->
t -> Scheduler.dry_run
6 changes: 6 additions & 0 deletions lib/utils/term.ml
Original file line number Diff line number Diff line change
Expand Up @@ -188,3 +188,9 @@ let run ?np ?mem ?logger ?keep_all ?bistro_dir app =
prerr_endline msg ;
failwith "Some workflow failed!"

let dry_run term =
let workflows = to_workflow_list term in
let dag, goals, precious = Scheduler.compile workflows in
let config = Task.config ~db_path:"_bistro" ~use_docker:true ~keep_all:true ~precious in
Scheduler.dry_run ~goals config dag
|> Lwt_main.run
3 changes: 3 additions & 0 deletions lib/utils/term.mli
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ val run :
?bistro_dir:string ->
'a t -> 'a

val dry_run :
'a t -> Scheduler.dry_run

module Syntax : sig
module Let_syntax : sig
type nonrec 'a t = 'a t
Expand Down

0 comments on commit c7cbed6

Please sign in to comment.