grim/convey

Add back the old --cpu-shares argument

2021-12-22, Gary Kramlich
25adcc3509c2
Parents 2fc0f8c85b3f
Children aa8a9d2b2ae2
Add back the old --cpu-shares argument
--- a/podman/run.go Wed Dec 22 10:18:10 2021 -0600
+++ b/podman/run.go Wed Dec 22 10:30:52 2021 -0600
@@ -90,7 +90,12 @@
"--volume", volume,
)
- // if the user provided a script, generate the file and set all of our
+ // If there was a --cpu-shares specified on the command line add it now.
+ if rt.CpuShares != "" {
+ generator.Append("--cpu-shares", rt.CpuShares)
+ }
+
+ // If the user provided a script, generate the file and set all of our
// attributes appropriately.
if len(r.Script) > 0 {
// Overwrite any entry point that the user provided. Validate set
--- a/runner/cmd.go Wed Dec 22 10:18:10 2021 -0600
+++ b/runner/cmd.go Wed Dec 22 10:30:52 2021 -0600
@@ -21,6 +21,7 @@
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'"`
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'"`
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'"`
@@ -44,6 +45,10 @@
rt := runtime.New(env, configPath, c.ForceSequential, c.KeepWorkspace, c.Timeout)
defer rt.Shutdown()
+ if c.CpuShares != "" {
+ rt.CpuShares = c.CpuShares
+ }
+
configEnv := environment.New(cfg.Environment...)
return plan.Execute(name, cfg.Tasks, configEnv, rt)
--- a/runtime/runtime.go Wed Dec 22 10:18:10 2021 -0600
+++ b/runtime/runtime.go Wed Dec 22 10:30:52 2021 -0600
@@ -32,7 +32,9 @@
ConfigPath string
ForceSequential bool
KeepWorkspace bool
- Timeout time.Duration
+
+ CpuShares string
+ Timeout time.Duration
workspace *fs.Directory
}