open Core open Bistro open Bistro_engine let with_workflow w ~f = let open Scheduler in let db = Db.init_exn "_bistro" in let loggers = [ Bistro_utils.Console_logger.create () ] in let sched = create ~np:8 ~mem:(`GB 8) ~loggers db in let thread = eval_exn sched w in start sched ; try Lwt_main.run thread |> f with Failure msg -> ( print_endline msg ; failwith "Failed!" ) | exn -> raise exn let eval w = with_workflow w ~f:Fn.id let path w = with_workflow (Workflow.eval_path w) ~f:(fun x -> x) let less w = Sys.command (sprintf "less %s" (path w)) |> ignore let firefox w = Sys.command (sprintf "firefox %s" (path w)) |> ignore let seaview w = Sys.command (sprintf "seaview %s" (path w)) |> ignore let evince w = Sys.command (sprintf "evince %s" (path w)) |> ignore let workflow_of_template t = let open Bistro.Shell_dsl in Workflow.shell [ cmd "cp" [ file_dump t ; dest ] ]