lib.dh 10 KB
Newer Older
Valentin Reis's avatar
Valentin Reis committed
1 2
    let values =
          https://xgitlab.cels.anl.gov/argo/dhrun/raw/master/resources/package.dh
Valentin Reis's avatar
Valentin Reis committed
3

Valentin Reis's avatar
Valentin Reis committed
4 5
in  let types =
          https://xgitlab.cels.anl.gov/argo/dhrun/raw/master/resources/types.dh
Valentin Reis's avatar
Valentin Reis committed
6

Valentin Reis's avatar
Valentin Reis committed
7
in  let dataDir = env:DHRUNSPECS as Text ++ "/"
Valentin Reis's avatar
Valentin Reis committed
8

Valentin Reis's avatar
Valentin Reis committed
9
in  let manifestDir = dataDir ++ "manifests/"
Valentin Reis's avatar
Valentin Reis committed
10

Valentin Reis's avatar
Valentin Reis committed
11 12 13 14 15 16 17
in  let assetDir = dataDir ++ "assets/"

in  let openmcDir = assetDir ++ "openmc/"

in  let lammpsDir = assetDir

in  let qmcPackDir = assetDir
Valentin Reis's avatar
Valentin Reis committed
18

Valentin Reis's avatar
Valentin Reis committed
19
in  let basicCommand =
Valentin Reis's avatar
Valentin Reis committed
20 21 22 23 24 25 26 27 28 29 30
            λ ( args
              : { name :
                    Text
                , outprefix :
                    Text
                , outwants :
                    List Text
                , outavoids :
                    List Text
                }
              )
Valentin Reis's avatar
Valentin Reis committed
31 32 33 34 35 36 37 38
          → { name =
                args.name
            , args =
                [] : List Text
            , out =
                { filename =
                    "${args.outprefix}.out"
                , filecheck =
Valentin Reis's avatar
Valentin Reis committed
39
                    { wants = args.outwants, avoids = args.outavoids }
Valentin Reis's avatar
Valentin Reis committed
40 41 42 43 44
                }
            , err =
                { filename =
                    "${args.outprefix}.err"
                , filecheck =
Valentin Reis's avatar
Valentin Reis committed
45
                    values.emptyCheck ⫽ { avoids = args.outavoids }
Valentin Reis's avatar
Valentin Reis committed
46 47 48 49 50 51 52
                }
            , postchecks =
                [] : List types.FileCheck
            , vars =
                values.emptyVars
            , passvars =
                [ "PATH" ]
53 54
            , timeout =
                [] : Optional Natural
Valentin Reis's avatar
Valentin Reis committed
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
            }

in  let MakeBaseArgs =
          { manifest :
              Text
          , cmd :
              Text
          , containerName :
              Text
          , args :
              List Text
          , verbose :
              Bool
          , cmdwants :
              List Text
Valentin Reis's avatar
Valentin Reis committed
70 71
          , cmdavoids :
              List Text
Valentin Reis's avatar
Valentin Reis committed
72 73
          , vars :
              List types.EnvVar
Valentin Reis's avatar
Valentin Reis committed
74 75
          , passvars :
              List Text
76 77
          , timeout :
              Optional Natural
Valentin Reis's avatar
Valentin Reis committed
78 79
          }

Valentin Reis's avatar
Valentin Reis committed
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
in  let emptyMakeBaseArgs =
            λ(cmd : Text)
          → λ(manifest : Text)
          → λ(containerName : Text)
          → { manifest =
                manifest
            , cmd =
                cmd
            , containerName =
                containerName
            , args =
                [] : List Text
            , verbose =
                False
            , cmdwants =
                [] : List Text
Valentin Reis's avatar
Valentin Reis committed
96 97
            , cmdavoids =
                [] : List Text
Valentin Reis's avatar
Valentin Reis committed
98 99
            , vars =
                values.emptyVars
Valentin Reis's avatar
Valentin Reis committed
100 101
            , passvars =
                [] : List Text
Valentin Reis's avatar
Valentin Reis committed
102 103
            }

Valentin Reis's avatar
Valentin Reis committed
104 105 106 107 108 109 110
in  let addVerbose = λ(v : Bool) → if v then [ "--verbose" ] else [] : List Text

in  let makeBase =
            λ(args : MakeBaseArgs)
          →   { cmds =
                  [   basicCommand
                      { name =
111
                          "nrmd"
Valentin Reis's avatar
Valentin Reis committed
112
                      , outprefix =
113
                          "nrmd"
Valentin Reis's avatar
Valentin Reis committed
114 115
                      , outwants =
                          [] : List Text
Valentin Reis's avatar
Valentin Reis committed
116 117
                      , outavoids =
                          [ "Traceback" ] : List Text
Valentin Reis's avatar
Valentin Reis committed
118 119
                      }
                    ⫽ { args =
Valentin Reis's avatar
Valentin Reis committed
120
                          [ "--nrm_log", "./nrm_log" ] # addVerbose args.verbose
Valentin Reis's avatar
Valentin Reis committed
121 122 123 124 125 126 127 128
                      , vars =
                          [ { varname =
                                "ARGO_NODEOS_CONFIG"
                            , value =
                                "/tmp/argo_nodeos_config"
                            }
                          ]
                      }
Valentin Reis's avatar
Valentin Reis committed
129 130 131
                  ,     let b =
                              basicCommand
                              { name =
132
                                  "nrm"
Valentin Reis's avatar
Valentin Reis committed
133
                              , outprefix =
134
                                  "nrmrun"
Valentin Reis's avatar
Valentin Reis committed
135 136
                              , outwants =
                                  args.cmdwants
Valentin Reis's avatar
Valentin Reis committed
137 138
                              , outavoids =
                                  args.cmdavoids
Valentin Reis's avatar
Valentin Reis committed
139
                              }
Valentin Reis's avatar
Valentin Reis committed
140
                    
Valentin Reis's avatar
Valentin Reis committed
141 142 143 144 145 146 147 148 149 150 151 152 153 154
                    in    b
                        ⫽ { args =
                                [ "run"
                                , "-u"
                                , args.containerName
                                , args.manifest
                                , args.cmd
                                ]
                              # args.args
                          , passvars =
                              b.passvars # args.passvars
                          , timeout =
                              args.timeout
                          }
Valentin Reis's avatar
Valentin Reis committed
155
                  ]
Valentin Reis's avatar
Valentin Reis committed
156 157
              , verbose =
                  True
158 159
              , cleaning =
                  True
Valentin Reis's avatar
Valentin Reis committed
160
              , workdir =
Valentin Reis's avatar
lib fix  
Valentin Reis committed
161
                  "./_output"
Valentin Reis's avatar
Valentin Reis committed
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176
              , pre =
                  [] : List Text
              , post =
                  [] : List Text
              }
            : types.Config

in  let makeExtended =
            λ(args : MakeBaseArgs)
          → λ(cmds : List types.Cmd)
          → let b = makeBase args in b ⫽ { cmds = b.cmds # cmds }

in  let OptionalSleep = < Cmd : Text | Sleep : {} >

in  let FilterTestArgs =
177 178 179
          { manifestname :
              Text
          , filter :
Valentin Reis's avatar
Valentin Reis committed
180 181
              Text
          , cmd :
Valentin Reis's avatar
Valentin Reis committed
182
              Text
Valentin Reis's avatar
Valentin Reis committed
183 184 185 186
          , args :
              List Text
          , vars :
              List types.EnvVar
Valentin Reis's avatar
Valentin Reis committed
187 188
          , passvars :
              List Text
Valentin Reis's avatar
Valentin Reis committed
189 190
          , cmdavoids :
              List Text
Valentin Reis's avatar
Valentin Reis committed
191 192
          , isTest :
              Bool
193 194
          , timeout :
              Optional Natural
Valentin Reis's avatar
Valentin Reis committed
195
          }
Valentin Reis's avatar
Valentin Reis committed
196 197 198

in  let emptyFilterTestArgs =
            λ(filter : Text)
Valentin Reis's avatar
Valentin Reis committed
199 200 201
          → λ(cmd : Text)
          → { cmd =
                cmd
202 203
            , manifestname =
                "perfwrap.json"
Valentin Reis's avatar
Valentin Reis committed
204
            , filter =
Valentin Reis's avatar
Valentin Reis committed
205 206 207
                filter
            , args =
                [] : List Text
Valentin Reis's avatar
Valentin Reis committed
208 209
            , vars =
                values.emptyVars
Valentin Reis's avatar
Valentin Reis committed
210 211
            , passvars =
                [] : List Text
Valentin Reis's avatar
Valentin Reis committed
212 213
            , cmdavoids =
                [] : List Text
Valentin Reis's avatar
Valentin Reis committed
214 215
            , isTest =
                False
216 217
            , timeout =
                [] : Optional Natural
Valentin Reis's avatar
Valentin Reis committed
218 219 220 221 222
            }

in  let appTest =
            λ(args : FilterTestArgs)
          →     let cn = "testContainer"
Valentin Reis's avatar
Valentin Reis committed
223
            
Valentin Reis's avatar
Valentin Reis committed
224 225
            in  makeExtended
                { manifest =
Valentin Reis's avatar
Valentin Reis committed
226 227 228
                        manifestDir
                    ++  (       if args.isTest
                          
Valentin Reis's avatar
Valentin Reis committed
229
                          then  args.manifestname
Valentin Reis's avatar
Valentin Reis committed
230
                          
Valentin Reis's avatar
Valentin Reis committed
231
                          else  "parallel.json"
Valentin Reis's avatar
Valentin Reis committed
232
                        )
Valentin Reis's avatar
Valentin Reis committed
233 234 235
                , containerName =
                    cn
                , cmd =
Valentin Reis's avatar
Valentin Reis committed
236
                    args.cmd
Valentin Reis's avatar
Valentin Reis committed
237
                , args =
Valentin Reis's avatar
Valentin Reis committed
238
                    args.args
Valentin Reis's avatar
Valentin Reis committed
239 240 241 242
                , verbose =
                    True
                , cmdwants =
                    [] : List Text
Valentin Reis's avatar
Valentin Reis committed
243 244
                , cmdavoids =
                    args.cmdavoids
Valentin Reis's avatar
Valentin Reis committed
245 246
                , vars =
                    args.vars
Valentin Reis's avatar
Valentin Reis committed
247 248
                , passvars =
                    args.passvars
249 250
                , timeout =
                    args.timeout
Valentin Reis's avatar
Valentin Reis committed
251 252 253 254
                }
                [     let b =
                            values.emptyCmd
                            { name =
255
                                "nrm"
Valentin Reis's avatar
Valentin Reis committed
256
                            , outfile =
257
                                "nrmlisten.out"
Valentin Reis's avatar
Valentin Reis committed
258
                            , errfile =
259
                                "nrmlisten.err"
Valentin Reis's avatar
Valentin Reis committed
260
                            }
Valentin Reis's avatar
Valentin Reis committed
261
                  
Valentin Reis's avatar
Valentin Reis committed
262 263 264 265 266 267 268
                  in    b
                      ⫽ { args =
                            [ "listen", "-u", cn, "--filter", args.filter ]
                        , out =
                              b.out
                            ⫽ { filecheck =
                                    values.emptyCheck
Valentin Reis's avatar
Valentin Reis committed
269 270
                                  ⫽ { wants =
                                              if args.isTest
Valentin Reis's avatar
Valentin Reis committed
271
                                        
Valentin Reis's avatar
Valentin Reis committed
272
                                        then  [ args.filter ]
Valentin Reis's avatar
Valentin Reis committed
273
                                        
Valentin Reis's avatar
Valentin Reis committed
274 275
                                        else  [] : List Text
                                    }
Valentin Reis's avatar
Valentin Reis committed
276 277 278 279
                              }
                        }
                ]

Valentin Reis's avatar
Valentin Reis committed
280 281 282 283 284 285 286
in  let ProgressAppTestArg =
          { cmd :
              Text
          , args :
              List Text
          , vars :
              List types.EnvVar
Valentin Reis's avatar
Valentin Reis committed
287 288
          , passvars :
              List Text
Valentin Reis's avatar
Valentin Reis committed
289 290
          , cmdavoids :
              List Text
Valentin Reis's avatar
Valentin Reis committed
291 292
          , isTest :
              Bool
293 294
          , timeout :
              Optional Natural
Valentin Reis's avatar
Valentin Reis committed
295 296 297 298 299 300 301 302 303 304 305
          }

in  let emptyProgressAppTestArg =
            λ(cmd : Text)
          → λ(args : List Text)
          →   { cmd =
                  cmd
              , args =
                  args
              , vars =
                  [] : List types.EnvVar
Valentin Reis's avatar
Valentin Reis committed
306 307
              , passvars =
                  [] : List Text
Valentin Reis's avatar
Valentin Reis committed
308 309
              , cmdavoids =
                  [] : List Text
Valentin Reis's avatar
Valentin Reis committed
310 311
              , isTest =
                  False
312 313
              , timeout =
                  [] : Optional Natural
Valentin Reis's avatar
Valentin Reis committed
314 315 316 317 318 319
              }
            : ProgressAppTestArg

in  let progressAppTest =
            λ(args : ProgressAppTestArg)
          → appTest
Valentin Reis's avatar
Valentin Reis committed
320 321
            (   emptyFilterTestArgs "progress" args.cmd
              ⫽ { args =
Valentin Reis's avatar
Valentin Reis committed
322
                    args.args
323 324
                , manifestname =
                    "basic.json"
Valentin Reis's avatar
Valentin Reis committed
325 326
                , vars =
                    args.vars
Valentin Reis's avatar
Valentin Reis committed
327 328
                , passvars =
                    args.passvars
Valentin Reis's avatar
Valentin Reis committed
329 330
                , cmdavoids =
                    args.cmdavoids
Valentin Reis's avatar
Valentin Reis committed
331
                , isTest =
Valentin Reis's avatar
Valentin Reis committed
332
                    True
333 334
                , timeout =
                    args.timeout
Valentin Reis's avatar
Valentin Reis committed
335 336 337
                }
            )

Valentin Reis's avatar
Valentin Reis committed
338 339
in  { values =
        values
Valentin Reis's avatar
Valentin Reis committed
340 341
    , emptyMakeBaseArgs =
        emptyMakeBaseArgs
Valentin Reis's avatar
Valentin Reis committed
342 343 344 345 346 347
    , makeBase =
        makeBase
    , makeExtended =
        makeExtended
    , appTest =
        appTest
Valentin Reis's avatar
Valentin Reis committed
348 349
    , progressAppTest =
        progressAppTest
Valentin Reis's avatar
Valentin Reis committed
350 351 352 353
    , emptyFilterTestArgs =
        emptyFilterTestArgs
    , qmcPackDir =
        qmcPackDir
Valentin Reis's avatar
Valentin Reis committed
354 355
    , openmcDir =
        openmcDir
Valentin Reis's avatar
Valentin Reis committed
356 357
    , lammpsDir =
        lammpsDir
Valentin Reis's avatar
Valentin Reis committed
358 359
    , manifestDir =
        manifestDir
Valentin Reis's avatar
Valentin Reis committed
360 361
    , emptyProgressAppTestArg =
        emptyProgressAppTestArg
Valentin Reis's avatar
Valentin Reis committed
362
    }