task package - github.com/AliceO2Group/Control/core/task - Go Packages

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.

View Source

const (
	TARGET_SEPARATOR_RUNE = ':'
	TARGET_SEPARATOR      = ":"
)

View Source

const (
	MAX_CONCURRENT_DEPLOY_REQUESTS           = 100
	MAX_ATTEMPTS_PER_DEPLOY_REQUEST          = 5
	SLEEP_LENGTH_BETWEEN_PER_DEPLOY_REQUESTS = 1 
)

View Source

const (
	UNDEFINED = iota
	INACTIVE
	PARTIAL
	ACTIVE
	UNDEPLOYABLE
	INVARIANT 
)

View Source

var STATUS_PRODUCT = map[Status]map[Status]Status{
	UNDEFINED: {
		UNDEFINED:    UNDEFINED,
		INACTIVE:     UNDEFINED,
		PARTIAL:      UNDEFINED,
		ACTIVE:       UNDEFINED,
		UNDEPLOYABLE: UNDEFINED,
		INVARIANT:    UNDEFINED,
	},
	INACTIVE: {
		UNDEFINED:    UNDEFINED,
		INACTIVE:     INACTIVE,
		PARTIAL:      PARTIAL,
		ACTIVE:       PARTIAL,
		UNDEPLOYABLE: UNDEPLOYABLE,
		INVARIANT:    INACTIVE,
	},
	PARTIAL: {
		UNDEFINED:    UNDEFINED,
		INACTIVE:     PARTIAL,
		PARTIAL:      PARTIAL,
		ACTIVE:       PARTIAL,
		UNDEPLOYABLE: UNDEPLOYABLE,
		INVARIANT:    PARTIAL,
	},
	ACTIVE: {
		UNDEFINED:    UNDEFINED,
		INACTIVE:     PARTIAL,
		PARTIAL:      PARTIAL,
		ACTIVE:       ACTIVE,
		UNDEPLOYABLE: UNDEPLOYABLE,
		INVARIANT:    ACTIVE,
	},
	UNDEPLOYABLE: {
		UNDEFINED:    UNDEFINED,
		INACTIVE:     UNDEPLOYABLE,
		PARTIAL:      UNDEPLOYABLE,
		ACTIVE:       UNDEPLOYABLE,
		UNDEPLOYABLE: UNDEPLOYABLE,
		INVARIANT:    UNDEPLOYABLE,
	},
	INVARIANT: {
		UNDEFINED:    UNDEFINED,
		INACTIVE:     INACTIVE,
		PARTIAL:      PARTIAL,
		ACTIVE:       ACTIVE,
		UNDEPLOYABLE: UNDEPLOYABLE,
		INVARIANT:    INVARIANT,
	},
}
type AgentCache struct {
	
}
func (ac *AgentCache) Count() (count int)
func (ac *AgentCache) Get(id mesos.AgentID) (agent *AgentCacheInfo)
func (ac *AgentCache) Update(agents ...AgentCacheInfo)
type DeploymentMap map[*Task]*Descriptor
type Descriptors []*Descriptor
type Filter func(*Task) bool
var Filter_NIL Filter = func(*Task) bool {
	return true
}
type GenericTaskError struct {
	
}
func (r GenericTaskError) GetTaskId() string
type GenericTasksError struct {
	
}
func (r GenericTasksError) GetTaskIds() []string
var Grouping_NIL Grouping = func(*Task) string {
	return "all"
}
type KillTaskFunc func(*Task) error
type Manager struct {
	AgentCache     AgentCache
	MessageChannel chan *TaskmanMessage
	
}
func NewManager(shutdown func(), internalEventCh chan<- event.Event) (taskman *Manager, err error)
func (m *Manager) Cleanup() (killed Tasks, running Tasks, err error)

Kill all tasks outside an environment (all unlocked tasks)

func (m *Manager) EmergencyKillTasks(tasks Tasks)

This function should only be called from the SIGINT/SIGTERM handler

func (m *Manager) GetFrameworkID() string
func (m *Manager) GetLimitsForDescriptor(descriptor *Descriptor, envId uid.ID) (l *Limits)
func (m *Manager) GetTasks() Tasks
func (m *Manager) GetWantsForDescriptor(descriptor *Descriptor, envId uid.ID) (r *Wants, err error)

GetWantsForDescriptor matches between taskclass and taskmanager's classes

func (m *Manager) KillTasks(taskIds []string) (killed Tasks, running Tasks, err error)

Kill a specific list of tasks. If the task list includes locked tasks, TaskNotFoundError is returned.

func (m *Manager) RefreshClasses(taskClassesRequired []string) (err error)
func (m *Manager) RemoveReposClasses(repoPath string)
func (m *Manager) TaskCount() int
type ResourceOffersDeploymentRequest struct {
	
}
type ResourceOffersOutcome struct {
	
}
type Resources mesos.Resources
func (r Resources) Satisfy(wants *Wants) bool

StateError is returned when the system encounters an unresolvable state transition error and should likely exit.

func (s Status) X(other Status) Status

func (*Task) BuildTaskCommand

func (t *Task) BuildTaskCommand(role parentRole) (err error)

Returns a consolidated CommandInfo for this Task, based on Roles tree and Class.

func (t *Task) GetClassName() string
func (t *Task) GetEnvironmentId() uid.ID
func (t *Task) GetExecutorId() string
func (t *Task) GetParent() parentRole
func (t *Task) GetParentRole() interface{}
func (t *Task) GetParentRolePath() string
func (t *Task) GetTask() *Task
func (t *Task) GetTraits() Traits
func (t *Task) IsClaimable() bool
func (t *Task) IsLocked() bool
func (t *Task) IsSafeToStop() bool
func (t *Task) SetParent(parent parentRole)
func (t *Task) SetSafeToStop(done bool)
type TaskAlreadyReleasedError taskErrorBase
type TaskLockedError struct {
	
}
func (r TaskLockedError) GetTaskId() string
type TaskNotFoundError taskErrorBase
func NewTaskStateMessage(taskid, state string) (t *TaskmanMessage)
func NewTaskStatusMessage(mesosStatus mesos.TaskStatus) (t *TaskmanMessage)
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 (em *TaskmanMessage) GetRunNumber() string
func (trm *TaskmanMessage) GetSource() string
func (em *TaskmanMessage) GetTasks() Tasks
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) Grouped(grouping Grouping) (tasksMap map[string]Tasks)
type TasksDeploymentError struct {
	
}
func (r TasksDeploymentError) GetTaskIds() []string
type TasksError interface {
	error
	GetTaskIds() []string
}