cmd/sketch: fix budget propagation from host to container
Fix the -max-dollars flag not being respected in container mode. The issue
was that budget configuration was not being passed from the outer sketch
(host) to the inner sketch (container).
Co-Authored-By: sketch <hello@sketch.dev>
Change-ID: s0eade317323b3951k
diff --git a/cmd/sketch/main.go b/cmd/sketch/main.go
index f369583..66c26e9 100644
--- a/cmd/sketch/main.go
+++ b/cmd/sketch/main.go
@@ -332,6 +332,9 @@
Mounts: flags.mounts,
ExperimentFlag: flags.experimentFlag.String(),
TermUI: flags.termUI,
+ MaxDollars: flags.maxDollars,
+ MaxIterations: flags.maxIterations,
+ MaxWallTime: flags.maxWallTime,
}
if err := dockerimg.LaunchContainer(ctx, config); err != nil {
diff --git a/dockerimg/dockerimg.go b/dockerimg/dockerimg.go
index ab3f8c1..66fd691 100644
--- a/dockerimg/dockerimg.go
+++ b/dockerimg/dockerimg.go
@@ -108,6 +108,11 @@
// TermUI enables terminal UI
TermUI bool
+ // Budget configuration
+ MaxDollars float64
+ MaxIterations uint64
+ MaxWallTime time.Duration
+
GitRemoteUrl string
// Commit hash to checkout from GetRemoteUrl
@@ -526,6 +531,9 @@
"-outside-hostname="+config.OutsideHostname,
"-outside-os="+config.OutsideOS,
"-outside-working-dir="+config.OutsideWorkingDir,
+ fmt.Sprintf("-max-dollars=%f", config.MaxDollars),
+ fmt.Sprintf("-max-iterations=%d", config.MaxIterations),
+ fmt.Sprintf("-max-wall-time=%s", config.MaxWallTime.String()),
"-open=false",
"-termui="+fmt.Sprintf("%t", config.TermUI),
"-verbose="+fmt.Sprintf("%t", config.Verbose),