Documentation
¶
Index ¶
- Constants
- func DoHealthChecks(check mesos.HealthCheck, healthStates chan<- Event)
- func ForwardCmdOutput() func(*exec.Cmd) error
- func GetCertFromEnvVariables(env []string) (*x509.Certificate, error)
- func HealthCheckAddress(port uint32) string
- func ScrapCmdOutput(s scraper.Scraper, a appender.Appender, extenders ...servicelog.Extender) func(*exec.Cmd) error
- func StartExecutor(conf Config, hooks []hook.Hook) error
- type Command
- type Config
- type Event
- type EventType
- type Executor
- type TaskExitCode
- type TaskExitState
Constants ¶
const EnvironmentPrefix = "allegro_executor"
EnvironmentPrefix is a prefix for environmental configuration
Variables ¶
This section is empty.
Functions ¶
func DoHealthChecks ¶
func DoHealthChecks(check mesos.HealthCheck, healthStates chan<- Event)
DoHealthChecks schedules health check defined in check. HealthState updates are delivered on provided healthStates channel.
func ForwardCmdOutput ¶ added in v0.9.1
ForwardCmdOutput configures command to forward its output to the system stderr and stdout.
func GetCertFromEnvVariables ¶
func GetCertFromEnvVariables(env []string) (*x509.Certificate, error)
GetCertFromEnvVariables returns certificate stored in environment variables. If no certificate is found then empty string is returned
func HealthCheckAddress ¶ added in v0.9.0
HealthCheckAddress returns host and port that should be used for health checking service.
Types ¶
type Command ¶
type Command interface {
Start() error
Wait() <-chan TaskExitState
Stop(gracePeriod time.Duration, sigtermExcludeProcesses []string)
}
Command is an interface to abstract command running on a system.
type Config ¶
type Config struct {
// Sets logging level to `debug` when true, `info` otherwise
Debug bool `default:"false" split_words:"true"`
// Mesos API path
APIPath string `default:"/api/v1/executor" split_words:"true"`
// Delay between sending TERM and KILL signals
KillPolicyGracePeriod time.Duration `default:"5s" split_words:"true"`
// Timeout for communication with Mesos
HTTPTimeout time.Duration `default:"10s" split_words:"true"`
// Number of state messages to keep in buffer
StateUpdateBufferSize int `default:"1024" split_words:"true"`
// Timeout for attempts to send messages in buffer
StateUpdateWaitTimeout time.Duration `default:"5s" split_words:"true"`
// Mesos framework configuration
MesosConfig config.Config `ignore:"true"`
// SentryDSN is an address used for sending logs to Sentry
SentryDSN string `split_words:"true"`
// ServicelogBufferSize sets a line buffer size used by log scraping module
ServicelogBufferSize uint `default:"2000" split_words:"true"`
// ServicelogIgnoreKeys is a list of ignored keys for log scraping module
ServicelogIgnoreKeys []string `split_words:"true"`
// Range in which certificate will be considered as expired. Used to
// prevent shutdown of all tasks at once.
RandomExpirationRange time.Duration `default:"3h" split_words:"true"`
// SigtermExcludeProcesses specifies process names to omit when sending SIGTERM to process tree during shutdown
SigtermExcludeProcesses []string `split_words:"true"`
}
Config settable from the environment
type Event ¶
type Event struct {
Type EventType
// Message store the human readable information about
// current event. For example reason of the event or
// additional debug message.
Message string
// contains filtered or unexported fields
}
Event is an internal executor event that triggers specific actions driven by current state and Type.
type EventType ¶
type EventType int
EventType defines type of the Event.
const ( // Healthy means task health check passed and task healthy. Healthy EventType = iota // Unhealthy means task health check failed. Fail reason should be // passed in Event Message field. Unhealthy // FailedDueToUnhealthy means task health check failed and task should be killed // because it's unhealthy for longer period of time. Fail reason should be // passed in Event Message field. FailedDueToUnhealthy // FailedDueToExpiredCertificate means task certificate expired (or will expire soon) // and task should be killed because it can't work with invalid certificate. FailedDueToExpiredCertificate // CommandExited means command has exited. Message should contains information // about exit code. CommandExited // Kill means command should be killed and executor exit. Kill // Shutdown means executor should kill all tasks and exit. Shutdown // Subscribed means executor attach to mesos Agent. Subscribed // Launch means executor should start a task. Launch )
type Executor ¶
type Executor struct {
// contains filtered or unexported fields
}
Executor is responsible for launching and monitoring single Mesos task.
func NewExecutor ¶
NewExecutor creates new instance of executor configured with by `cfg` with hooks
type TaskExitCode ¶
type TaskExitCode int8
TaskExitCode is an enum.
const ( // SuccessCode means task exited successfully. SuccessCode TaskExitCode = iota // FailedCode means task exited with error. FailedCode // KilledCode means task was killed and it's code was ignored. KilledCode )
type TaskExitState ¶
type TaskExitState struct {
Code TaskExitCode
Err error
}
TaskExitState is a type describing reason of program execution interuption.
