mesos

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2017 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HttpTimeoutDuration   = 10 * time.Second
	HttpKeepaliveDuration = 30 * time.Second

	UserAgent = "swan"

	MesosSchedulerAPI = "/api/v1/scheduler"
)
View Source
const DefaultFrameworkFailoverTimeout = 7 * 24 * 60 * 60

Variables

This section is empty.

Functions

func NewEventManager

func NewEventManager() *eventManager

func NewHTTPClient

func NewHTTPClient(leader string) *httpClient

func NewReader

func NewReader(r io.Reader) io.Reader

NewReader returns an io.Reader that unpacks the data read from r out of RecordIO framing before returning it.

Types

type Agent

type Agent struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func ApplyFilters

func ApplyFilters(filters []Filter, config *types.TaskConfig, agents []*Agent) []*Agent

func (*Agent) Attributes

func (s *Agent) Attributes() map[string]string

func (*Agent) Resources

func (s *Agent) Resources() (cpus, mem, disk float64, ports []uint64)

type Filter

type Filter interface {
	Filter(config *types.TaskConfig, agents []*Agent) []*Agent
}

type Scheduler

type Scheduler struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Scheduler represents a client interacting with mesos master via x-protobuf

func NewScheduler

func NewScheduler(cfg *SchedulerConfig, db store.Store, strategy Strategy, mgr *eventManager) (*Scheduler, error)

NewScheduler...

func (*Scheduler) AckUpdateEvent

func (s *Scheduler) AckUpdateEvent(status *mesosproto.TaskStatus) error

func (*Scheduler) ClusterName

func (s *Scheduler) ClusterName() string

Cluster return current mesos cluster's name

func (*Scheduler) DetectError

func (s *Scheduler) DetectError(status *mesosproto.TaskStatus) error

func (*Scheduler) FrameworkId

func (s *Scheduler) FrameworkId() *mesosproto.FrameworkID

func (*Scheduler) FrameworkState

func (s *Scheduler) FrameworkState() (*megos.Framework, error)

FrameworkState obtain current framework stats

func (*Scheduler) InitFilters

func (s *Scheduler) InitFilters(filters []Filter)

func (*Scheduler) KillTask

func (s *Scheduler) KillTask(taskId, agentId string) error

func (*Scheduler) LaunchTask

func (s *Scheduler) LaunchTask(t *Task) error

func (*Scheduler) MesosState

func (s *Scheduler) MesosState() (*megos.State, error)

MesosState obtain current mesos stats

func (*Scheduler) Send

func (s *Scheduler) Send(call *mesosproto.Call) (*http.Response, error)

Send send mesos request against the mesos master's scheduler api endpoint. NOTE it's the caller's responsibility to deal with the Send() error

func (*Scheduler) Subscribe

func (s *Scheduler) Subscribe() error

Subscribe ...

func (*Scheduler) SubscribeEvent

func (s *Scheduler) SubscribeEvent(w http.ResponseWriter, remote string) error

func (*Scheduler) TaskEvents

func (s *Scheduler) TaskEvents() []*types.TaskEvent

TaskEvents generate all of current app tasks' db stats into sse events

func (*Scheduler) Unsubscribe

func (s *Scheduler) Unsubscribe() error

type SchedulerConfig

type SchedulerConfig struct {
	ZKHost []string
	ZKPath string

	ReconciliationInterval  float64
	ReconciliationStep      int64
	ReconciliationStepDelay float64
}

type Strategy

type Strategy interface {
	RankAndSort(agents []*Agent) []*Agent
}

type Task

type Task struct {
	mesosproto.TaskInfo
	// contains filtered or unexported fields
}

runtime Task object

func NewTask

func NewTask(cfg *types.TaskConfig, id, name string) *Task

func (*Task) Build

func (t *Task) Build(offer *mesosproto.Offer)

func (*Task) DetectError

func (t *Task) DetectError(status *mesosproto.TaskStatus) error

func (*Task) GetStatus

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

GetStatus method reads the task status on the updates channel

func (*Task) ID

func (t *Task) ID() string

func (*Task) IsDone

func (t *Task) IsDone(status *mesosproto.TaskStatus) bool

IsDone check that if a task is done or not according by task status.

func (*Task) IsTerminated

func (t *Task) IsTerminated(status *mesosproto.TaskStatus) bool

func (*Task) SendStatus

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

SendStatus method writes the task status in the updates channel

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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