grim/convey

Add back the old --memory flag

2021-12-22, Gary Kramlich
aa8a9d2b2ae2
Parents 25adcc3509c2
Children e580fa49efac
Add back the old --memory flag
--- a/podman/run.go Wed Dec 22 10:30:52 2021 -0600
+++ b/podman/run.go Wed Dec 22 10:36:23 2021 -0600
@@ -90,11 +90,16 @@
"--volume", volume,
)
- // If there was a --cpu-shares specified on the command line add it now.
+ // If --cpu-shares was specified on the command line add it now.
if rt.CpuShares != "" {
generator.Append("--cpu-shares", rt.CpuShares)
}
+ // If --memory was specified on the command line add it now.
+ if rt.Memory != "" {
+ generator.Append("--memory", rt.Memory)
+ }
+
// If the user provided a script, generate the file and set all of our
// attributes appropriately.
if len(r.Script) > 0 {
--- a/runner/cmd.go Wed Dec 22 10:30:52 2021 -0600
+++ b/runner/cmd.go Wed Dec 22 10:36:23 2021 -0600
@@ -21,9 +21,10 @@
type RunnerCmd struct {
ConfigFile string `kong:"flag,help='The config file to load',placeholder='FILE',short='f',default='convey.yml',name='config'"`
- CpuShares string `king:"flag,help='The amount of cpu shares given to run tasks',placeholder='CPU-SHARES',short='c'"`
+ CpuShares string `kong:"flag,help='The amount of cpu shares given to run tasks',placeholder='CPU-SHARES',short='c'"`
ForceSequential bool `kong:"flag,help='Force concurrent stages to be ran sequentially',short='S',default='false'"`
KeepWorkspace bool `kong:"flag,help='Keep the workspace directory after running',default='false'"`
+ Memory string `kong:"flag,help='The amount of memory shares given to run tasks',placeholder='MEMORY',short='m'"`
Timeout time.Duration `kong:"flag,help='The maximum amount of time a plan can run. 0 to disable. Units must be specified.',placeholder='DURATION',default='15m'"`
Environment []string `kong:"flag,name='env',help='Set an environment variable',short='e',placeholder='ENV'"`
@@ -49,6 +50,10 @@
rt.CpuShares = c.CpuShares
}
+ if c.Memory != "" {
+ rt.Memory = c.Memory
+ }
+
configEnv := environment.New(cfg.Environment...)
return plan.Execute(name, cfg.Tasks, configEnv, rt)
--- a/runtime/runtime.go Wed Dec 22 10:30:52 2021 -0600
+++ b/runtime/runtime.go Wed Dec 22 10:36:23 2021 -0600
@@ -34,6 +34,7 @@
KeepWorkspace bool
CpuShares string
+ Memory string
Timeout time.Duration
workspace *fs.Directory