mesos

package module
v0.0.0-...-494e53a Latest Latest
Warning

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

Go to latest
Published: May 15, 2019 License: Apache-2.0 Imports: 10 Imported by: 2

Documentation

Index

Constants

View Source
const (
	HTTP_GET = "GET"
)

Variables

View Source
var (
	ErrInvalidResponse       = errors.New("Invalid response from Mesos")
	ErrDoesNotExist          = errors.New("The resource does not exist")
	ErrInternalServerError   = errors.New("Mesos returned an internal server error")
	ErrSlaveStateLoadError   = errors.New("An error was encountered loading the state of one or more Mesos slaves")
	ErrClusterDiscoveryError = errors.New("An error was encountered while running Mesos cluster discovery")
)

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(config Config) *Client

type Cluster

type Cluster struct {
	LeaderPID  string       `json:"leader"`
	Version    string       `json:"version"`
	Frameworks []*Framework `json:"frameworks,omitempty"`
	Slaves     []*Slave     `json:"slaves"`
}

func DiscoverCluster

func DiscoverCluster(client MesosClient) (*Cluster, error)

func (*Cluster) GetFramework

func (c *Cluster) GetFramework(framework string) map[string]*Framework

func (*Cluster) GetLeader

func (c *Cluster) GetLeader() string

func (*Cluster) GetSlaveByHostName

func (c *Cluster) GetSlaveByHostName(hostName string) *Slave

func (*Cluster) GetSlaveById

func (c *Cluster) GetSlaveById(slaveId string) *Slave

func (*Cluster) LoadSlaveStates

func (c *Cluster) LoadSlaveStates(client MesosClient) error

func (*Cluster) LoadSlaveStats

func (c *Cluster) LoadSlaveStats(client MesosClient) error

type Config

type Config struct {
	DiscoveryURL   string
	MasterURL      string
	MasterPort     int
	SlavePort      int
	LogOutput      io.Writer
	RequestTimeout int
}

func NewDefaultConfig

func NewDefaultConfig() Config

type Executor

type Executor struct {
	Id        string    `json:"id"`
	Name      string    `json:"name"`
	SlaveId   string    `json:"slave_id"`
	State     string    `json:"state"`
	Container string    `json:"container"`
	Resources *Resource `json:"resources"`
	Tasks     []*Task   `json:"tasks"`
}

func (*Executor) RegisteredContainerName

func (e *Executor) RegisteredContainerName(t *Task) string

type Framework

type Framework struct {
	Id               string      `json:"id"`
	Name             string      `json:"name"`
	Active           bool        `json:"active"`
	HostName         string      `json:"hostname"`
	Resources        *Resource   `json:"resources"`
	OfferedResources *Resource   `json:"offered_resources"`
	UsedResources    *Resource   `json:"used_resources"`
	Tasks            []*Task     `json:"tasks"`
	CompletedTasks   []*Task     `json:"completed_tasks"`
	Executors        []*Executor `json:"executors"`
}

type MesosClient

type MesosClient interface {
	// contains filtered or unexported methods
}

type Resource

type Resource struct {
	Cpus  float32 `json:"cpus"`
	Disk  float32 `json:"disk"`
	Mem   float32 `json:"mem"`
	Ports string  `json:"ports"`
}

type Slave

type Slave struct {
	Id               string            `json:"id"`
	HostName         string            `json:"hostname"`
	Attributes       map[string]string `json:"attributes"`
	Resources        Resource          `json:"resources"`
	Frameworks       []*Framework      `json:"frameworks"`
	StateLoadError   bool
	Stats            *SlaveStats
	StateLastUpdated time.Time
	StatsLastUpdated time.Time
}

func (*Slave) GetFramework

func (s *Slave) GetFramework(framework string) map[string]*Framework

func (*Slave) LoadState

func (s *Slave) LoadState(client MesosClient) error

func (*Slave) LoadStats

func (s *Slave) LoadStats(client MesosClient) error

type SlaveStats

type SlaveStats struct {
	ContainerDestroyErrors   float64 `json:"containerizer/mesos/container_destroy_errors"`
	ContainerLaunchErrors    float64 `json:"slave/container_launch_errors"`
	CpusPercent              float64 `json:"slave/cpus_percent"`
	CpusRevocablePercent     float64 `json:"slave/cpus_revocable_percent"`
	CpusRevocableTotal       float64 `json:"slave/cpus_revocable_total"`
	CpusRevocableUsed        float64 `json:"slave/cpus_revocable_used"`
	CpusTotal                float64 `json:"slave/cpus_total"`
	CpusUsed                 float64 `json:"slave/cpus_used"`
	DiskPercent              float64 `json:"slave/disk_percent"`
	DiskRevocablePercent     float64 `json:"slave/disk_revocable_percent"`
	DiskRevocableTotal       float64 `json:"slave/disk_revocable_total"`
	DiskRevocableUsed        float64 `json:"slave/disk_revocable_used"`
	DiskTotal                float64 `json:"slave/disk_total"`
	DiskUsed                 float64 `json:"slave/disk_used"`
	ExecDirMaxAge            float64 `json:"slave/executor_directory_max_allowed_age_secs"`
	ExecutorsPreempted       float64 `json:"slave/executors_preempted"`
	ExecutorsRegistering     float64 `json:"slave/executors_registering"`
	ExecutorsRunning         float64 `json:"slave/executors_running"`
	ExecutorsTerminated      float64 `json:"slave/executors_terminated"`
	ExecutorsTerminating     float64 `json:"slave/executors_terminating"`
	FrameworksActive         float64 `json:"slave/frameworks_active"`
	InvalidFrameworkMessages float64 `json:"slave/invalid_framework_messages"`
	InvalidStatusUpdates     float64 `json:"slave/invalid_status_updates"`
	MemPercent               float64 `json:"slave/mem_percent"`
	MemRevocablePercent      float64 `json:"slave/mem_revocable_percent"`
	MemRevocableTotal        float64 `json:"slave/mem_revocable_total"`
	MemRevocableUsed         float64 `json:"slave/mem_revocable_used"`
	MemTotal                 float64 `json:"slave/mem_total"`
	MemUsed                  float64 `json:"slave/mem_used"`
	RecoveryErrors           float64 `json:"slave/recovery_errors"`
	Registered               float64 `json:"slave/registered"`
	TasksFailed              float64 `json:"slave/tasks_failed"`
	TasksFinished            float64 `json:"slave/tasks_finished"`
	TasksKilled              float64 `json:"slave/tasks_killed"`
	TasksLost                float64 `json:"slave/tasks_lost"`
	TasksRunning             float64 `json:"slave/tasks_running"`
	TasksStaging             float64 `json:"slave/tasks_staging"`
	TasksStarting            float64 `json:"slave/tasks_starting"`
	UptimeSecs               float64 `json:"slave/uptime_secs"`
	ValidFrameworkMessages   float64 `json:"slave/valid_framework_messages"`
	ValidStatusUpdates       float64 `json:"slave/valid_status_updates"`
	Load1Min                 float64 `json:"system/load_1min"`
	Load5Min                 float64 `json:"system/load_5min"`
	Load15Min                float64 `json:"system/load_15min"`
	MemFreeBytes             float64 `json:"system/mem_free_bytes"`
	MemTotalBytes            float64 `json:"system/mem_total_bytes"`
}

type Status

type Status struct {
	State     string  `json:"state"`
	Timestamp float64 `json:"timestamp"`
}

type Task

type Task struct {
	Id        string    `json:"id"`
	Name      string    `json:"name"`
	Resources *Resource `json:"resources"`
	SlaveId   string    `json:"slave_id"`
	State     string    `json:"state"`
	Statuses  []*Status `json:"statuses"`
}

func (*Task) AppId

func (t *Task) AppId() string

Jump to

Keyboard shortcuts

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