Commit 5786cc19 authored by Valentin Reis's avatar Valentin Reis

refactor complete.

parent 9f78ce0d
λ(dataDir : Text)
→ λ(manifestDir : Text)
→ λ(isTest : Bool)
→ let lib = ./lib.dh dataDir manifestDir
let assetDir = dataDir ++ "assets/"
→ let assetDir = dataDir ++ "assets/"
let types = ./resources/types.dh
......@@ -15,6 +13,32 @@
let cn = "testContainer"
let idCmd = let id = λ(a : Type) → λ(x : a) → x in id types.Cmd
let makeExtended =
λ(daemonArg : argotypes.MkDaemon)
→ λ(daemonOverrides : types.Cmd → types.Cmd)
→ λ(runArg : argotypes.MkRun)
→ λ(runOverrides : types.Cmd → types.Cmd)
→ λ(extraCmds : List types.Cmd)
→ { cmds =
[ daemonOverrides (argo.nrmd.mk daemonArg)
, runOverrides (argo.run.mk runArg)
]
# extraCmds
, verbose =
True
, cleaning =
True
, workdir =
"./_output"
, pre =
[] : List Text
, post =
[] : List Text
}
: types.Config
let manifests =
{ basic =
manifestDir ++ "basic.yml"
......@@ -40,7 +64,7 @@
λ(runArg : argotypes.MkRun)
→ λ(runOverrides : types.Cmd → types.Cmd)
→ λ(extraCmds : List types.Cmd)
lib.makeExtended
→ makeExtended
( argo.nrmd.defarg
⫽ { daemonavoids =
ifTestList [ "Traceback", "ValueError" ]
......@@ -48,8 +72,10 @@
< NoCap = {=} | Cap : Text > : argotypes.Powercap
}
)
lib.idCmd
(runArg ⫽ { cmdavoids = ifTestList [ "Traceback" ] })
idCmd
( runArg
⫽ { cmdavoids = runArg.cmdavoids # ifTestList [ "Traceback" ] }
)
(λ(c : types.Cmd) → runOverrides (c ⫽ { timeout = ifTestTimeout }))
extraCmds
......@@ -58,16 +84,14 @@
→ λ(runOverrides : types.Cmd → types.Cmd)
→ withDaemon runArg runOverrides ([] : List types.Cmd)
let withDaemonExtraPerftest =
let withDaemonExtraProgresstest =
λ(runArg : argotypes.MkRun)
→ λ(runOverrides : types.Cmd → types.Cmd)
→ withDaemon
runArg
runOverrides
[ argo.listen.mk
( argo.listen.defarg cn
⫽ { filter = "performance", doFilter = True }
)
(argo.listen.defarg cn ⫽ { filter = "progress", doFilter = True })
]
let basicRun = λ(name : Text) → argo.run.defarg name manifests.basic cn
......@@ -75,7 +99,7 @@
let perfRun = λ(name : Text) → argo.run.defarg name manifests.perf cn
in { run =
withDaemonNoExtras (basicRun "true") lib.idCmd
withDaemonNoExtras (basicRun "true") idCmd
, pwd =
let somedir = "toto"
......@@ -91,24 +115,31 @@
( basicRun "echo"
⫽ { args = [ message ], cmdwants = [ message ] : List Text }
)
lib.idCmd
idCmd
, listen =
withDaemon
(basicRun "sleep" ⫽ { args = [ "1" ] })
lib.idCmd
idCmd
[ argo.listen.mk (argo.listen.defarg cn ⫽ { doFilter = False }) ]
, power =
withDaemon
(basicRun "sleep" ⫽ { args = [ "15" ] })
lib.idCmd
idCmd
[ argo.listen.mk
(argo.listen.defarg cn ⫽ { filter = "power", doFilter = True })
]
, performance =
withDaemon (perfRun "sleep" ⫽ { args = [ "15" ] }) lib.idCmd
withDaemon
(perfRun "sleep" ⫽ { args = [ "15" ] })
idCmd
[ argo.listen.mk
( argo.listen.defarg cn
⫽ { filter = "performance", doFilter = True }
)
]
, qmcpack =
withDaemonExtraPerftest
( perfRun "mpiexec"
withDaemonExtraProgresstest
( basicRun "mpiexec"
⫽ { args =
[ if isTest then "2" else "24"
, "qmcpack"
......@@ -118,10 +149,10 @@
[ "Error", "error", "ERROR" ]
}
)
lib.idCmd
idCmd
, lammps =
withDaemonExtraPerftest
( perfRun "mpiexec"
withDaemonExtraProgresstest
( basicRun "mpiexec"
⫽ { args =
[ "-n"
, if isTest then "2" else "24"
......@@ -135,10 +166,10 @@
[ "Error", "error", "ERROR" ]
}
)
lib.idCmd
idCmd
, openmc =
withDaemonExtraPerftest
( perfRun "mpiexec"
withDaemonExtraProgresstest
( basicRun "mpiexec"
⫽ { args =
[ "-n", if isTest then "2" else "24", "openmc" ]
, cmdavoids =
......@@ -147,11 +178,13 @@
[ "OPENMC_CROSS_SECTIONS" ]
}
)
lib.idCmd
⫽ { pre = [ "cp --no-preserve=mode -r " ++ lib.openmcDir ++ "/* ." ] }
idCmd
⫽ { pre =
[ "cp --no-preserve=mode -r " ++ assetDir ++ "openmc/* ." ]
}
, amg =
withDaemonExtraPerftest
( perfRun "mpiexec"
withDaemonExtraProgresstest
( basicRun "mpiexec"
⫽ { args =
[ "-n"
, if isTest then "2" else "24"
......@@ -175,8 +208,8 @@
→ x ⫽ { vars = [ { varname = "OMP_NUM_THREADS", value = "1" } ] }
)
, stream =
withDaemonExtraPerftest
( perfRun "stream_c"
withDaemonExtraProgresstest
( basicRun "stream_c"
⫽ { args =
[] : List Text
, cmdavoids =
......
......@@ -15,7 +15,7 @@ let defaultMkListen =
, filter =
","
, containerName =
"containerName"
containerName
}
: argotypes.MkListen
......
λ(dataDir : Text)
→ λ(manifestDir : Text)
→ let values = ./resources/package.dh
let types = ./resources/types.dh
let argotypes = ./argo/types.dh
let argo = ./argo/package.dh
let assetDir = dataDir ++ "assets/"
let openmcDir = assetDir ++ "openmc/"
let lammpsDir = assetDir
let qmcPackDir = assetDir
let Powercap = < Cap : Text | NoCap : {} >
let id = λ(a : Type) → λ(x : a) → x
let idCmd = id types.Cmd
let makeExtended =
λ(daemonArg : argotypes.MkDaemon)
→ λ(daemonOverrides : types.Cmd → types.Cmd)
→ λ(runArg : argotypes.MkRun)
→ λ(runOverrides : types.Cmd → types.Cmd)
→ λ(extraCmds : List types.Cmd)
→ { cmds =
[ daemonOverrides (argo.nrmd.mk daemonArg)
, runOverrides (argo.run.mk runArg)
]
# extraCmds
, verbose =
True
, cleaning =
True
, workdir =
"./_output"
, pre =
[] : List Text
, post =
[] : List Text
}
: types.Config
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
}
let emptyFilterTestArgs =
λ(filter : Text)
→ λ(cmd : Text)
→ { cmd =
cmd
, manifestname =
"perfwrap.yml"
, filter =
filter
, args =
[] : List Text
, vars =
values.emptyVars
, passvars =
[] : List Text
, cmdavoids =
[] : List Text
, isTest =
False
, timeout =
[] : Optional Natural
, powercap =
< NoCap = {=} | Cap : Text >
}
: FilterTestArgs
let appTest =
let cn = "containerName"
in λ(args : FilterTestArgs)
→ makeExtended
{ powercap =
args.powercap
, verbose =
True
, singularity =
False
, daemonavoids =
[ "Traceback", "ValueError" ]
}
idCmd
{ manifest =
manifestDir
++ ( if args.isTest
then args.manifestname
else "parallel.yml"
)
, containerName =
cn
, cmd =
args.cmd
, args =
args.args
, cmdwants =
[] : List Text
, cmdavoids =
args.cmdavoids
, passvars =
args.passvars
}
( λ(c : types.Cmd)
→ c ⫽ { timeout = args.timeout, vars = args.vars }
)
[ argo.listen.mk
(argo.listen.defarg cn ⫽ { filter = args.filter })
]
let ProgressAppTestArg =
{ cmd :
Text
, args :
List Text
, vars :
List types.EnvVar
, passvars :
List Text
, cmdavoids :
List Text
, isTest :
Bool
, timeout :
Optional Natural
, powercap :
Powercap
}
let emptyProgressAppTestArg =
λ(cmd : Text)
→ λ(args : List Text)
→ { cmd =
cmd
, args =
args
, vars =
[] : List types.EnvVar
, passvars =
[] : List Text
, cmdavoids =
[] : List Text
, isTest =
False
, timeout =
[] : Optional Natural
, powercap =
< NoCap = {=} | Cap : Text >
}
: ProgressAppTestArg
let progressAppTest =
λ(args : ProgressAppTestArg)
→ appTest
( emptyFilterTestArgs "progress" args.cmd
⫽ { args =
args.args
, manifestname =
"basic.yml"
, vars =
args.vars
, passvars =
args.passvars
, cmdavoids =
args.cmdavoids
, isTest =
args.isTest
, timeout =
args.timeout
, powercap =
args.powercap
}
)
let mkListen =
λ(cn : Text)
→ λ(filter : Text)
→ let b =
values.emptyCmd
{ name =
"nrm"
, outfile =
filter ++ ".out"
, errfile =
filter ++ ".err"
}
in b ⫽ { args = [ "listen", "-u", cn, "--filter", filter ] }
let powerexpeCmds =
let cn = "containerName"
in [ argo.listen.mk (argo.listen.defarg cn ⫽ { filter = "power" })
, argo.listen.mk
(argo.listen.defarg cn ⫽ { filter = "performance" })
, argo.listen.mk (argo.listen.defarg cn ⫽ { filter = "control" })
]
: List types.Cmd
let extendApp =
λ(c : types.Config)
→ λ(isTest : Bool)
→ if isTest then c else c ⫽ { cmds = c.cmds # powerexpeCmds }
in { values =
values
, makeExtended =
makeExtended
, appTest =
appTest
, progressAppTest =
progressAppTest
, emptyFilterTestArgs =
emptyFilterTestArgs
, qmcPackDir =
qmcPackDir
, openmcDir =
openmcDir
, lammpsDir =
lammpsDir
, manifestDir =
manifestDir
, emptyProgressAppTestArg =
emptyProgressAppTestArg
, powerexpeCmds =
powerexpeCmds
, extendApp =
extendApp
, idCmd =
id types.Cmd
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment