Documentation
¶
Overview ¶
Package setup provides Cloud Scoot Setup, which is a mechanism for running Scoot with local components, or initializing a connection to remote ones, depending on configuration.
Index ¶
- Constants
- func GoPath() (string, error)
- func Main(cmds *Cmds, strategies *Strategies, args []string) error
- func RepoRoot(goPath string) string
- func WaitForPort(port int) error
- func WaitForPortTimeout(port int, timeout time.Duration) error
- type ApiConfig
- type ApiStrategy
- type Builder
- type Cmds
- type GoBuilder
- type InMemoryWorkersStrategy
- type LocalApiStrategy
- type LocalSchedStrategy
- func NewLocalLocal(workersCfg *WorkerConfig, builder Builder, cmds *Cmds) *LocalSchedStrategy
- func NewLocalMemory(workersCfg *WorkerConfig, builder Builder, cmds *Cmds) *LocalSchedStrategy
- func NewLocalSchedStrategy(workersCfg *WorkerConfig, workers WorkersStrategy, builder Builder, cmds *Cmds) *LocalSchedStrategy
- type LocalWorkersStrategy
- type SchedulerStrategy
- type Strategies
- type WorkerConfig
- type WorkersStrategy
Constants ¶
const DefaultApiServerCount int = 3
const DefaultApiServerLogLevel log.Level = log.InfoLevel
const DefaultWorkerCount int = 5
const DefaultWorkerLogLevel log.Level = log.InfoLevel
Variables ¶
This section is empty.
Functions ¶
func Main ¶
func Main(cmds *Cmds, strategies *Strategies, args []string) error
Main is the entry point for Cloud Scoot setup. cmds is running commands strategies.sched maps strings to SchedulerStrategy strategies.schedStrategy is the name of the strategy to use same applies to bundlestore strategy. args is the remaining arguments. These can be used to run a command
func WaitForPort ¶
WaitForPort waits 10 seconds for a process to listen to the port, and returns an error if the port remains open
Types ¶
type ApiConfig ¶
We set the number of apiserver instances to start. A default value will be assigned if unitialized. We also set a logLevel, which determines the minimum level to display in apiserver logs.
type ApiStrategy ¶
type ApiStrategy interface {
// Startup starts up an ApiServer, returing the address of the server or an error
Startup() ([]string, error)
}
ApiStrategy will startup with a bundlestore (or setup a connection to one)
type Builder ¶
type Builder interface {
// Scheduler returns the path to the Scheduler binary (or an error if it can't be built)
Scheduler() (string, error)
// Worker returns the path to the Worker binary (or an error if it can't be built)
Worker() (string, error)
// ApiServer returns the path to the Worker binary (or an error if it can't be built)
ApiServer() (string, error)
}
Builder is able to create Scoot binaries
type Cmds ¶
type Cmds struct {
// contains filtered or unexported fields
}
Cmds runs commands for Cloud Scoot setup. Over os/exec, it offers: *) (best-effort) clean-up (via Kill()) *) logging when a process is started *) output redirection (TODO) *) Utility functions for Fatal logging that also Kill *) Kills all commands when any long-lived command finishes (to allow prompt debugging) Setup code that might start long-running commands should use Command instead of exec.Command, and StartCmd/StartRun instead of cmd.Start/cmd.Run Run and Start are convenience methods to make it easier to run stuff The main entry points Run() or Start() are convenience
func NewSignalHandlingCmds ¶
func NewSignalHandlingCmds() *Cmds
Create a new Cmds that has a signal handler installed
func (*Cmds) Command ¶
Commands creates a Command that is watched (and with appropriate redirection)
func (*Cmds) Kill ¶
func (c *Cmds) Kill()
Kill kills all running commands NB: we can't guarantee this is called before exiting. If we really want to be correct, we have to start another process that will do the babysitting.
type GoBuilder ¶
type GoBuilder struct {
// contains filtered or unexported fields
}
GoBuilder uses the go command-line tools to build Scoot
type InMemoryWorkersStrategy ¶
type InMemoryWorkersStrategy struct {
// contains filtered or unexported fields
}
InMemoryWorkersStrategy will use in-memory workers (to test the Scheduler logic)
func NewInMemoryWorkers ¶
func NewInMemoryWorkers(workersCfg *WorkerConfig) *InMemoryWorkersStrategy
NewInMemoryWorkers creates a new InMemoryWorkersStartup
func (*InMemoryWorkersStrategy) StartupWorkers ¶
func (s *InMemoryWorkersStrategy) StartupWorkers() (string, error)
type LocalApiStrategy ¶
type LocalApiStrategy struct {
// contains filtered or unexported fields
}
LocalApiStrategy starts up a local apiserver
func NewLocal ¶
func NewLocal(apiCfg *ApiConfig, builder Builder, cmds *Cmds) *LocalApiStrategy
Create an ApiServer Strategy with a local apiserver.
func NewLocalApiStrategy ¶
func NewLocalApiStrategy(apiCfg *ApiConfig, builder Builder, cmds *Cmds) *LocalApiStrategy
Create a new Local ApiServer that will serve the bundlestore api, using builder and cmds to start
func (*LocalApiStrategy) Startup ¶
func (s *LocalApiStrategy) Startup() ([]string, error)
type LocalSchedStrategy ¶
type LocalSchedStrategy struct {
// contains filtered or unexported fields
}
LocalSchedStrategy starts up a local scheduler
func NewLocalLocal ¶
func NewLocalLocal(workersCfg *WorkerConfig, builder Builder, cmds *Cmds) *LocalSchedStrategy
Create a SchedulerStrategy with a local scheduler and local workers
func NewLocalMemory ¶
func NewLocalMemory(workersCfg *WorkerConfig, builder Builder, cmds *Cmds) *LocalSchedStrategy
Create a SchedulerStrategy with a local scheduler and in-memory workers
func NewLocalSchedStrategy ¶
func NewLocalSchedStrategy(workersCfg *WorkerConfig, workers WorkersStrategy, builder Builder, cmds *Cmds) *LocalSchedStrategy
Create a new Local Scheduler that will talk to workers, using builder and cmds to start
func (*LocalSchedStrategy) Startup ¶
func (s *LocalSchedStrategy) Startup() (string, error)
type LocalWorkersStrategy ¶
type LocalWorkersStrategy struct {
// contains filtered or unexported fields
}
LocalWorkersStrategy will startup workers running locally
func NewLocalWorkers ¶
func NewLocalWorkers(workersCfg *WorkerConfig, builder Builder, cmds *Cmds) *LocalWorkersStrategy
NewLocalWorkers creates a new LocalWorkersStartup
func (*LocalWorkersStrategy) StartupWorkers ¶
func (s *LocalWorkersStrategy) StartupWorkers() (string, error)
type SchedulerStrategy ¶
type SchedulerStrategy interface {
// Startup starts up a Scheduler, returning the address of the server or an error
Startup() (string, error)
}
SchedulerStrategy will startup a Scheduler (or setup a connection to one)
type Strategies ¶
type Strategies struct {
Sched map[string]SchedulerStrategy
SchedStrategy string
Api map[string]ApiStrategy
ApiStrategy string
}
type WorkerConfig ¶
In addition to count, we'll optionally want repoDir to initialize workers' gitdb. Whatever is unset will be given a default value. We also set a logLevel, which determines the minimum level to display in scheduler/worker logs.
type WorkersStrategy ¶
type WorkersStrategy interface {
// StartupWorkers should startup necessary workers, and returns the config to pass to Scheduler, or an error
StartupWorkers() (string, error)
}
WorkersStrategy is a strategy to start workers and returns the config to pass to a scheduler to talk to them