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

refactor complete.

parent 9f78ce0d
λ(dataDir : Text) λ(dataDir : Text)
→ λ(manifestDir : Text) → λ(manifestDir : Text)
→ λ(isTest : Bool) → λ(isTest : Bool)
→ let lib = ./lib.dh dataDir manifestDir → let assetDir = dataDir ++ "assets/"
let assetDir = dataDir ++ "assets/"
let types = ./resources/types.dh let types = ./resources/types.dh
...@@ -15,6 +13,32 @@ ...@@ -15,6 +13,32 @@
let cn = "testContainer" 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 = let manifests =
{ basic = { basic =
manifestDir ++ "basic.yml" manifestDir ++ "basic.yml"
...@@ -40,7 +64,7 @@ ...@@ -40,7 +64,7 @@
λ(runArg : argotypes.MkRun) λ(runArg : argotypes.MkRun)
→ λ(runOverrides : types.Cmd → types.Cmd) → λ(runOverrides : types.Cmd → types.Cmd)
→ λ(extraCmds : List types.Cmd) → λ(extraCmds : List types.Cmd)
lib.makeExtended → makeExtended
( argo.nrmd.defarg ( argo.nrmd.defarg
⫽ { daemonavoids = ⫽ { daemonavoids =
ifTestList [ "Traceback", "ValueError" ] ifTestList [ "Traceback", "ValueError" ]
...@@ -48,8 +72,10 @@ ...@@ -48,8 +72,10 @@
< NoCap = {=} | Cap : Text > : argotypes.Powercap < NoCap = {=} | Cap : Text > : argotypes.Powercap
} }
) )
lib.idCmd idCmd
(runArg ⫽ { cmdavoids = ifTestList [ "Traceback" ] }) ( runArg
⫽ { cmdavoids = runArg.cmdavoids # ifTestList [ "Traceback" ] }
)
(λ(c : types.Cmd) → runOverrides (c ⫽ { timeout = ifTestTimeout })) (λ(c : types.Cmd) → runOverrides (c ⫽ { timeout = ifTestTimeout }))
extraCmds extraCmds
...@@ -58,16 +84,14 @@ ...@@ -58,16 +84,14 @@
→ λ(runOverrides : types.Cmd → types.Cmd) → λ(runOverrides : types.Cmd → types.Cmd)
→ withDaemon runArg runOverrides ([] : List types.Cmd) → withDaemon runArg runOverrides ([] : List types.Cmd)
let withDaemonExtraPerftest = let withDaemonExtraProgresstest =
λ(runArg : argotypes.MkRun) λ(runArg : argotypes.MkRun)
→ λ(runOverrides : types.Cmd → types.Cmd) → λ(runOverrides : types.Cmd → types.Cmd)
→ withDaemon → withDaemon
runArg runArg
runOverrides runOverrides
[ argo.listen.mk [ argo.listen.mk
( argo.listen.defarg cn (argo.listen.defarg cn ⫽ { filter = "progress", doFilter = True })
⫽ { filter = "performance", doFilter = True }
)
] ]
let basicRun = λ(name : Text) → argo.run.defarg name manifests.basic cn let basicRun = λ(name : Text) → argo.run.defarg name manifests.basic cn
...@@ -75,7 +99,7 @@ ...@@ -75,7 +99,7 @@
let perfRun = λ(name : Text) → argo.run.defarg name manifests.perf cn let perfRun = λ(name : Text) → argo.run.defarg name manifests.perf cn
in { run = in { run =
withDaemonNoExtras (basicRun "true") lib.idCmd withDaemonNoExtras (basicRun "true") idCmd
, pwd = , pwd =
let somedir = "toto" let somedir = "toto"
...@@ -91,24 +115,31 @@ ...@@ -91,24 +115,31 @@
( basicRun "echo" ( basicRun "echo"
⫽ { args = [ message ], cmdwants = [ message ] : List Text } ⫽ { args = [ message ], cmdwants = [ message ] : List Text }
) )
lib.idCmd idCmd
, listen = , listen =
withDaemon withDaemon
(basicRun "sleep" ⫽ { args = [ "1" ] }) (basicRun "sleep" ⫽ { args = [ "1" ] })
lib.idCmd idCmd
[ argo.listen.mk (argo.listen.defarg cn ⫽ { doFilter = False }) ] [ argo.listen.mk (argo.listen.defarg cn ⫽ { doFilter = False }) ]
, power = , power =
withDaemon withDaemon
(basicRun "sleep" ⫽ { args = [ "15" ] }) (basicRun "sleep" ⫽ { args = [ "15" ] })
lib.idCmd idCmd
[ argo.listen.mk [ argo.listen.mk
(argo.listen.defarg cn ⫽ { filter = "power", doFilter = True }) (argo.listen.defarg cn ⫽ { filter = "power", doFilter = True })
] ]
, performance = , 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 = , qmcpack =
withDaemonExtraPerftest withDaemonExtraProgresstest
( perfRun "mpiexec" ( basicRun "mpiexec"
⫽ { args = ⫽ { args =
[ if isTest then "2" else "24" [ if isTest then "2" else "24"
, "qmcpack" , "qmcpack"
...@@ -118,10 +149,10 @@ ...@@ -118,10 +149,10 @@
[ "Error", "error", "ERROR" ] [ "Error", "error", "ERROR" ]
} }
) )
lib.idCmd idCmd
, lammps = , lammps =
withDaemonExtraPerftest withDaemonExtraProgresstest
( perfRun "mpiexec" ( basicRun "mpiexec"
⫽ { args = ⫽ { args =
[ "-n" [ "-n"
, if isTest then "2" else "24" , if isTest then "2" else "24"
...@@ -135,10 +166,10 @@ ...@@ -135,10 +166,10 @@
[ "Error", "error", "ERROR" ] [ "Error", "error", "ERROR" ]
} }
) )
lib.idCmd idCmd
, openmc = , openmc =
withDaemonExtraPerftest withDaemonExtraProgresstest
( perfRun "mpiexec" ( basicRun "mpiexec"
⫽ { args = ⫽ { args =
[ "-n", if isTest then "2" else "24", "openmc" ] [ "-n", if isTest then "2" else "24", "openmc" ]
, cmdavoids = , cmdavoids =
...@@ -147,11 +178,13 @@ ...@@ -147,11 +178,13 @@
[ "OPENMC_CROSS_SECTIONS" ] [ "OPENMC_CROSS_SECTIONS" ]
} }
) )
lib.idCmd idCmd
⫽ { pre = [ "cp --no-preserve=mode -r " ++ lib.openmcDir ++ "/* ." ] } ⫽ { pre =
[ "cp --no-preserve=mode -r " ++ assetDir ++ "openmc/* ." ]
}
, amg = , amg =
withDaemonExtraPerftest withDaemonExtraProgresstest
( perfRun "mpiexec" ( basicRun "mpiexec"
⫽ { args = ⫽ { args =
[ "-n" [ "-n"
, if isTest then "2" else "24" , if isTest then "2" else "24"
...@@ -175,8 +208,8 @@ ...@@ -175,8 +208,8 @@
→ x ⫽ { vars = [ { varname = "OMP_NUM_THREADS", value = "1" } ] } → x ⫽ { vars = [ { varname = "OMP_NUM_THREADS", value = "1" } ] }
) )
, stream = , stream =
withDaemonExtraPerftest withDaemonExtraProgresstest
( perfRun "stream_c" ( basicRun "stream_c"
⫽ { args = ⫽ { args =
[] : List Text [] : List Text
, cmdavoids = , cmdavoids =
......
...@@ -15,7 +15,7 @@ let defaultMkListen = ...@@ -15,7 +15,7 @@ let defaultMkListen =
, filter = , filter =
"," ","
, containerName = , containerName =
"containerName" containerName
} }
: argotypes.MkListen : 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