19566: Preemptible flag.
authorTom Clegg <tom@curii.com>
Mon, 19 Dec 2022 19:22:34 +0000 (14:22 -0500)
committerTom Clegg <tom@curii.com>
Mon, 19 Dec 2022 19:22:34 +0000 (14:22 -0500)
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom@curii.com>

arvados.go
slice.go
slicenumpy.go

index 68f275508d86f1e8da3cfd55419abebae6e42541..77dceda46d63681dc171199ac28b0d65871cf9b2 100644 (file)
@@ -201,6 +201,7 @@ type arvadosContainerRunner struct {
        Mounts      map[string]map[string]interface{}
        Priority    int
        KeepCache   int // cache buffers per VCPU (0 for default)
+       Preemptible bool
 }
 
 func (runner *arvadosContainerRunner) Run() (string, error) {
@@ -269,7 +270,7 @@ func (runner *arvadosContainerRunner) RunContext(ctx context.Context) (string, e
                        "priority":            runner.Priority,
                        "state":               arvados.ContainerRequestStateCommitted,
                        "scheduling_parameters": arvados.SchedulingParameters{
-                               Preemptible: false,
+                               Preemptible: runner.Preemptible,
                                Partitions:  []string{},
                        },
                        "environment": map[string]string{
index a4899836be66510ac116aa65c90b168033898149..057ac5fa9d57e093ef07de404cf5e147cc5230dc 100644 (file)
--- a/slice.go
+++ b/slice.go
@@ -40,6 +40,7 @@ func (cmd *slicecmd) RunCommand(prog string, args []string, stdin io.Reader, std
        runlocal := flags.Bool("local", false, "run on local host (default: run in an arvados container)")
        projectUUID := flags.String("project", "", "project `UUID` for output data")
        priority := flags.Int("priority", 500, "container request priority")
+       preemptible := flags.Bool("preemptible", true, "request preemptible instance")
        outputDir := flags.String("output-dir", "./out", "output `directory`")
        tagsPerFile := flags.Int("tags-per-file", 50000, "tags per file (nfiles will be ~10M÷x)")
        err = flags.Parse(args)
@@ -71,6 +72,7 @@ func (cmd *slicecmd) RunCommand(prog string, args []string, stdin io.Reader, std
                        Priority:    *priority,
                        KeepCache:   2,
                        APIAccess:   true,
+                       Preemptible: *preemptible,
                }
                for i := range inputDirs {
                        err = runner.TranslatePaths(&inputDirs[i])
index 0095cc4fa71a670cdda7287caeff14b018cd262e..bd0fc171f9613c74ce44539947bd970c677f3de2 100644 (file)
@@ -75,6 +75,7 @@ func (cmd *sliceNumpy) run(prog string, args []string, stdin io.Reader, stdout,
        arvadosVCPUs := flags.Int("arvados-vcpus", 96, "number of VCPUs to request for arvados container")
        projectUUID := flags.String("project", "", "project `UUID` for output data")
        priority := flags.Int("priority", 500, "container request priority")
+       preemptible := flags.Bool("preemptible", true, "request preemptible instance")
        inputDir := flags.String("input-dir", "./in", "input `directory`")
        outputDir := flags.String("output-dir", "./out", "output `directory`")
        ref := flags.String("ref", "", "reference name (if blank, choose last one that appears in input)")
@@ -126,6 +127,7 @@ func (cmd *sliceNumpy) run(prog string, args []string, stdin io.Reader, stdout,
                        Priority:    *priority,
                        KeepCache:   2,
                        APIAccess:   true,
+                       Preemptible: *preemptible,
                }
                err = runner.TranslatePaths(inputDir, regionsFilename, samplesFilename)
                if err != nil {