Documentation ¶
Overview ¶
Package task defines the Task type and its Manager, with the purpose of handling the lifetime of O² Task objects. Each Task generally matches a running Mesos Task. All Tasks are kept in a roster in Manager, and the latter also takes care of resource acquisition and deployment.
Index ¶
- Constants
- Variables
- func NewScheduler(taskman *Manager, fidStore store.Singleton, shutdown func()) (*schedulerState, error)
- type AgentCache
- type AgentCacheInfo
- type DeploymentMap
- type Descriptor
- type Descriptors
- type Event
- type EventArgs
- type Filter
- type GenericTaskError
- type GenericTasksError
- type KillTaskFunc
- type Manager
- func (m *Manager) BuildDescriptorConstraints(descriptors Descriptors) (cm map[*Descriptor]constraint.Constraints)
- func (m *Manager) Cleanup() (killed Tasks, running Tasks, err error)
- func (m *Manager) EmergencyKillTasks(tasks Tasks)
- func (m *Manager) GetFrameworkID() string
- func (m *Manager) GetState() string
- func (m *Manager) GetTask(id string) *Task
- func (m *Manager) GetTaskClass(name string) (b *taskclass.Class)
- func (m *Manager) GetTasks() Tasks
- func (m *Manager) GetWantsForDescriptor(descriptor *Descriptor) (r *Wants)
- func (m *Manager) KillTasks(taskIds []string) (killed Tasks, running Tasks, err error)
- func (m *Manager) RefreshClasses(taskClassesRequired []string) (err error)
- func (m *Manager) RemoveReposClasses(repoPath string)
- func (m *Manager) Start(ctx context.Context)
- func (m *Manager) TaskCount() int
- func (m *Manager) TriggerHooks(envId uid.ID, tasks Tasks) error
- type ResourceOffersDeploymentRequest
- type ResourceOffersOutcome
- type Resources
- type State
- type StateError
- type Status
- type Task
- func (t *Task) BuildPropertyMap(bindMap channel.BindMap) (propMap controlcommands.PropertyMap, err error)
- func (t *Task) BuildTaskCommand(role parentRole) (err error)
- func (t *Task) GetAgentId() string
- func (t *Task) GetClassName() string
- func (t *Task) GetControlMode() controlmode.ControlMode
- func (t *Task) GetEnvironmentId() uid.ID
- func (t *Task) GetExecutorId() string
- func (t *Task) GetHostname() string
- func (t *Task) GetLocalBindMap() channel.BindMap
- func (t *Task) GetMesosCommandTarget() controlcommands.MesosCommandTarget
- func (t *Task) GetName() string
- func (t *Task) GetOfferId() string
- func (t *Task) GetParent() parentRole
- func (t *Task) GetParentRole() interface{}
- func (t *Task) GetParentRolePath() string
- func (t *Task) GetProperties() map[string]string
- func (t *Task) GetTask() *Task
- func (t *Task) GetTaskCommandInfo() *common.TaskCommandInfo
- func (t *Task) GetTaskId() string
- func (t *Task) GetTaskPID() string
- func (t *Task) GetTraits() Traits
- func (t *Task) GetWantsCPU() float64
- func (t *Task) GetWantsMemory() float64
- func (t *Task) GetWantsPorts() port.Ranges
- func (t *Task) IsClaimable() bool
- func (t *Task) IsLocked() bool
- func (t *Task) IsSafeToStop() bool
- func (t *Task) SendEvent(ev event.Event)
- func (t *Task) SetParent(parent parentRole)
- func (t *Task) SetSafeToStop(done bool)
- type TaskAlreadyReleasedError
- type TaskError
- type TaskLockedError
- type TaskNotFoundError
- type TaskmanMessage
- func NewEnvironmentMessage(mt taskop.MessageType, envId uid.ID, tasks Tasks, desc Descriptors) (t *TaskmanMessage)
- func NewTaskStateMessage(taskid, state string) (t *TaskmanMessage)
- func NewTaskStatusMessage(mesosStatus mesos.TaskStatus) (t *TaskmanMessage)
- func NewTransitionTaskMessage(tasks Tasks, src, transitionEvent, dest string, ...) (t *TaskmanMessage)
- func (trm *TaskmanMessage) GetArguments() controlcommands.PropertyMap
- func (em *TaskmanMessage) GetDescriptors() Descriptors
- func (trm *TaskmanMessage) GetDestination() string
- func (em *TaskmanMessage) GetEnvironmentId() (envid uid.ID)
- func (em *TaskmanMessage) GetError() string
- func (trm *TaskmanMessage) GetEvent() string
- func (tm *TaskmanMessage) GetMessageType() taskop.MessageType
- func (em *TaskmanMessage) GetRunNumber() string
- func (trm *TaskmanMessage) GetSource() string
- func (em *TaskmanMessage) GetTasks() Tasks
- type Tasks
- func (m Tasks) BuildPropertyMaps(bindMap channel.BindMap) (propMapMap controlcommands.PropertyMapsMap, err error)
- func (m Tasks) Contains(filter Filter) (has bool)
- func (m Tasks) Filtered(filter Filter) (tasks Tasks)
- func (m Tasks) FilteredForClass(className string) (tasks Tasks)
- func (m Tasks) GetByTaskId(id string) *Task
- func (m Tasks) GetMesosCommandTargets() (receivers []controlcommands.MesosCommandTarget, err error)
- func (m Tasks) GetTaskIds() []string
- type TasksDeploymentError
- type TasksError
- type Traits
- type Transition
- type Wants
Constants ¶
const ( CONFIGURE = Event("CONFIGURE") RESET = Event("RESET") START = Event("START") STOP = Event("STOP") EXIT = Event("EXIT") GO_ERROR = Event("GO_ERROR") RECOVER = Event("RECOVER") )
const ( TARGET_SEPARATOR_RUNE = ':' TARGET_SEPARATOR = ":" )
const ( UNDEFINED = iota INACTIVE PARTIAL ACTIVE )
const TaskMan_QUEUE = 32768
Variables ¶
var ( RegistrationMinBackoff = 1 * time.Second RegistrationMaxBackoff = 15 * time.Second )
var ( STATUS_PRODUCT = map[Status]map[Status]Status{ UNDEFINED: { UNDEFINED: UNDEFINED, INACTIVE: UNDEFINED, PARTIAL: UNDEFINED, ACTIVE: UNDEFINED, }, INACTIVE: { UNDEFINED: UNDEFINED, INACTIVE: INACTIVE, PARTIAL: PARTIAL, ACTIVE: PARTIAL, }, PARTIAL: { UNDEFINED: UNDEFINED, INACTIVE: PARTIAL, PARTIAL: PARTIAL, ACTIVE: PARTIAL, }, ACTIVE: { UNDEFINED: UNDEFINED, INACTIVE: PARTIAL, PARTIAL: PARTIAL, ACTIVE: ACTIVE, }, } )
Functions ¶
Types ¶
type AgentCache ¶
type AgentCache struct {
// contains filtered or unexported fields
}
func (*AgentCache) Count ¶
func (ac *AgentCache) Count() (count int)
func (*AgentCache) Get ¶
func (ac *AgentCache) Get(id mesos.AgentID) (agent *AgentCacheInfo)
func (*AgentCache) Update ¶
func (ac *AgentCache) Update(agents ...AgentCacheInfo)
type AgentCacheInfo ¶
type AgentCacheInfo struct { AgentId mesos.AgentID Attributes constraint.Attributes Hostname string }
type DeploymentMap ¶
type DeploymentMap map[*Task]*Descriptor
type Descriptor ¶
type Descriptor struct { TaskRole parentRole TaskClassName string RoleConstraints constraint.Constraints RoleConnect []channel.Outbound RoleBind []channel.Inbound }
type Descriptors ¶
type Descriptors []*Descriptor
func (Descriptors) String ¶ added in v0.43.0
func (ds Descriptors) String() string
func (Descriptors) StringSlice ¶ added in v0.43.0
func (ds Descriptors) StringSlice() []string
type GenericTaskError ¶
type GenericTaskError struct {
// contains filtered or unexported fields
}
func (GenericTaskError) Error ¶
func (r GenericTaskError) Error() string
type GenericTasksError ¶
type GenericTasksError struct {
// contains filtered or unexported fields
}
func (GenericTasksError) Error ¶
func (r GenericTasksError) Error() string
func (GenericTasksError) GetTaskIds ¶
func (r GenericTasksError) GetTaskIds() []string
type KillTaskFunc ¶ added in v0.9.0
type Manager ¶
type Manager struct { AgentCache AgentCache MessageChannel chan *TaskmanMessage // contains filtered or unexported fields }
func NewManager ¶
func (*Manager) BuildDescriptorConstraints ¶
func (m *Manager) BuildDescriptorConstraints(descriptors Descriptors) (cm map[*Descriptor]constraint.Constraints)
func (*Manager) EmergencyKillTasks ¶ added in v0.17.80
This function should only be called from the SIGINT/SIGTERM handler
func (*Manager) GetFrameworkID ¶ added in v0.17.80
func (*Manager) GetWantsForDescriptor ¶
func (m *Manager) GetWantsForDescriptor(descriptor *Descriptor) (r *Wants)
GetWantsForDescriptor matches between taskclass and taskmanager's classes
func (*Manager) KillTasks ¶
Kill a specific list of tasks. If the task list includes locked tasks, TaskNotFoundError is returned.
func (*Manager) RefreshClasses ¶
func (*Manager) RemoveReposClasses ¶ added in v0.10.0
type ResourceOffersDeploymentRequest ¶ added in v0.43.0
type ResourceOffersDeploymentRequest struct {
// contains filtered or unexported fields
}
type ResourceOffersOutcome ¶ added in v0.43.0
type ResourceOffersOutcome struct {
// contains filtered or unexported fields
}
type StateError ¶ added in v0.17.80
type StateError string
StateError is returned when the system encounters an unresolvable state transition error and should likely exit.
func (StateError) Error ¶ added in v0.17.80
func (err StateError) Error() string
type Task ¶
func ClassToTask ¶ added in v0.17.0
func (*Task) BuildPropertyMap ¶
func (t *Task) BuildPropertyMap(bindMap channel.BindMap) (propMap controlcommands.PropertyMap, err error)
func (*Task) BuildTaskCommand ¶
Returns a consolidated CommandInfo for this Task, based on Roles tree and Class.
func (*Task) GetAgentId ¶
func (*Task) GetClassName ¶
func (*Task) GetControlMode ¶ added in v0.16.0
func (t *Task) GetControlMode() controlmode.ControlMode
func (*Task) GetEnvironmentId ¶
func (*Task) GetExecutorId ¶
func (*Task) GetHostname ¶
func (*Task) GetLocalBindMap ¶ added in v0.13.0
func (*Task) GetMesosCommandTarget ¶
func (t *Task) GetMesosCommandTarget() controlcommands.MesosCommandTarget
func (*Task) GetOfferId ¶
func (*Task) GetParentRole ¶
func (t *Task) GetParentRole() interface{}
func (*Task) GetParentRolePath ¶
func (*Task) GetProperties ¶ added in v0.12.90
func (*Task) GetTaskCommandInfo ¶ added in v0.12.90
func (t *Task) GetTaskCommandInfo() *common.TaskCommandInfo
func (*Task) GetTaskPID ¶ added in v0.14.91
func (*Task) GetWantsCPU ¶
func (*Task) GetWantsMemory ¶
func (*Task) GetWantsPorts ¶
func (*Task) IsClaimable ¶ added in v0.47.0
func (*Task) IsSafeToStop ¶ added in v0.12.0
func (*Task) SetSafeToStop ¶ added in v0.12.0
type TaskAlreadyReleasedError ¶
type TaskAlreadyReleasedError taskErrorBase
func (TaskAlreadyReleasedError) Error ¶
func (r TaskAlreadyReleasedError) Error() string
type TaskLockedError ¶
type TaskLockedError struct {
// contains filtered or unexported fields
}
func (TaskLockedError) EnvironmentId ¶
func (r TaskLockedError) EnvironmentId() uid.ID
func (TaskLockedError) Error ¶
func (r TaskLockedError) Error() string
type TaskNotFoundError ¶
type TaskNotFoundError taskErrorBase
func (TaskNotFoundError) Error ¶
func (r TaskNotFoundError) Error() string
type TaskmanMessage ¶ added in v0.17.80
type TaskmanMessage struct { MessageType taskop.MessageType `json:"_messageType"` // contains filtered or unexported fields }
func NewEnvironmentMessage ¶ added in v0.17.80
func NewEnvironmentMessage(mt taskop.MessageType, envId uid.ID, tasks Tasks, desc Descriptors) (t *TaskmanMessage)
func NewTaskStateMessage ¶ added in v0.17.80
func NewTaskStateMessage(taskid, state string) (t *TaskmanMessage)
func NewTaskStatusMessage ¶ added in v0.17.80
func NewTaskStatusMessage(mesosStatus mesos.TaskStatus) (t *TaskmanMessage)
func NewTransitionTaskMessage ¶ added in v0.17.80
func NewTransitionTaskMessage(tasks Tasks, src, transitionEvent, dest string, cargs controlcommands.PropertyMap, envID uid.ID) (t *TaskmanMessage)
func (*TaskmanMessage) GetArguments ¶ added in v0.17.80
func (trm *TaskmanMessage) GetArguments() controlcommands.PropertyMap
func (*TaskmanMessage) GetDescriptors ¶ added in v0.17.80
func (em *TaskmanMessage) GetDescriptors() Descriptors
func (*TaskmanMessage) GetDestination ¶ added in v0.17.80
func (trm *TaskmanMessage) GetDestination() string
func (*TaskmanMessage) GetEnvironmentId ¶ added in v0.17.80
func (*TaskmanMessage) GetMessageType ¶ added in v0.17.80
func (tm *TaskmanMessage) GetMessageType() taskop.MessageType
func (*TaskmanMessage) GetRunNumber ¶ added in v0.19.80
func (em *TaskmanMessage) GetRunNumber() string
type Tasks ¶
type Tasks []*Task
func (Tasks) BuildPropertyMaps ¶
func (m Tasks) BuildPropertyMaps(bindMap channel.BindMap) (propMapMap controlcommands.PropertyMapsMap, err error)
func (Tasks) FilteredForClass ¶
func (Tasks) GetByTaskId ¶
func (Tasks) GetMesosCommandTargets ¶
func (m Tasks) GetMesosCommandTargets() (receivers []controlcommands.MesosCommandTarget, err error)
func (Tasks) GetTaskIds ¶ added in v0.9.1
type TasksDeploymentError ¶
type TasksDeploymentError struct {
// contains filtered or unexported fields
}
func (TasksDeploymentError) Error ¶
func (r TasksDeploymentError) Error() string
func (TasksDeploymentError) GetTaskIds ¶ added in v0.43.0
func (r TasksDeploymentError) GetTaskIds() []string