Commit 22e870cd authored by Valentin Reis's avatar Valentin Reis
Browse files

dhrun codebase as a function. naturally..

parent f83e81dd
Pipeline #7362 failed with stages
in 22 minutes and 16 seconds
let lib = ./lib.dh
λ(dataDir : Text)
→ let lib = ./lib.dh dataDir
let message = "HelloWorld"
let message = "HelloWorld"
let cn = "testContainer"
let cn = "testContainer"
let basicManifest = lib.manifestDir ++ "basic.json"
let basicManifest = lib.manifestDir ++ "basic.json"
let singularityManifest = lib.manifestDir ++ "singularity.json"
let singularityManifest = lib.manifestDir ++ "singularity.json"
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
let Powercap = < Cap : Text | NoCap : {} >
then [ 600 ] : Optional Natural
in { run-singularity =
lib.makeBase
( lib.emptyMakeBaseArg "echo" singularityManifest cn
⫽ { args =
[ message ]
, verbose =
True
, singularity =
True
, cmdwants =
[] : List Text
, cmdavoids =
[ "Traceback" ]
, timeout =
[ 600 ] : Optional Natural
}
)
, run =
lib.makeBase
( lib.emptyMakeBaseArg "echo" basicManifest cn
⫽ { args =
[ message ]
, verbose =
True
, cmdwants =
[] : List Text
, cmdavoids =
[ "Traceback" ]
, timeout =
[ 600 ] : Optional Natural
}
)
, pwd =
lib.makeBase
( lib.emptyMakeBaseArg "pwd" basicManifest cn
⫽ { args =
[] : List Text
, verbose =
True
, cmdwants =
[ "toto" ] : List Text
, cmdavoids =
[ "Traceback" ]
, timeout =
[ 600 ] : Optional Natural
, runwd =
[ "toto" ] : Optional Text
}
)
, hello =
lib.makeBase
( lib.emptyMakeBaseArg "echo" basicManifest cn
⫽ { args =
[ message ]
, verbose =
True
, cmdwants =
[ message ]
, cmdavoids =
[ "Traceback" ]
, timeout =
[ 600 ] : Optional Natural
}
)
, listen =
lib.makeExtended
( lib.emptyMakeBaseArg "sleep" basicManifest cn
⫽ { args =
[ "1" ]
, verbose =
True
, cmdwants =
[] : List Text
, cmdavoids =
[ "Traceback" ]
, timeout =
[ 600 ] : Optional Natural
}
)
[ lib.values.emptyCmd
{ name =
"nrm"
, outfile =
"nrmlisten.out"
, errfile =
"nrmlisten.err"
}
⫽ { args = [ "listen", "-u", cn ] }
]
, power =
lib.appTest
( lib.emptyFilterTestArgs "power" "sleep"
⫽ { timeout =
[ 600 ] : Optional Natural
, args =
[ "15" ]
, isTest =
True
}
)
, performance =
lib.appTest
( lib.emptyFilterTestArgs "performance" "sleep"
⫽ { timeout =
[ 600 ] : Optional Natural
, args =
[ "15" ]
, isTest =
True
, manifestname =
"perfwrap.json"
}
)
, 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
}
)
else [] : Optional Natural
}
let Powercap = < Cap : Text | NoCap : {} >
in { run-singularity =
lib.makeBase
( lib.emptyMakeBaseArg "echo" singularityManifest cn
⫽ { args =
[ message ]
, verbose =
True
, singularity =
True
, cmdwants =
[] : List Text
, cmdavoids =
[ "Traceback" ]
, timeout =
[ 600 ] : Optional Natural
}
)
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
, run =
lib.makeBase
( lib.emptyMakeBaseArg "echo" basicManifest cn
⫽ { args =
[ message ]
, verbose =
True
, cmdwants =
[] : List Text
, cmdavoids =
[ "Traceback" ]
, timeout =
[ 600 ] : Optional Natural
}
)
, pwd =
lib.makeBase
( lib.emptyMakeBaseArg "pwd" basicManifest cn
⫽ { args =
[] : List Text
, verbose =
True
, cmdwants =
[ "toto" ] : List Text
, cmdavoids =
[ "Traceback" ]
, timeout =
[ 600 ] : Optional Natural
, runwd =
[ "toto" ] : Optional Text
}
)
, hello =
lib.makeBase
( lib.emptyMakeBaseArg "echo" basicManifest cn
⫽ { args =
[ message ]
, verbose =
True
, cmdwants =
[ message ]
, cmdavoids =
[ "Traceback" ]
, timeout =
[ 600 ] : Optional Natural
}
)
, listen =
lib.makeExtended
( lib.emptyMakeBaseArg "sleep" basicManifest cn
⫽ { args =
[ "1" ]
, verbose =
True
, cmdwants =
[] : List Text
, cmdavoids =
[ "Traceback" ]
, timeout =
[ 600 ] : Optional Natural
}
)
[ lib.values.emptyCmd
{ name =
"nrm"
, outfile =
"nrmlisten.out"
, errfile =
"nrmlisten.err"
}
⫽ { args = [ "listen", "-u", cn ] }
]
, power =
lib.appTest
( lib.emptyFilterTestArgs "power" "sleep"
⫽ { timeout =
[ 600 ] : Optional Natural
, args =
[ "15" ]
, isTest =
True
}
)
, performance =
lib.appTest
( lib.emptyFilterTestArgs "performance" "sleep"
⫽ { timeout =
[ 600 ] : Optional Natural
, args =
[ "15" ]
, isTest =
True
, manifestname =
"perfwrap.json"
}
)
, 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
}
)
)
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", "openmc" ]
⫽ argIfTest isTest
⫽ { passvars =
[ "OPENMC_CROSS_SECTIONS" ]
, cmdavoids =
[ "Error" ]
, powercap =
powercap
}
)
⫽ { pre =
[ "cp --no-preserve=mode -r " ++ lib.openmcDir ++ "/* ." ]
}
)
)
isTest
, openmc =
λ(isTest : Bool)
→ λ(powercap : Powercap)
→ lib.extendApp
( lib.progressAppTest
isTest
, amg =
λ(isTest : Bool)
→ λ(powercap : Powercap)
→ lib.extendApp
( lib.progressAppTest
( lib.emptyProgressAppTestArg
"mpiexec"
[ "-n", if isTest then "2" else "24", "openmc" ]
[ "-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
⫽ { passvars =
[ "OPENMC_CROSS_SECTIONS" ]
⫽ { vars =
[ { varname = "OMP_NUM_THREADS", value = "1" } ]
, cmdavoids =
[ "Error" ]
[ "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
, 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
}
isTest
}
This diff is collapsed.
{
"acKind": "ImageManifest",
"acVersion": "0.6.0",
"name": "test",
"name": "basic",
"version": "0.0.1",
"app": {
"isolators": [
{
"name": "argo/scheduler",
"value": {
"policy": "SCHED_OTHER",
"priority": "0"
}
},
{
"name": "argo/container",
"value": {
"cpus": "2",
"mems": "1"
}
},
{
"name": "argo/perfwrapper",
"value": {
"enabled": "0"
}
},
{
"name": "argo/power",
"value": {
"enabled": "0",
"profile": "0",
"policy": "NONE",
"damper": "0.1",
"slowdown": "1.1"
}
},
{
"name": "argo/monitoring",
"value": {
"enabled": "1",
"ratelimit": "1000000000"
}
}
"container": {
"cpus": 2,
"mems": 1
}
},
"image": {
"path": "docker://ubuntu",
"type": "docker",
"binds": [
"/nix"
]
}
}
{
"acKind": "ImageManifest",
"acVersion": "0.6.0",
"name": "test",
"app": {
"isolators": [
{
"name": "argo/scheduler",
"value": {
"policy": "SCHED_OTHER",
"priority": "0"
}
},
{
"name": "argo/container",
"value": {
"cpus": "1",
"mems": "1"
}
},
{
"name": "argo/perfwrapper",
"value": {
"enabled": "0"
}
},
{
"name": "argo/power",
"value": {
"enabled": "1",
"profile": "1",
"policy": "NONE",
"damper": "1e9",
"slowdown": "1.1"
}
},
{
"name": "argo/monitoring",
"value": {
"enabled": "1",
"ratelimit": "10000000"
}
},
{
"name": "argo/hwbind",
"value": {
"enabled": "0"
}
}
]
},
"image": {
"path": "docker://ubuntu",
"type": "docker",
"binds": [ "/nix" ]
}
"name": "basic",
"version": "0.0.1",
"app": {
"container": {
"cpus": 1,
"mems": 1
}
},
"image": {
"path": "docker://ubuntu",
"type": "docker",
"binds": [
"/nix"
]
}
}
......@@ -434,19 +434,15 @@ let
doDhrun = dhrscript: test.overrideAttrs (old:{
buildPhase = ''
cat ${dhrscript} |\
dhall resolve |\
dhall normalize |\
dhall-to-yaml |\
dhrun run "-"
cat $DHRUNSCRIPT | dhall resolve | dhall normalize | dhall-to-yaml | dhrun run "-"
'';
buildInputs = old.buildInputs ++ [
dhall-json
pkgs.yq
dhall