task

package
v1.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 2, 2016 License: Apache-2.0, CC-BY-SA-4.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Task

type Task struct {
	mesosproto.TaskInfo

	Error chan error
	// contains filtered or unexported fields
}

Task struct inherits from TaskInfo and represents a mesos task

func NewTask

func NewTask(config *cluster.ContainerConfig, name string, timeout time.Duration) (*Task, error)

NewTask function creates a task

func (*Task) Build

func (t *Task) Build(slaveID string, offers map[string]*mesosproto.Offer)

Build method builds the task

func (*Task) GetConfig

func (t *Task) GetConfig() *cluster.ContainerConfig

GetConfig returns the container configuration of the task

func (*Task) GetContainer

func (t *Task) GetContainer() chan *cluster.Container

GetContainer returns the container channel from the task where the Swarm API sends the created container

func (*Task) GetStatus

func (t *Task) GetStatus() *mesosproto.TaskStatus

GetStatus method reads the task status on the updates channel

func (*Task) ID

func (t *Task) ID() string

ID method returns the taskId

func (*Task) Monitor

func (t *Task) Monitor() (bool, []byte, error)

Monitor method monitors task statuses

func (*Task) SendStatus

func (t *Task) SendStatus(status *mesosproto.TaskStatus)

SendStatus method writes the task status in the updates channel

func (*Task) SetContainer

func (t *Task) SetContainer(container *cluster.Container)

SetContainer writes on the container channel from the task

func (*Task) Stop

func (t *Task) Stop()

Stop method sets the boolean determining if the task is done

func (*Task) Stopped

func (t *Task) Stopped() bool

Stopped method returns a boolean determining if the task is done

type Tasks

type Tasks struct {
	sync.Mutex

	Tasks map[string]*Task
	// contains filtered or unexported fields
}

Tasks is a simple map of tasks

func NewTasks

func NewTasks(cluster launcher) *Tasks

NewTasks returns a new tasks

func (*Tasks) Add

func (t *Tasks) Add(task *Task)

Add tries to Do the Task, if it's not possible, add the Task to the tasks for future tries

func (*Tasks) Process

func (t *Tasks) Process()

Process tries to Do all the Tasks in the tasks and remove the Tasks successfully done

func (*Tasks) Remove

func (t *Tasks) Remove(tasks ...*Task)

Remove an Task from the tasks

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL