{"modulePath":"github.com/AliceO2Group/Control","version":"v0.14.4","isLatest":false,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package task\n\nPackage 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.\n\n## Constants\n\n```go\nconst (\n\tCONFIGURE = Event(\"CONFIGURE\")\n\tRESET     = Event(\"RESET\")\n\tSTART     = Event(\"START\")\n\tSTOP      = Event(\"STOP\")\n\tEXIT      = Event(\"EXIT\")\n\tGO_ERROR  = Event(\"GO_ERROR\")\n\tRECOVER   = Event(\"RECOVER\")\n)\n```\n\n```go\nconst (\n\tTARGET_SEPARATOR_RUNE = ':'\n\tTARGET_SEPARATOR      = \":\"\n)\n```\n\n```go\nconst (\n\tUNDEFINED = iota\n\tINACTIVE\n\tPARTIAL\n\tACTIVE\n)\n```\n\n## Variables\n\n```go\nvar (\n\tSTATUS_PRODUCT = map[Status]map[Status]Status{\n\t\tUNDEFINED: {\n\t\t\tUNDEFINED: UNDEFINED,\n\t\t\tINACTIVE:  UNDEFINED,\n\t\t\tPARTIAL:   UNDEFINED,\n\t\t\tACTIVE:    UNDEFINED,\n\t\t},\n\t\tINACTIVE: {\n\t\t\tUNDEFINED: UNDEFINED,\n\t\t\tINACTIVE:  INACTIVE,\n\t\t\tPARTIAL:   PARTIAL,\n\t\t\tACTIVE:    PARTIAL,\n\t\t},\n\t\tPARTIAL: {\n\t\t\tUNDEFINED: UNDEFINED,\n\t\t\tINACTIVE:  PARTIAL,\n\t\t\tPARTIAL:   PARTIAL,\n\t\t\tACTIVE:    PARTIAL,\n\t\t},\n\t\tACTIVE: {\n\t\t\tUNDEFINED: UNDEFINED,\n\t\t\tINACTIVE:  PARTIAL,\n\t\t\tPARTIAL:   PARTIAL,\n\t\t\tACTIVE:    ACTIVE,\n\t\t},\n\t}\n)\n```\n\n## Types\n\n```go\ntype AgentCache struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc (ac *AgentCache) Count() (count int)\n```\n\n```go\nfunc (ac *AgentCache) Get(id mesos.AgentID) (agent *AgentCacheInfo)\n```\n\n```go\nfunc (ac *AgentCache) Update(agents ...AgentCacheInfo)\n```\n\n```go\ntype AgentCacheInfo struct {\n\tAgentId    mesos.AgentID\n\tAttributes constraint.Attributes\n\tHostname   string\n}\n```\n\n```go\ntype Class struct {\n\tIdentifier taskClassIdentifier `yaml:\"name\"`\n\tDefaults   gera.StringMap      `yaml:\"defaults\"`\n\tControl    struct {\n\t\tMode controlmode.ControlMode `yaml:\"mode\"`\n\t} `yaml:\"control\"`\n\tCommand     *common.CommandInfo     `yaml:\"command\"`\n\tWants       ResourceWants           `yaml:\"wants\"`\n\tBind        []channel.Inbound       `yaml:\"bind\"`\n\tProperties  gera.StringMap          `yaml:\"properties\"`\n\tConstraints []constraint.Constraint `yaml:\"constraints\"`\n\tConnect     []channel.Outbound      `yaml:\"connect\"`\n}\n```\n↓ We need the roles tree to know \\*where\\* to run it and how to \\*configure\\* it, but\n\n\tthe following information is enough to run the task even with no environment or\n\trole Class.\n\n```go\nfunc (c *Class) Equals(other *Class) (response bool)\n```\n\n```go\nfunc (c *Class) UnmarshalYAML(unmarshal func(interface{}) error) (err error)\n```\n\n```go\ntype DeploymentMap map[*Task]*Descriptor\n```\n\n```go\ntype Descriptor struct {\n\tTaskRole        parentRole\n\tTaskClassName   string\n\tRoleConstraints constraint.Constraints\n\tRoleConnect     []channel.Outbound\n\tRoleBind        []channel.Inbound\n}\n```\n\n```go\ntype Descriptors []*Descriptor\n```\n\n```go\ntype Event string\n```\n\n```go\nfunc (e Event) String() string\n```\n\n```go\ntype EventArgs map[string]string\n```\n\n```go\ntype Filter func(*Task) bool\n```\n\n```go\nvar Filter_NIL Filter = func(*Task) bool {\n\treturn true\n}\n```\n\n```go\ntype GenericTaskError struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc (r GenericTaskError) Error() string\n```\n\n```go\nfunc (r GenericTaskError) GetTaskId() string\n```\n\n```go\ntype GenericTasksError struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc (r GenericTasksError) Error() string\n```\n\n```go\nfunc (r GenericTasksError) GetTaskIds() []string\n```\n\n```go\ntype KillTaskFunc func(*Task) error\n```\n\n```go\ntype Manager struct {\n\tAgentCache AgentCache\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc NewManager(resourceOffersDone \u003c-chan DeploymentMap,\n\ttasksToDeploy chan\u003c- Descriptors,\n\treviveOffersTrg chan struct{},\n\tcq *controlcommands.CommandQueue,\n\tkillTaskFunc KillTaskFunc) (taskman *Manager)\n```\n\n```go\nfunc (m *Manager) AcquireTasks(envId uuid.Array, taskDescriptors Descriptors) (err error)\n```\n\n```go\nfunc (m *Manager) BuildDescriptorConstraints(descriptors Descriptors) (cm map[*Descriptor]constraint.Constraints)\n```\n\n```go\nfunc (m *Manager) Cleanup() (killed Tasks, running Tasks, err error)\n```\nKill all tasks outside an environment (all unlocked tasks)\n\n```go\nfunc (m *Manager) ConfigureTasks(envId uuid.Array, tasks Tasks) error\n```\n\n```go\nfunc (m *Manager) GetTask(id string) *Task\n```\n\n```go\nfunc (m *Manager) GetTaskClass(name string) (b *Class)\n```\n\n```go\nfunc (m *Manager) GetTasks() Tasks\n```\n\n```go\nfunc (m *Manager) GetWantsForDescriptor(descriptor *Descriptor) (r *Wants)\n```\n\n```go\nfunc (m *Manager) KillTasks(taskIds []string) (killed Tasks, running Tasks, err error)\n```\nKill a specific list of tasks. If the task list includes locked tasks, TaskNotFoundError is returned.\n\n```go\nfunc (m *Manager) NewTaskForMesosOffer(\n\toffer *mesos.Offer,\n\tdescriptor *Descriptor,\n\tlocalBindMap channel.BindMap,\n\texecutorId mesos.ExecutorID) (t *Task)\n```\nNewTaskForMesosOffer accepts a Mesos offer and a Descriptor and returns a newly constructed Task. This function should only be called by the Mesos scheduler controller when matching role requests with offers (matchRoles).\n\n```go\nfunc (m *Manager) RefreshClasses(taskClassesRequired []string) (err error)\n```\n\n```go\nfunc (m *Manager) ReleaseTasks(envId uuid.Array, tasks Tasks) error\n```\n\n```go\nfunc (m *Manager) RemoveReposClasses(repoPath string)\n```\n\n```go\nfunc (m *Manager) TaskCount() int\n```\n\n```go\nfunc (m *Manager) TransitionTasks(tasks Tasks, src string, event string, dest string, commonArgs controlcommands.PropertyMap) error\n```\n\n```go\nfunc (m *Manager) UpdateTaskState(taskId string, state string)\n```\n\n```go\nfunc (m *Manager) UpdateTaskStatus(status *mesos.TaskStatus)\n```\n\n```go\ntype Range struct {\n\tBegin uint64 `json:\"begin\" yaml:\"begin\"`\n\tEnd   uint64 `json:\"end\"   yaml:\"end\"`\n}\n```\n\n```go\ntype Ranges []Range\n```\n\n```go\nfunc (this Ranges) Equals(other Ranges) (response bool)\n```\n\n```go\ntype ResourceWants struct {\n\tCpu    *float64 `yaml:\"cpu\"`\n\tMemory *float64 `yaml:\"memory\"`\n\tPorts  Ranges   `yaml:\"ports\"`\n}\n```\n\n```go\nfunc (rw *ResourceWants) UnmarshalYAML(unmarshal func(interface{}) error) (err error)\n```\n\n```go\ntype Resources mesos.Resources\n```\n\n```go\nfunc (r Resources) Satisfy(wants *Wants) bool\n```\n\n```go\ntype State int\n```\n\n```go\nconst (\n\tUNKNOWN State = iota\n\tSTANDBY\n\tCONFIGURED\n\tRUNNING\n\tERROR\n\tDONE\n\tMIXED\n)\n```\n\n```go\nfunc StateFromString(s string) State\n```\n\n```go\nfunc (s State) String() string\n```\n\n```go\nfunc (s State) X(other State) State\n```\n\n```go\ntype Status uint8\n```\n\n```go\nfunc (s Status) String() string\n```\n\n```go\nfunc (s Status) X(other Status) Status\n```\n\n```go\ntype Task struct {\n\tGetTaskClass func() *Class\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc (t *Task) BuildPropertyMap(bindMap channel.BindMap) (propMap controlcommands.PropertyMap)\n```\n\n```go\nfunc (t *Task) BuildTaskCommand(role parentRole) (err error)\n```\nReturns a consolidated CommandInfo for this Task, based on Roles tree and Class.\n\n```go\nfunc (t *Task) GetAgentId() string\n```\n\n```go\nfunc (t *Task) GetClassName() string\n```\n\n```go\nfunc (t *Task) GetEnvironmentId() uuid.Array\n```\n\n```go\nfunc (t *Task) GetExecutorId() string\n```\n\n```go\nfunc (t *Task) GetHostname() string\n```\n\n```go\nfunc (t *Task) GetLocalBindMap() channel.BindMap\n```\n\n```go\nfunc (t *Task) GetMesosCommandTarget() controlcommands.MesosCommandTarget\n```\n\n```go\nfunc (t *Task) GetName() string\n```\n\n```go\nfunc (t *Task) GetOfferId() string\n```\n\n```go\nfunc (t *Task) GetParentRole() interface{}\n```\n\n```go\nfunc (t *Task) GetParentRolePath() string\n```\n\n```go\nfunc (t *Task) GetProperties() map[string]string\n```\n\n```go\nfunc (t *Task) GetTaskCommandInfo() *common.TaskCommandInfo\n```\n\n```go\nfunc (t *Task) GetTaskId() string\n```\n\n```go\nfunc (t *Task) GetWantsCPU() float64\n```\n\n```go\nfunc (t *Task) GetWantsMemory() float64\n```\n\n```go\nfunc (t *Task) GetWantsPorts() Ranges\n```\n\n```go\nfunc (t *Task) IsLocked() bool\n```\n\n```go\nfunc (t *Task) IsSafeToStop() bool\n```\n\n```go\nfunc (t *Task) SetSafeToStop(done bool)\n```\n\n```go\ntype TaskAlreadyReleasedError taskErrorBase\n```\n\n```go\nfunc (r TaskAlreadyReleasedError) Error() string\n```\n\n```go\ntype TaskError interface {\n\terror\n\tGetTaskId() string\n}\n```\n\n```go\ntype TaskLockedError struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc (r TaskLockedError) EnvironmentId() uuid.Array\n```\n\n```go\nfunc (r TaskLockedError) Error() string\n```\n\n```go\nfunc (r TaskLockedError) GetTaskId() string\n```\n\n```go\ntype TaskNotFoundError taskErrorBase\n```\n\n```go\nfunc (r TaskNotFoundError) Error() string\n```\n\n```go\ntype Tasks []*Task\n```\n\n```go\nfunc (m Tasks) BuildPropertyMaps(bindMap channel.BindMap) (propMapMap controlcommands.PropertyMapsMap, err error)\n```\n\n```go\nfunc (m Tasks) Contains(filter Filter) (has bool)\n```\n\n```go\nfunc (m Tasks) Filtered(filter Filter) (tasks Tasks)\n```\n\n```go\nfunc (m Tasks) FilteredForClass(className string) (tasks Tasks)\n```\n\n```go\nfunc (m Tasks) GetByTaskId(id string) *Task\n```\n\n```go\nfunc (m Tasks) GetMesosCommandTargets() (receivers []controlcommands.MesosCommandTarget, err error)\n```\n\n```go\nfunc (m Tasks) GetTaskIds() []string\n```\n\n```go\ntype TasksDeploymentError tasksErrorBase\n```\n\n```go\nfunc (r TasksDeploymentError) Error() string\n```\n\n```go\ntype TasksError interface {\n\terror\n\tGetTaskIds() []string\n}\n```\n\n```go\ntype Transition struct {\n\tEvt  Event\n\tSrc  State\n\tDst  State\n\tArgs EventArgs\n}\n```\n\n```go\ntype Wants struct {\n\tCpu             float64\n\tMemory          float64\n\tStaticPorts     Ranges\n\tInboundChannels []channel.Inbound\n}\n```\n\n","path":"github.com/AliceO2Group/Control/core/task","name":"task","synopsis":"Package task defines the Task type and its Manager, with the purpose of handling the lifetime of O² Task objects.","isRedistributable":true}
