10
1
mirror of https://gitlab.com/scemama/qmcchem.git synced 2024-12-22 12:23:30 +01:00
qmcchem/ocaml/Scheduler.ml

37 lines
679 B
OCaml
Raw Normal View History

2015-12-19 02:35:13 +01:00
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" ]
2019-07-14 18:50:44 +02:00
|> List.map (function x ->
2019-12-17 09:08:39 +01:00
try ignore @@ (Sys.getenv x) ; Some x with
2019-07-14 18:50:44 +02:00
| Not_found -> None
2015-12-19 02:35:13 +01:00
)
|> 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