GitLab maintenance scheduled for Tomorrow, 2020-08-11, from 17:00 to 18:00 CT - Services will be unavailable during this time.

Commit b2136521 authored by Valentin Reis's avatar Valentin Reis

dhal-refact

parent 7a59189a
Pipeline #7684 failed with stages
in 28 minutes and 18 seconds
let values = ../resources/package.dh
let types = ../resources/types.dh
in λ ( 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
, otherwd =
[] : Optional Text
, exitcode =
[] : Optional Integer
}
let values = ../resources/package.dh
let types = ../resources/types.dh
let argotypes = ./types.dh
let basicCommand = ./basicCommand.dh
let defaultMkListen =
λ(containerName : Text)
→ λ(attr : Text)
→ { attr =
"performance"
, isTest =
False
, filter =
","
, containerName =
"containerName"
}
: argotypes.MkListen
let listen =
λ(a : argotypes.MkListen)
→ basicCommand
{ name =
"nrm"
, outprefix =
"nrmlisten"
, outavoids =
[] : List Text
, outwants =
if a.isTest then [ a.filter ] else [] : List Text
}
⫽ { args = [ "listen", "-u", a.containerName, "--filter", a.filter ] }
: types.Cmd
in { defarg =
defaultMkListen : Text → Text → argotypes.MkListen
, mk =
listen : argotypes.MkListen → types.Cmd
, default =
listen defaultMkListen : Text → Text → types.Cmd
}
let values = ../resources/package.dh
let types = ../resources/types.dh
let argotypes = ./types.dh
let basicCommand = ./basicCommand.dh
let addVerbose = λ(v : Bool) → if v then [ "--verbose" ] else [] : List Text
let addSingularity =
λ(v : Bool)
→ if v then [ "--container-runtime", "singularity" ] else [] : List Text
let addPowercap =
λ(p : argotypes.Powercap)
→ merge
{ Cap =
λ(x : Text) → [ "--powercap", x ]
, NoCap =
λ(x : {}) → [] : List Text
}
p
let defaultMkDaemon =
{ verbose =
True
, powercap =
< NoCap = {=} | Cap : Text >
, singularity =
True
}
: argotypes.MkDaemon
let daemon =
λ(a : argotypes.MkDaemon)
→ basicCommand
{ name =
"nrmd"
, outprefix =
"nrmd"
, outavoids =
[ "Traceback", "ValueError" ] : List Text
, outwants =
[] : List Text
}
⫽ { args =
[ "--nrm_log", "./nrm_log" ]
# addVerbose a.verbose
# addSingularity a.singularity
# addPowercap a.powercap
, out =
{ filename =
"nrmd.out"
, filecheck =
{ wants =
[] : List Text
, avoids =
[ "Traceback", "ValueError" ] : List Text
}
}
, vars =
[ { varname =
"ARGO_NODEOS_CONFIG"
, value =
"/tmp/argo_nodeos_config"
}
]
}
: types.Cmd
in { defarg =
defaultMkDaemon : argotypes.MkDaemon
, mk =
daemon : argotypes.MkDaemon → types.Cmd
, default =
daemon defaultMkDaemon : types.Cmd
}
{ nrmd = ./nrmd.dh, run = ./run.dh, listen = ./listen.dh, basicCommand = ./basicCommand.dh }
let values = ../resources/package.dh
let types = ../resources/types.dh
let argotypes = ./types.dh
let basicCommand = ./basicCommand.dh
let defaultMkRun =
λ(cmd : Text)
→ λ(manifest : Text)
→ { manifest =
manifest
, cmd =
cmd
, containerName =
"containerName"
, args =
[] : List Text
, cmdwants =
[] : List Text
, cmdavoids =
[] : List Text
, vars =
values.emptyVars
, timeout =
[] : Optional Natural
, runExitcode =
[] : Optional Integer
, passvars =
[] : List Text
, runwd =
[] : Optional Text
}
: argotypes.MkRun
let run =
λ(a : argotypes.MkRun)
→ let b =
basicCommand
{ name =
"nrm"
, outprefix =
"nrmrun"
, outwants =
a.cmdwants
, outavoids =
a.cmdavoids
}
in b
⫽ { args =
[ "run", "-u", a.containerName, a.manifest, a.cmd ] # a.args
, passvars =
b.passvars # a.passvars
, vars =
a.vars
, timeout =
a.timeout
, exitcode =
a.runExitcode
, otherwd =
a.runwd
}
: types.Cmd
let default =
λ(cmd : Text)
→ λ(manifest : Text)
→ run (defaultMkRun cmd manifest) : types.Cmd
in { defarg =
defaultMkRun : Text → Text → argotypes.MkRun
, mk =
run : argotypes.MkRun → types.Cmd
, default =
default : Text → Text → types.Cmd
}
let types = ../resources/types.dh
let Powercap = < Cap : Text | NoCap : {} >
let MkDaemon = { verbose : Bool, powercap : Powercap, singularity : Bool }
let MkRun =
{ manifest :
Text
, cmd :
Text
, containerName :
Text
, args :
List Text
, cmdwants :
List Text
, cmdavoids :
List Text
, vars :
List types.EnvVar
, timeout :
Optional Natural
, runExitcode :
Optional Integer
, passvars :
List Text
, runwd :
Optional Text
}
let MkListen =
{ attr : Text, containerName : Text, isTest : Bool, filter : Text }
in { MkRun =
MkRun
, MkDaemon =
MkDaemon
, Powercap =
Powercap
, MkListen =
MkListen
}
λ(dataDir : Text)
→ λ(manifestDir : Text)
→ let values =
https://xgitlab.cels.anl.gov/argo/dhrun/raw/master/resources/package.dh
→ let values = ./resources/package.dh
let types =
https://xgitlab.cels.anl.gov/argo/dhrun/raw/master/resources/types.dh
let types = ./resources/types.dh
let argotypes = ./argo/types.dh
let argo = ./argo/package.dh
let assetDir = dataDir ++ "assets/"
......@@ -14,191 +16,13 @@
let qmcPackDir = assetDir
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
, otherwd =
[] : Optional Text
, exitcode =
[] : Optional Integer
}
let Powercap = < Cap : Text | NoCap : {} >
let MakeBaseArg =
{ manifest :
Text
, cmd :
Text
, containerName :
Text
, args :
List Text
, verbose :
Bool
, singularity :
Bool
, cmdwants :
List Text
, cmdavoids :
List Text
, vars :
List types.EnvVar
, timeout :
Optional Natural
, runExitcode :
Optional Integer
, passvars :
List Text
, powercap :
Powercap
, runwd :
Optional Text
}
let emptyMakeBaseArg =
λ(cmd : Text)
→ λ(manifest : Text)
→ λ(containerName : Text)
→ { manifest =
manifest
, cmd =
cmd
, containerName =
containerName
, args =
[] : List Text
, verbose =
True
, singularity =
False
, cmdwants =
[] : List Text
, cmdavoids =
[] : List Text
, vars =
values.emptyVars
, timeout =
[] : Optional Natural
, runExitcode =
[] : Optional Integer
, passvars =
[] : List Text
, powercap =
< NoCap = {=} | Cap : Text >
, runwd =
[] : Optional Text
}
: MakeBaseArg
let addVerbose = λ(v : Bool) → if v then [ "--verbose" ] else [] : List Text
let addSingularity =
λ(v : Bool)
→ if v then [ "--container-runtime", "singularity" ] else [] : List Text
let addPowercap =
λ(p : Powercap)
→ merge
{ Cap =
λ(x : Text) → [ "--powercap", x ]
, NoCap =
λ(x : {}) → [] : List Text
}
p
let makeBase =
λ(args : MakeBaseArg)
λ(daemonArg : argotypes.MkDaemon)
→ λ(runArg : argotypes.MkRun)
→ { cmds =
[ basicCommand
{ name =
"nrmd"
, outprefix =
"nrmd"
, outwants =
[] : List Text
, outavoids =
[ "Traceback", "ValueError" ] : List Text
}
⫽ { args =
[ "--nrm_log", "./nrm_log" ]
# addVerbose args.verbose
# addSingularity args.singularity
# addPowercap args.powercap
, vars =
[ { varname =
"ARGO_NODEOS_CONFIG"
, value =
"/tmp/argo_nodeos_config"
}
]
}
, 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
, vars =
args.vars
, timeout =
args.timeout
, exitcode =
args.runExitcode
, otherwd =
args.runwd
}
]
[ argo.nrmd.mk daemonArg, argo.run.mk runArg ]
, verbose =
True
, cleaning =
......@@ -213,9 +37,10 @@
: types.Config
let makeExtended =
λ(args : MakeBaseArg)
λ(daemonArg : argotypes.MkDaemon)
→ λ(runArg : argotypes.MkRun)
→ λ(cmds : List types.Cmd)
→ let b = makeBase args in b ⫽ { cmds = b.cmds # cmds }
→ let b = makeBase daemonArg runArg in b ⫽ { cmds = b.cmds # cmds }
let OptionalSleep = < Cmd : Text | Sleep : {} >
......@@ -273,6 +98,7 @@
→ let cn = "testContainer"
in makeExtended
{ powercap = args.powercap, verbose = True, singularity = False }
{ manifest =
manifestDir
++ ( if args.isTest
......@@ -287,10 +113,6 @@
args.cmd
, args =
args.args
, verbose =
True
, singularity =
False
, cmdwants =
[] : List Text
, cmdavoids =
......@@ -305,8 +127,6 @@
[] : Optional Text
, runExitcode =
[] : Optional Integer
, powercap =
args.powercap
}
[ let b =
values.emptyCmd
......@@ -400,26 +220,12 @@
}
)
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 =
[ mkListen "testContainer" "power"
, mkListen "testContainer" "performance"
, mkListen "testContainer" "control"
] : List types.Cmd
[ mkListen "testContainer" "power"
, mkListen "testContainer" "performance"
, mkListen "testContainer" "control"
]
: List types.Cmd
let extendApp =
λ(c : types.Config)
......@@ -428,8 +234,6 @@
in { values =
values
, emptyMakeBaseArg =
emptyMakeBaseArg
, makeBase =
makeBase
, makeExtended =
......
let Check = { avoids : List Text, wants : List Text }
in Check
{ avoids = [] : List Text, wants = [] : List Text }
let Verbosity = ./../Verbosity/Verbosity.dh
let EnvVar = ./../EnvVar/EnvVar.dh
let FileCheck = ./../FileCheck/FileCheck.dh
let Check = ./../Check/Check.dh
in { name :
Text
, exitcode :
Optional Integer
, args :
List Text
, out :
FileCheck
, err :
FileCheck
, postchecks :
List FileCheck
, vars :
List EnvVar
, passvars :
List Text
, timeout :
Optional Natural
, otherwd :
Optional Text
}
let emptyCheck = ./../Check/empty.dh
let FileCheck = ./../FileCheck/FileCheck.dh
let emptyVars = ./../EnvVar/empty.dh
in λ(args : { name : Text, outfile : Text, errfile : Text })
→ { name =
args.name
, exitcode =
[] : Optional Integer
, args =
[] : List Text
, out =
{ filename = args.outfile, filecheck = emptyCheck }
, err =
{ filename = args.errfile, filecheck = emptyCheck }
, postchecks =
[] : List FileCheck
, vars =
emptyVars
, passvars =
[] : List Text
, timeout =
[] : Optional Natural
, otherwd =
[] : Optional Text
}
let Verbosity = ./../Verbosity/Verbosity.dh
let FileCheck = ./../FileCheck/FileCheck.dh
let Cmd = ./../Cmd/Cmd.dh
in { cmds :
List Cmd
, cleaning :
Bool
, verbose :
Bool
, workdir :
Text
, pre :
List Text
, post :
List Text
}
let EnvVar = { varname : Text, value : Text } in EnvVar
let EnvVar = ./EnvVar.dh
in [] : List EnvVar
let Check = ./../Check/Check.dh
let FileCheck = { filename : Text, filecheck : Check }
in FileCheck
let Normal = < Normal = {=} | Verbose : {} > in Normal
let Verbose = < Verbose = {=} | Normal : {} > in Verbose
let Verbosity = < Normal : {} | Verbose : {} > in Verbosity
let types = ./types.dh
in { Normal =
./Verbosity/Normal.dh
, Verbose =
./Verbosity/Verbose.dh
, emptyCheck =
./Check/empty.dh
, emptyVars =
./EnvVar/empty.dh
, emptyCmd =
./Cmd/empty.dh
}
: types.Package
let base =
{ Verbosity =
./Verbosity/Verbosity.dh
, Cmd =
./Cmd/Cmd.dh
, EnvVar =
./EnvVar/EnvVar.dh
, Check =
./Check/Check.dh
, Config =
./Config/Config.dh
, FileCheck =
./FileCheck/FileCheck.dh
}
in base
⫽ { Package =
{ Normal :
base.Verbosity
, Verbose :
base.Verbosity
, emptyCheck :
base.Check
, emptyVars :
List base.EnvVar
, emptyCmd :
{ name : Text, outfile : Text, errfile : Text } → base.Cmd
}
}
......@@ -446,7 +446,6 @@ let
"dataDir = \"./\"" "dataDir = \"$out/\""
substituteInPlace $out/lib.dh --replace \
"https://xgitlab.cels.anl.gov/argo/dhrun/raw/master/" "./"
ln -s ${dhrun}/share/resources $out/resources
'';
unpackPhase = "true";
};
......
......@@ -15,10 +15,4 @@ pythonPackages.buildPythonPackage {
pythonPackages.warlock
containers
];
#checkInputs = [ pythonPackages.pytest ];
#checkPhase = ''
#py.test $out
#'';
}
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