Documentation ¶
Index ¶
- func NewRuntimeScheme() *runtime.Scheme
- func StopAndEraseOutput(handle TaskHandle) (errorCollection errcollection.ErrorCollection)
- type CPU
- type ChainedTaskHandle
- type ClusterTaskHandle
- func (m *ClusterTaskHandle) AddAgent(agent TaskHandle)
- func (m *ClusterTaskHandle) Address() string
- func (m *ClusterTaskHandle) EraseOutput() (err error)
- func (m *ClusterTaskHandle) ExitCode() (int, error)
- func (m *ClusterTaskHandle) Status() TaskState
- func (m *ClusterTaskHandle) StderrFile() (*os.File, error)
- func (m *ClusterTaskHandle) StdoutFile() (*os.File, error)
- func (m *ClusterTaskHandle) Stop() (err error)
- func (m *ClusterTaskHandle) String() string
- func (m *ClusterTaskHandle) Wait(timeout time.Duration) (isMasterTerminated bool, err error)
- type Disk
- type Executor
- func NewKubernetes(config KubernetesConfig) (Executor, error)
- func NewOpenstack(config *OpenstackConfig) Executor
- func NewRemote(address string, config RemoteConfig) (Executor, error)
- func NewRemoteFromIP(address string) (Executor, error)
- func NewRemoteIsolated(address string, config RemoteConfig, decorators isolation.Decorators) (Executor, error)
- func NewShell(ip string) (Executor, error)
- type HostAggregate
- type Hypervisor
- type KubernetesConfig
- type LaunchTimedOutError
- type Launcher
- type LoadGenerator
- type Local
- type MockExecutor
- type MockLauncher
- type MockLoadGenerator
- type MockTaskControl
- type MockTaskHandle
- func (_m *MockTaskHandle) Address() string
- func (_m *MockTaskHandle) EraseOutput() error
- func (_m *MockTaskHandle) ExitCode() (int, error)
- func (_m *MockTaskHandle) Status() TaskState
- func (_m *MockTaskHandle) StderrFile() (*os.File, error)
- func (_m *MockTaskHandle) StdoutFile() (*os.File, error)
- func (_m *MockTaskHandle) Stop() error
- func (_m *MockTaskHandle) String() string
- func (_m *MockTaskHandle) Wait(timeout time.Duration) (bool, error)
- type MockTaskInfo
- type Openstack
- type OpenstackAuthConfig
- type OpenstackConfig
- type OpenstackFlavor
- type OpenstackTaskHandle
- func (th *OpenstackTaskHandle) Address() string
- func (th *OpenstackTaskHandle) EraseOutput() error
- func (th *OpenstackTaskHandle) ExitCode() (int, error)
- func (th *OpenstackTaskHandle) Instance() string
- func (th *OpenstackTaskHandle) Status() TaskState
- func (th *OpenstackTaskHandle) StderrFile() (*os.File, error)
- func (th *OpenstackTaskHandle) StdoutFile() (*os.File, error)
- func (th *OpenstackTaskHandle) Stop() error
- func (th *OpenstackTaskHandle) String() string
- func (th *OpenstackTaskHandle) Wait(timeout time.Duration) (bool, error)
- type Parallel
- type RAM
- type Remote
- type RemoteConfig
- type ServiceLauncher
- type TaskControl
- type TaskHandle
- type TaskInfo
- type TaskState
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewRuntimeScheme ¶
NewRuntimeScheme creates instance of runtime.Scheme and registers default conversions.
func StopAndEraseOutput ¶
func StopAndEraseOutput(handle TaskHandle) (errorCollection errcollection.ErrorCollection)
StopAndEraseOutput run Stop and EraseOutput on TaskHandle and add errors to errorCollection
Types ¶
type ChainedTaskHandle ¶
type ChainedTaskHandle struct { TaskHandle // contains filtered or unexported fields }
ChainedTaskHandle is an links Launchers in a way that one will be launched after another.
func (*ChainedTaskHandle) Status ¶
func (cth *ChainedTaskHandle) Status() TaskState
Status returns current TaskState.
func (*ChainedTaskHandle) Stop ¶
func (cth *ChainedTaskHandle) Stop() error
Stop stops all execution of ChainedTaskHandle.
type ClusterTaskHandle ¶
type ClusterTaskHandle struct {
// contains filtered or unexported fields
}
ClusterTaskHandle is a task handle for composition of master and multiple agents. - StdoutFile, StderrFile, ExitCode, Status, Address are taken from master task handle. - Clean, EraseOutput, Stop are done for master and all agents. - Wait waits for master task and when it's terminated it stops all agents. It implements TaskHandle interface.
func NewClusterTaskHandle ¶
func NewClusterTaskHandle(master TaskHandle, agents []TaskHandle) *ClusterTaskHandle
NewClusterTaskHandle returns a ClusterTaskHandle instance.
func (*ClusterTaskHandle) AddAgent ¶
func (m *ClusterTaskHandle) AddAgent(agent TaskHandle)
AddAgent dynamically adds agent to already handled agents.
func (*ClusterTaskHandle) Address ¶
func (m *ClusterTaskHandle) Address() string
Address returns address of master task.
func (*ClusterTaskHandle) EraseOutput ¶
func (m *ClusterTaskHandle) EraseOutput() (err error)
EraseOutput removes master's and agents' stdout & stderr files.
func (*ClusterTaskHandle) ExitCode ¶
func (m *ClusterTaskHandle) ExitCode() (int, error)
ExitCode returns the master exitCode. If master is not terminated it returns error.
func (*ClusterTaskHandle) Status ¶
func (m *ClusterTaskHandle) Status() TaskState
Status returns the state of the master.
func (*ClusterTaskHandle) StderrFile ¶
func (m *ClusterTaskHandle) StderrFile() (*os.File, error)
StderrFile returns a file handle for the master's stderr file.
func (*ClusterTaskHandle) StdoutFile ¶
func (m *ClusterTaskHandle) StdoutFile() (*os.File, error)
StdoutFile returns a file handle for the master's stdout file.
func (*ClusterTaskHandle) Stop ¶
func (m *ClusterTaskHandle) Stop() (err error)
Stop terminates the master firstly and then all the agents.
func (*ClusterTaskHandle) String ¶
func (m *ClusterTaskHandle) String() string
String returns name of underlying task.
func (*ClusterTaskHandle) Wait ¶
func (m *ClusterTaskHandle) Wait(timeout time.Duration) (isMasterTerminated bool, err error)
Wait does the blocking wait for the master completion in case of 0 timeout time. Wait is a helper for waiting with a given timeout time. It returns true if all tasks are terminated.
type Executor ¶
type Executor interface { fmt.Stringer // Execute executes command on underlying platform. // Invokes "bash -c <command>" and waits for short time to make sure that process has started. // Returns error if command exited immediately with non-zero exit status. Execute(command string) (TaskHandle, error) }
Executor is responsible for creating execution environment for given workload. It returns Task handle when workload started gracefully. Workload is executed asynchronously.
func NewKubernetes ¶
func NewKubernetes(config KubernetesConfig) (Executor, error)
NewKubernetes returns an executor which lets the user run commands in pods in a kubernetes cluster.
func NewOpenstack ¶
func NewOpenstack(config *OpenstackConfig) Executor
NewOpenstack creates OpenStack executor.
func NewRemote ¶
func NewRemote(address string, config RemoteConfig) (Executor, error)
NewRemote returns a remote executor instance.
func NewRemoteFromIP ¶
NewRemoteFromIP returns a remote executo instance.
func NewRemoteIsolated ¶
func NewRemoteIsolated(address string, config RemoteConfig, decorators isolation.Decorators) (Executor, error)
NewRemoteIsolated returns a remote executor instance.
type HostAggregate ¶
type HostAggregate struct { Name string ConfigurationID string AvailabilityZone string Disk Disk RAM RAM CPU CPU }
HostAggregate defines OpenStack host aggregate data.
type Hypervisor ¶
Hypervisor defines OpenStack hypervisor data.
type KubernetesConfig ¶
type KubernetesConfig struct { // PodName vs PodNamePrefix: // - PodName(deprecated; by default is empty string) - when this field is // configured, Kubernetes executor is using it as a Pod name. Kubernetes // doesn't support spawning pods with same name, so this field shouldn't // be in use. // - PodNamePrefix(by default is "swan") - If PodName field is not // configured, this field is used as a prefix for random generated Pod // name. PodName string PodNamePrefix string NodeName string Address string CPURequest int64 CPULimit int64 MemoryRequest int64 MemoryLimit int64 Decorators isolation.Decorators ContainerName string ContainerImage string Namespace string Privileged bool HostNetwork bool LaunchTimeout time.Duration }
KubernetesConfig describes the necessary information to connect to a Kubernetes cluster.
func DefaultKubernetesConfig ¶
func DefaultKubernetesConfig() KubernetesConfig
DefaultKubernetesConfig returns a KubernetesConfig object with safe defaults.
type LaunchTimedOutError ¶
type LaunchTimedOutError struct {
// contains filtered or unexported fields
}
LaunchTimedOutError is the error type returned when launching new pods exceed the timeout value defined in kubernetes.Config.LaunchTimeout.
func (*LaunchTimedOutError) Error ¶
func (err *LaunchTimedOutError) Error() string
Error is one method needed to implement the error interface. Here, we just return an the error message.
type Launcher ¶
type Launcher interface { fmt.Stringer // Launch starts the workload (process or group of processes). It returns a workload // represented as a Task Handle instance. // Error is returned when Launcher is unable to start a job. Launch() (TaskHandle, error) }
Launcher responsibility is to launch previously configured job.
type LoadGenerator ¶
type LoadGenerator interface { // Populate inserts initial data. Populate() error // Tune does the tuning phase which is a process of searching for a targetQPS // for given SLO. Tune(slo int) (achievedLoad int, achievedSLI int, err error) // Load starts a load on the specific workload with the defined loadPoint (number of QPS). // The task will do the load for specified amount of time. // Note: Results from Load needs to be fetched out of band e.g using Snap. Load(load int, duration time.Duration) (task TaskHandle, err error) }
LoadGenerator launches stresser which generates load on specified workload.
type Local ¶
type Local struct {
// contains filtered or unexported fields
}
Local provisioning is responsible for providing the execution environment on local machine via exec.Command. It runs command as current user.
func NewLocal ¶
func NewLocal() Local
NewLocal returns instance of local executors without any isolators.
func NewLocalIsolated ¶
NewLocalIsolated returns a Local instance with some isolators set.
type MockExecutor ¶
MockExecutor is an autogenerated mock type for the Executor type
func (*MockExecutor) Execute ¶
func (_m *MockExecutor) Execute(command string) (TaskHandle, error)
Execute provides a mock function with given fields: command
func (*MockExecutor) String ¶
func (_m *MockExecutor) String() string
String provides a mock function with given fields:
type MockLauncher ¶
MockLauncher is an autogenerated mock type for the Launcher type
func (*MockLauncher) Launch ¶
func (_m *MockLauncher) Launch() (TaskHandle, error)
Launch provides a mock function with given fields:
func (*MockLauncher) String ¶
func (_m *MockLauncher) String() string
String provides a mock function with given fields:
type MockLoadGenerator ¶
MockLoadGenerator is an autogenerated mock type for the LoadGenerator type
func (*MockLoadGenerator) Load ¶
func (_m *MockLoadGenerator) Load(load int, duration time.Duration) (TaskHandle, error)
Load provides a mock function with given fields: load, duration
func (*MockLoadGenerator) Populate ¶
func (_m *MockLoadGenerator) Populate() error
Populate provides a mock function with given fields:
type MockTaskControl ¶
MockTaskControl is an autogenerated mock type for the TaskControl type
func (*MockTaskControl) EraseOutput ¶
func (_m *MockTaskControl) EraseOutput() error
EraseOutput provides a mock function with given fields:
func (*MockTaskControl) Stop ¶
func (_m *MockTaskControl) Stop() error
Stop provides a mock function with given fields:
type MockTaskHandle ¶
MockTaskHandle is an autogenerated mock type for the TaskHandle type
func (*MockTaskHandle) Address ¶
func (_m *MockTaskHandle) Address() string
Address provides a mock function with given fields:
func (*MockTaskHandle) EraseOutput ¶
func (_m *MockTaskHandle) EraseOutput() error
EraseOutput provides a mock function with given fields:
func (*MockTaskHandle) ExitCode ¶
func (_m *MockTaskHandle) ExitCode() (int, error)
ExitCode provides a mock function with given fields:
func (*MockTaskHandle) Status ¶
func (_m *MockTaskHandle) Status() TaskState
Status provides a mock function with given fields:
func (*MockTaskHandle) StderrFile ¶
func (_m *MockTaskHandle) StderrFile() (*os.File, error)
StderrFile provides a mock function with given fields:
func (*MockTaskHandle) StdoutFile ¶
func (_m *MockTaskHandle) StdoutFile() (*os.File, error)
StdoutFile provides a mock function with given fields:
func (*MockTaskHandle) Stop ¶
func (_m *MockTaskHandle) Stop() error
Stop provides a mock function with given fields:
func (*MockTaskHandle) String ¶
func (_m *MockTaskHandle) String() string
String provides a mock function with given fields:
type MockTaskInfo ¶
MockTaskInfo is an autogenerated mock type for the TaskInfo type
func (*MockTaskInfo) Address ¶
func (_m *MockTaskInfo) Address() string
Address provides a mock function with given fields:
func (*MockTaskInfo) ExitCode ¶
func (_m *MockTaskInfo) ExitCode() (int, error)
ExitCode provides a mock function with given fields:
func (*MockTaskInfo) Status ¶
func (_m *MockTaskInfo) Status() TaskState
Status provides a mock function with given fields:
func (*MockTaskInfo) StderrFile ¶
func (_m *MockTaskInfo) StderrFile() (*os.File, error)
StderrFile provides a mock function with given fields:
func (*MockTaskInfo) StdoutFile ¶
func (_m *MockTaskInfo) StdoutFile() (*os.File, error)
StdoutFile provides a mock function with given fields:
func (*MockTaskInfo) String ¶
func (_m *MockTaskInfo) String() string
String provides a mock function with given fields:
type Openstack ¶
type Openstack struct {
// contains filtered or unexported fields
}
Openstack defines OpenStack server configuration and client.
type OpenstackAuthConfig ¶
type OpenstackAuthConfig struct { Username string Password string TenantID string DomainName string Endpoint string }
OpenstackAuthConfig defines OpenStack authentication configuration data.
type OpenstackConfig ¶
type OpenstackConfig struct { Auth gophercloud.AuthOptions Flavor OpenstackFlavor Image string User string SSHKeyPath string Name string ID string Hypervisor Hypervisor HostAggregate HostAggregate }
OpenstackConfig defines OpenStack instance configuration data.
func DefaultOpenstackConfig ¶
func DefaultOpenstackConfig(auth gophercloud.AuthOptions) OpenstackConfig
DefaultOpenstackConfig creates default OpenStack config.
type OpenstackFlavor ¶
OpenstackFlavor defines OpenStack flavor data.
type OpenstackTaskHandle ¶
type OpenstackTaskHandle struct {
// contains filtered or unexported fields
}
OpenstackTaskHandle represents an abstraction to control task lifecycle and status.
func (*OpenstackTaskHandle) Address ¶
func (th *OpenstackTaskHandle) Address() string
Address returns ip address of host where task is located.
func (*OpenstackTaskHandle) EraseOutput ¶
func (th *OpenstackTaskHandle) EraseOutput() error
EraseOutput removes directory where output files resides.
func (*OpenstackTaskHandle) ExitCode ¶
func (th *OpenstackTaskHandle) ExitCode() (int, error)
ExitCode returns exit code of finished task. If task is still running, return error.
func (*OpenstackTaskHandle) Instance ¶
func (th *OpenstackTaskHandle) Instance() string
Instance returns OpenStack instance name.
func (*OpenstackTaskHandle) Status ¶
func (th *OpenstackTaskHandle) Status() TaskState
Status returns task status.
func (*OpenstackTaskHandle) StderrFile ¶
func (th *OpenstackTaskHandle) StderrFile() (*os.File, error)
StderrFile returns file handle for file to the task's stderr file.
func (*OpenstackTaskHandle) StdoutFile ¶
func (th *OpenstackTaskHandle) StdoutFile() (*os.File, error)
StdoutFile returns file handle for file to the task's stdout file.
func (*OpenstackTaskHandle) String ¶
func (th *OpenstackTaskHandle) String() string
String returns user-friendly name of task handle.
type Parallel ¶
type Parallel struct {
// contains filtered or unexported fields
}
Parallel allows to run same command using same executor multiple times. Using Parallel decorator will mix output from all the commands executed. Parallel is run in new PID namespace (using isolation.Namespace) as children might not be killed correctly otherwise.
func NewParallel ¶
NewParallel prepares instance of Decorator that allows to ran tasks in parallel.
type Remote ¶
type Remote struct {
// contains filtered or unexported fields
}
Remote provisioning is responsible for providing the execution environment on remote machine via ssh.
type RemoteConfig ¶
RemoteConfig is configuration for Remote Executor.
func DefaultRemoteConfig ¶
func DefaultRemoteConfig() RemoteConfig
DefaultRemoteConfig returns default Remote Executor configuration from flags.
type ServiceLauncher ¶
type ServiceLauncher struct {
Launcher
}
ServiceLauncher is a decorator and Launcher implementation that should be used for tasks that do not stop on their own.
func NewServiceLauncher ¶
func NewServiceLauncher(launcher Launcher) ServiceLauncher
NewServiceLauncher is constructor for ServiceLauncher.
func (ServiceLauncher) Launch ¶
func (sl ServiceLauncher) Launch() (TaskHandle, error)
Launch implements Launcher interface.
type TaskControl ¶
type TaskControl interface { // Stops a task. // Returns error if something wrong has happen during task execution. Stop() error // Wait blocks and waits for task to terminate. // Parameter `timeout` is waiting timeout. For `0` it wil wait until task termination. // Returns `terminated` true when task terminates. // Returns error if something wrong has happen during task execution. Wait(timeout time.Duration) (terminated bool, err error) // EraseOutput deletes the directory where output files resides. EraseOutput() error }
TaskControl controls task's lifecycle and garbage collection.
type TaskHandle ¶
type TaskHandle interface { TaskInfo TaskControl }
TaskHandle represents an abstraction to control task lifecycle and status.
func NewChainedTaskHandle ¶
func NewChainedTaskHandle(handle TaskHandle, launchers ...Launcher) TaskHandle
NewChainedTaskHandle returns TaskHandle that executes current handle, and will launch Launcher when handle will finish it's execution.
func NewServiceHandle ¶
func NewServiceHandle(handle TaskHandle) TaskHandle
NewServiceHandle wraps TaskHandle with serviceHandle.
type TaskInfo ¶
type TaskInfo interface { fmt.Stringer // Location returns address where task was located. Address() string // ExitCode returns an exit code of finished task. // Returns error if If task is not terminated. ExitCode() (int, error) // Status returns a state of the task. Status() TaskState // StdoutFile returns a file handle for file to the task's stdout file. StdoutFile() (*os.File, error) // StderrFile returns a file handle for file to the task's stderr file. StderrFile() (*os.File, error) }
TaskInfo represents task's address, status and output information.
Source Files ¶
- chained_task_handle.go
- cluster_task_handle.go
- executor.go
- executor_shared.go
- kubernetes.go
- launcher.go
- load_generator.go
- local.go
- mock_executor.go
- mock_launcher.go
- mock_load_generator.go
- mock_task_control.go
- mock_task_handle.go
- mock_task_info.go
- openstack.go
- output_files_utils.go
- parallel.go
- remote.go
- service.go
- shell.go
- task_handle.go