10
1
mirror of https://gitlab.com/scemama/qmcchem.git synced 2024-11-15 02:23:38 +01:00
qmcchem/ocaml/Scheduler.ml
2019-07-17 11:49:34 +02:00

37 lines
665 B
OCaml

type t =
| SGE
| PBS
| SLURM
| Batch
let to_string = function
| SGE -> "SGE"
| PBS -> "PBS"
| SLURM -> "SLURM"
| Batch -> "Batch"
let find () =
let scheduler =
[ "SLURM_NODELIST" ; "PE_HOSTFILE" ; "PBS_NODEFILE" ]
|> List.map (function x ->
try Some (Sys.getenv x) with
| Not_found -> None
)
|> List.hd
in
let result =
match scheduler with
| Some "SLURM_NODELIST" -> SLURM
| Some "PE_HOSTFILE" -> SGE
| Some "PBS_NODEFILE" -> PBS
| None -> Batch
| Some x -> failwith (Printf.sprintf "Scheduler %s not found" x)
in
result