github.com/grailbio/bigslice@v0.0.0-20230519005545-30c4c12152ad/exec/config.go (about) 1 // Copyright 2019 GRAIL, Inc. All rights reserved. 2 // Use of this source code is governed by the Apache 2.0 3 // license that can be found in the LICENSE file. 4 5 package exec 6 7 import ( 8 "github.com/grailbio/base/config" 9 // Make eventer/cloudwatch instance available. 10 _ "github.com/grailbio/base/eventlog/cloudwatch" 11 "github.com/grailbio/base/status" 12 "github.com/grailbio/bigmachine" 13 ) 14 15 func init() { 16 config.Register("bigslice", func(constr *config.Constructor[*Session]) { 17 sess := newSession() 18 constr.IntVar(&sess.p, "parallelism", 1024, "allowable parallelism for the job") 19 var system bigmachine.System 20 constr.InstanceVar(&system, "system", "", "the bigmachine system used for job execution") 21 constr.InstanceVar(&sess.eventer, "eventer", "", "the eventer used to log bigslice events") 22 constr.FloatVar(&sess.maxLoad, "max-load", DefaultMaxLoad, "per-machine maximum load") 23 constr.StringVar(&sess.tracePath, "trace-path", "", "path at which to write trace event file") 24 constr.Doc = "bigslice configures the bigslice runtime" 25 constr.New = func() (*Session, error) { 26 if system != nil { 27 sess.executor = newBigmachineExecutor(system) 28 } else { 29 sess.executor = newLocalExecutor() 30 } 31 sess.status = new(status.Status) 32 // Ensure bigmachine's group is displayed first. 33 _ = sess.status.Group(BigmachineStatusGroup) 34 _ = sess.status.Groups() 35 36 sess.start() 37 return sess, nil 38 } 39 }) 40 }