Commit 08a2534a authored by Valentin Reis's avatar Valentin Reis
Browse files

dhrun workflow refactor

parent 3bd455f1
let lib = ./lib.dh
let lib = ./lib.dh
in let message = "HelloWorld"
let message = "HelloWorld"
in let cn = "testContainer"
let cn = "testContainer"
in let basicManifest = lib.manifestDir ++ "basic.json"
let basicManifest = lib.manifestDir ++ "basic.json"
in let argIfTest =
λ(isTest : Bool)
→ { isTest =
isTest
, timeout =
if isTest
then [ 600 ] : Optional Natural
else [] : Optional Natural
}
let argIfTest =
λ(isTest : Bool)
→ { isTest =
isTest
, timeout =
if isTest then [ 600 ] : Optional Natural else [] : Optional Natural
}
in let apps =
{ qmcpack =
λ(isTest : Bool)
→ lib.progressAppTest
( lib.emptyProgressAppTestArg
"mpiexec"
[ "-n"
, if isTest then "2" else "24"
, "qmcpack"
, lib.qmcPackDir ++ "/simple-H2O.xml"
]
⫽ argIfTest isTest
⫽ { cmdavoids = [ "Error", "error", "ERROR" ] }
)
, lammps =
λ(isTest : Bool)
→ lib.progressAppTest
( lib.emptyProgressAppTestArg
"mpiexec"
[ "-n"
, if isTest then "2" else "24"
, "-bind-to"
, "core"
, "lmp_mpi"
, "-i"
, lib.lammpsDir ++ "/modified.lj"
]
⫽ argIfTest isTest
⫽ { cmdavoids = [ "Error", "error", "ERROR" ] }
)
, openmc =
λ(isTest : Bool)
→ lib.progressAppTest
( lib.emptyProgressAppTestArg
"mpiexec"
[ "-n", if isTest then "2" else "24", "openmc" ]
⫽ argIfTest isTest
⫽ { passvars =
[ "OPENMC_CROSS_SECTIONS" ]
, cmdavoids =
[ "Error", "error", "ERROR" ]
}
)
⫽ { pre =
[ "cp --no-preserve=mode -r " ++ lib.openmcDir ++ "/* ." ]
let Powercap = < Cap : Text | NoCap : {} >
let apps =
{ qmcpack =
λ(isTest : Bool)
→ λ(powercap : Powercap)
→ lib.extendApp
( lib.progressAppTest
( lib.emptyProgressAppTestArg
"mpiexec"
[ "-n"
, if isTest then "2" else "24"
, "qmcpack"
, lib.qmcPackDir ++ "/simple-H2O.xml"
]
⫽ argIfTest isTest
⫽ { cmdavoids =
[ "Error", "error", "ERROR" ]
, powercap =
powercap
}
, amg =
λ(isTest : Bool)
→ lib.progressAppTest
)
)
isTest
, lammps =
λ(isTest : Bool)
→ λ(powercap : Powercap)
→ lib.extendApp
( lib.progressAppTest
( lib.emptyProgressAppTestArg
"mpiexec"
[ "-n"
, if isTest then "2" else "24"
, "-bind-to"
, "core"
, "lmp_mpi"
, "-i"
, lib.lammpsDir ++ "/modified.lj"
]
⫽ argIfTest isTest
⫽ { cmdavoids =
[ "Error", "error", "ERROR" ]
, powercap =
powercap
}
)
)
isTest
, openmc =
λ(isTest : Bool)
→ λ(powercap : Powercap)
→ lib.extendApp
( lib.progressAppTest
( lib.emptyProgressAppTestArg
"mpiexec"
[ "-n"
, if isTest then "2" else "24"
, "amg"
, "-problem"
, "2"
, "-n"
, "90"
, "90"
, "90"
, "-P"
, "2"
, if isTest then "1" else "12"
, "1"
]
⫽ argIfTest isTest
⫽ { vars =
[ { varname = "OMP_NUM_THREADS", value = "1" } ]
, cmdavoids =
[ "Error", "error", "ERROR" ]
}
)
, stream =
λ(isTest : Bool)
→ lib.progressAppTest
( lib.emptyProgressAppTestArg "stream_c" ([] : List Text)
[ "-n", if isTest then "2" else "24", "openmc" ]
⫽ argIfTest isTest
⫽ { vars =
[ { varname =
"OMP_NUM_THREADS"
, value =
if isTest then "2" else "24"
}
, { varname = "OMP_PLACES", value = "cores" }
]
⫽ { passvars =
[ "OPENMC_CROSS_SECTIONS" ]
, cmdavoids =
[ "Error", "error", "ERROR" ]
, powercap =
powercap
}
)
}
⫽ { pre =
[ "cp --no-preserve=mode -r " ++ lib.openmcDir ++ "/* ." ]
}
)
isTest
, amg =
λ(isTest : Bool)
→ λ(powercap : Powercap)
→ lib.extendApp
( lib.progressAppTest
( lib.emptyProgressAppTestArg
"mpiexec"
[ "-n"
, if isTest then "2" else "24"
, "amg"
, "-problem"
, "2"
, "-n"
, "90"
, "90"
, "90"
, "-P"
, "2"
, if isTest then "1" else "12"
, "1"
]
⫽ argIfTest isTest
⫽ { vars =
[ { varname = "OMP_NUM_THREADS", value = "1" } ]
, cmdavoids =
[ "Error", "error", "ERROR" ]
, powercap =
powercap
}
)
)
isTest
, stream =
λ(isTest : Bool)
→ λ(powercap : Powercap)
→ lib.extendApp
( lib.progressAppTest
( lib.emptyProgressAppTestArg "stream_c" ([] : List Text)
⫽ argIfTest isTest
⫽ { vars =
[ { varname =
"OMP_NUM_THREADS"
, value =
if isTest then "2" else "24"
}
, { varname = "OMP_PLACES", value = "cores" }
]
, cmdavoids =
[ "Error", "error", "ERROR" ]
, powercap =
powercap
}
)
)
isTest
}
in { hello =
in { apps =
apps
, hello =
lib.makeBase
( lib.emptyMakeBaseArgs "echo" basicManifest cn
⫽ { args =
......@@ -174,23 +208,13 @@ in { hello =
}
)
, stream =
apps.stream True
apps.stream True < NoCap = {=} | Cap : Text >
, openmc =
apps.openmc True
apps.openmc True < NoCap = {=} | Cap : Text >
, lammps =
apps.lammps True
apps.lammps True < NoCap = {=} | Cap : Text >
, qmcpack =
apps.qmcpack True
apps.qmcpack True < NoCap = {=} | Cap : Text >
, amg =
apps.amg True
, streamRun =
apps.stream False
, openmcRun =
apps.openmc False
, lammpsRun =
apps.lammps False
, qmcpackRun =
apps.qmcpack False
, amgRun =
apps.amg False
apps.amg True < NoCap = {=} | Cap : Text >
}
let values =
https://xgitlab.cels.anl.gov/argo/dhrun/raw/master/resources/package.dh
let values =
https://xgitlab.cels.anl.gov/argo/dhrun/raw/master/resources/package.dh
in let types =
https://xgitlab.cels.anl.gov/argo/dhrun/raw/master/resources/types.dh
let types =
https://xgitlab.cels.anl.gov/argo/dhrun/raw/master/resources/types.dh
in let dataDir = env:DHRUNSPECS as Text ++ "/"
let dataDir = "./"
in let manifestDir = dataDir ++ "manifests/"
let manifestDir = dataDir ++ "manifests/"
in let assetDir = dataDir ++ "assets/"
let assetDir = dataDir ++ "assets/"
in let openmcDir = assetDir ++ "openmc/"
let openmcDir = assetDir ++ "openmc/"
in let lammpsDir = assetDir
let lammpsDir = assetDir
in let qmcPackDir = assetDir
let qmcPackDir = assetDir
in let basicCommand =
λ ( args
: { name :
Text
, outprefix :
Text
, outwants :
List Text
, outavoids :
List Text
}
)
→ { name =
args.name
, args =
[] : List Text
, out =
{ filename =
"${args.outprefix}.out"
, filecheck =
{ wants = args.outwants, avoids = args.outavoids }
}
, err =
{ filename =
"${args.outprefix}.err"
, filecheck =
values.emptyCheck ⫽ { avoids = args.outavoids }
}
, postchecks =
[] : List types.FileCheck
, vars =
values.emptyVars
, passvars =
[ "PATH" ]
, timeout =
[] : Optional Natural
let basicCommand =
λ ( args
: { name :
Text
, outprefix :
Text
, outwants :
List Text
, outavoids :
List Text
}
)
→ { name =
args.name
, args =
[] : List Text
, out =
{ filename =
"${args.outprefix}.out"
, filecheck =
{ wants = args.outwants, avoids = args.outavoids }
}
, err =
{ filename =
"${args.outprefix}.err"
, filecheck =
values.emptyCheck ⫽ { avoids = args.outavoids }
}
, postchecks =
[] : List types.FileCheck
, vars =
values.emptyVars
, passvars =
[ "PATH" ]
, timeout =
[] : Optional Natural
}
let Powercap = < Cap : Text | NoCap : {} >
let MakeBaseArgs =
{ manifest :
Text
, cmd :
Text
, containerName :
Text
, args :
List Text
, verbose :
Bool
, cmdwants :
List Text
, cmdavoids :
List Text
, vars :
List types.EnvVar
, timeout :
Optional Natural
, passvars :
List Text
, powercap :
Powercap
}
in let MakeBaseArgs =
{ manifest :
Text
, cmd :
Text
, containerName :
Text
, args :
List Text
, verbose :
Bool
, cmdwants :
List Text
, cmdavoids :
List Text
, vars :
List types.EnvVar
, passvars :
List Text
, timeout :
Optional Natural
let emptyMakeBaseArgs =
λ(cmd : Text)
→ λ(manifest : Text)
→ λ(containerName : Text)
→ { manifest =
manifest
, cmd =
cmd
, containerName =
containerName
, args =
[] : List Text
, verbose =
False
, cmdwants =
[] : List Text
, cmdavoids =
[] : List Text
, vars =
values.emptyVars
, timeout =
[] : Optional Natural
, passvars =
[] : List Text
, powercap =
< NoCap = {=} | Cap : Text >
}
: MakeBaseArgs
in let emptyMakeBaseArgs =
λ(cmd : Text)
→ λ(manifest : Text)
→ λ(containerName : Text)
→ { manifest =
manifest
, cmd =
cmd
, containerName =
containerName
, args =
[] : List Text
, verbose =
False
, cmdwants =
[] : List Text
, cmdavoids =
[] : List Text
, vars =
values.emptyVars
, passvars =
[] : List Text
}
let addVerbose = λ(v : Bool) → if v then [ "--verbose" ] else [] : List Text
in let addVerbose = λ(v : Bool) → if v then [ "--verbose" ] else [] : List Text
let addPowercap =
λ(p : Powercap)
→ merge
{ Cap =
λ(x : Text) → [ "--powercap", x ]
, NoCap =
λ(x : {}) → [] : List Text
}
p
in let makeBase =
λ(args : MakeBaseArgs)
→ { cmds =
[ basicCommand
let makeBase =
λ(args : MakeBaseArgs)
→ { cmds =
[ basicCommand
{ name =
"nrmd"
, outprefix =
"nrmd"
, outwants =
[] : List Text
, outavoids =
[ "Traceback" ] : List Text
}
⫽ { args =
[ "--nrm_log", "./nrm_log" ]
# addVerbose args.verbose
# addPowercap args.powercap
, vars =
[ { varname =
"ARGO_NODEOS_CONFIG"
, value =
"/tmp/argo_nodeos_config"
}
]
}
, let b =
basicCommand
{ name =
"nrmd"
"nrm"
, outprefix =
"nrmd"
"nrmrun"
, outwants =
[] : List Text
args.cmdwants
, outavoids =
[ "Traceback" ] : List Text
args.cmdavoids
}
in b
⫽ { args =
[ "--nrm_log", "./nrm_log" ] # addVerbose args.verbose
, vars =
[ { varname =
"ARGO_NODEOS_CONFIG"
, value =
"/tmp/argo_nodeos_config"
}
]
[ "run"
, "-u"
, args.containerName
, args.manifest
, args.cmd
]
# args.args
, passvars =
b.passvars # args.passvars
, timeout =
args.timeout
}
, let b =
basicCommand
{ name =
"nrm"
, outprefix =
"nrmrun"
, outwants =
args.cmdwants
, outavoids =
args.cmdavoids
}
in b
⫽ { args =
[ "run"
, "-u"
, args.containerName
, args.manifest
, args.cmd
]
# args.args
, passvars =
b.passvars # args.passvars
, timeout =
args.timeout
}
]
, verbose =
True
, cleaning =
True
, workdir =
"./_output"
, pre =
[] : List Text
, post =
[] : List Text
}
: types.Config
]
, verbose =
True
, cleaning =
True
, workdir =
"./_output"
, pre =
[] : List Text
, post =
[] : List Text
}
: types.Config
let makeExtended =
λ(args : MakeBaseArgs)
→ λ(cmds : List types.Cmd)
→ let b = makeBase args in b ⫽ { cmds = b.cmds # cmds }
in let makeExtended =
λ(args : MakeBaseArgs)
→ λ(cmds : List types.Cmd)
→ let b = makeBase args in b ⫽ { cmds = b.cmds # cmds }
let OptionalSleep = < Cmd : Text | Sleep : {} >
in let OptionalSleep = < Cmd : Text | Sleep : {} >
let FilterTestArgs =
{ manifestname :
Text
, filter :
Text
, cmd :
Text
, args :
List Text
, vars :
List types.EnvVar
, passvars :
List Text
, cmdavoids :
List Text
, isTest :
Bool
, timeout :
Optional Natural
, powercap :
Powercap
}
in let FilterTestArgs =
{ manifestname :
Text
, filter :
Text
, cmd :
Text
, args :
List Text
, vars :
List types.EnvVar
, passvars :
List Text
, cmdavoids :
List Text
, isTest :
Bool
, timeout :