nrmd.dh 1.98 KB
Newer Older
Valentin Reis's avatar
Valentin Reis committed
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 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
let values = ../resources/package.dh

let types = ../resources/types.dh

let argotypes = ./types.dh

let basicCommand = ./basicCommand.dh

let addVerbose = λ(v : Bool) → if v then [ "--verbose" ] else [] : List Text

let addSingularity =
        λ(v : Bool)
      → if v then [ "--container-runtime", "singularity" ] else [] : List Text

let addPowercap =
        λ(p : argotypes.Powercap)
      → merge
        { Cap =
            λ(x : Text) → [ "--powercap", x ]
        , NoCap =
            λ(x : {}) → [] : List Text
        }
        p

let defaultMkDaemon =
        { verbose =
            True
        , powercap =
            < NoCap = {=} | Cap : Text >
        , singularity =
            True
        }
      : argotypes.MkDaemon

let daemon =
        λ(a : argotypes.MkDaemon)
      →     basicCommand
            { name =
                "nrmd"
            , outprefix =
                "nrmd"
            , outavoids =
                [ "Traceback", "ValueError" ] : List Text
            , outwants =
                [] : List Text
            }
          ⫽ { args =
                  [ "--nrm_log", "./nrm_log" ]
                # addVerbose a.verbose
                # addSingularity a.singularity
                # addPowercap a.powercap
            , out =
                { filename =
                    "nrmd.out"
                , filecheck =
                    { wants =
                        [] : List Text
                    , avoids =
                        [ "Traceback", "ValueError" ] : List Text
                    }
                }
            , vars =
                [ { varname =
                      "ARGO_NODEOS_CONFIG"
                  , value =
                      "/tmp/argo_nodeos_config"
                  }
                ]
            }
        : types.Cmd

in  { defarg =
        defaultMkDaemon : argotypes.MkDaemon
    , mk =
        daemon : argotypes.MkDaemon → types.Cmd
    , default =
        daemon defaultMkDaemon : types.Cmd
    }