mesos

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2017 License: Apache-2.0 Imports: 26 Imported by: 4

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 DetectTaskError added in v0.2.3

func DetectTaskError(status *mesosproto.TaskStatus) error

func IsTaskDone added in v0.2.3

func IsTaskDone(status *mesosproto.TaskStatus) bool

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

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) MarshalJSON added in v0.2.1

func (s *Agent) MarshalJSON() ([]byte, error)

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 Offer added in v0.2.1

type Offer struct {
	// contains filtered or unexported fields
}

func (*Offer) GetAgentId added in v0.2.1

func (f *Offer) GetAgentId() string

func (*Offer) GetAttrs added in v0.2.1

func (f *Offer) GetAttrs() map[string]string

func (*Offer) GetCpus added in v0.2.1

func (f *Offer) GetCpus() float64

func (*Offer) GetDisk added in v0.2.1

func (f *Offer) GetDisk() float64

func (*Offer) GetHostname added in v0.2.1

func (f *Offer) GetHostname() string

func (*Offer) GetId added in v0.2.1

func (f *Offer) GetId() string

func (*Offer) GetMem added in v0.2.1

func (f *Offer) GetMem() float64

func (*Offer) GetPortRange added in v0.2.1

func (f *Offer) GetPortRange() (ranges []string)

func (*Offer) GetPorts added in v0.2.1

func (f *Offer) GetPorts() (ports []uint64)

func (*Offer) MarshalJSON added in v0.2.1

func (f *Offer) MarshalJSON() ([]byte, error)

type Scheduler

type Scheduler struct {
	sync.RWMutex // protect followings two
	// 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, clusterMaster *mole.Master) (*Scheduler, error)

NewScheduler...

func (*Scheduler) AckUpdateEvent

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

func (*Scheduler) CloseClusterAgent added in v0.2.2

func (s *Scheduler) CloseClusterAgent(id string)

func (*Scheduler) ClusterAgent added in v0.2.1

func (s *Scheduler) ClusterAgent(id string) *mole.ClusterAgent

func (*Scheduler) ClusterAgents added in v0.2.1

func (s *Scheduler) ClusterAgents() map[string]*mole.ClusterAgent

func (*Scheduler) ClusterName

func (s *Scheduler) ClusterName() string

Cluster return current mesos cluster's name

func (*Scheduler) Dump added in v0.2.1

func (s *Scheduler) Dump() interface{}

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) FullTaskEventsAndRecords added in v0.2.1

func (s *Scheduler) FullTaskEventsAndRecords() []*types.CombinedEvents

FullTaskEventsAndRecords generate all of current app tasks' db stats into sse events & proxy records & dns records

func (*Scheduler) InitFilters

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

func (*Scheduler) KillTask

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

func (*Scheduler) LaunchTasks added in v0.2.1

func (s *Scheduler) LaunchTasks(tasks []*Task) error

func (*Scheduler) Load added in v0.2.1

func (s *Scheduler) Load() map[string]interface{}

func (*Scheduler) MesosState

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

MesosState obtain current mesos stats

func (*Scheduler) SendCall added in v0.2.3

func (s *Scheduler) SendCall(call *mesosproto.Call, expectCode int) (*http.Response, error)

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

func (*Scheduler) SendEvent added in v0.2.3

func (s *Scheduler) SendEvent(appId string, task *types.Task) error

func (*Scheduler) Subscribe

func (s *Scheduler) Subscribe() error

Subscribe ...

func (*Scheduler) SubscribeEvent

func (s *Scheduler) SubscribeEvent(w io.Writer, remote string) error

func (*Scheduler) Unsubscribe

func (s *Scheduler) Unsubscribe() error

type SchedulerConfig

type SchedulerConfig struct {
	ZKHost []string
	ZKPath string

	ReconciliationInterval  float64
	ReconciliationStep      int64
	ReconciliationStepDelay float64

	HeartbeatTimeout        float64
	MaxTasksPerOffer        int
	EnableCapabilityKilling bool
}

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()

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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