agent

package
v0.0.0-...-5265a8e Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2018 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TIMEOUT = 10000 //ms
)

Variables

This section is empty.

Functions

func RunAgent

func RunAgent(masterAddress string, address, name string)

/////////////////////////////

Types

type Agent

type Agent struct {
	MasterAddress string
	Address       string
	Port          int32
	Name          string
	Topology      *Topology
	StartTime     time.Time
	Tasks         *TaskMap

	IsStatusChanged bool
}

func NewAgent

func NewAgent(masterAddress string, address, name string) *Agent

func (*Agent) DoHeartbeat

func (self *Agent) DoHeartbeat() error

func (*Agent) Duplicate

func (self *Agent) Duplicate(ctx context.Context, em *pb.Empty) (*pb.Empty, error)

func (*Agent) GetInfo

func (self *Agent) GetInfo() *pb.AgentHeartbeat

func (*Agent) GetOutputChannelLocation

func (self *Agent) GetOutputChannelLocation(ctx context.Context, location *pb.Location) (*pb.Location, error)

func (*Agent) Heartbeat

func (self *Agent) Heartbeat()

master heartbeat

func (*Agent) KillExecutor

func (self *Agent) KillExecutor(ename string) error

func (*Agent) KillTask

func (self *Agent) KillTask(ctx context.Context, pbtask *pb.Task) (*pb.Empty, error)

func (*Agent) LanchExecutor

func (self *Agent) LanchExecutor(ename string) error

func (*Agent) Quit

func (self *Agent) Quit(ctx context.Context, em *pb.Empty) (*pb.Empty, error)

func (*Agent) Restart

func (self *Agent) Restart(ctx context.Context, em *pb.Empty) (*pb.Empty, error)

func (*Agent) Run

func (self *Agent) Run(ctx context.Context, pbtask *pb.Task) (*pb.Empty, error)

func (*Agent) SendHeartbeat

func (self *Agent) SendHeartbeat(stream pb.GueryAgent_SendHeartbeatServer) error

executor heartbeat

func (*Agent) SendInstruction

func (self *Agent) SendInstruction(inst *pb.Instruction) error

func (*Agent) SendOneHeartbeat

func (self *Agent) SendOneHeartbeat(stream pb.GueryMaster_SendHeartbeatClient) error

func (*Agent) SendTask

func (self *Agent) SendTask(ctx context.Context, task *pb.Task) (*pb.Empty, error)

type ExecutorInfo

type ExecutorInfo struct {
	Name              string
	Heartbeat         pb.ExecutorHeartbeat
	LastHeartBeatTime time.Time
}

func NewExecutorInfo

func NewExecutorInfo(hb *pb.ExecutorHeartbeat) *ExecutorInfo

type Task

type Task struct {
	TaskId       string
	Instructions []*pb.Instruction
	Status       pb.TaskStatus
	LogInfos     []*pb.LogInfo

	ExecutorInfos map[string]*pb.ExecutorHeartbeat
}

//////////////

func NewTask

func NewTask(pbtask *pb.Task) *Task

type TaskMap

type TaskMap struct {
	sync.Mutex
	Tasks map[string]*Task
}

func NewTaskMap

func NewTaskMap() *TaskMap

func (*TaskMap) AddTask

func (self *TaskMap) AddTask(task *Task) error

func (*TaskMap) DeleteTask

func (self *TaskMap) DeleteTask(task *Task) error

func (*TaskMap) GetTask

func (self *TaskMap) GetTask(id string) *Task

func (*TaskMap) GetTaskInfos

func (self *TaskMap) GetTaskInfos() []*pb.TaskInfo

func (*TaskMap) GetTaskNumber

func (self *TaskMap) GetTaskNumber() int32

func (*TaskMap) HasTask

func (self *TaskMap) HasTask(id string) bool

func (*TaskMap) PopTask

func (self *TaskMap) PopTask(id string) *Task

func (*TaskMap) UpdateTaskInfo

func (self *TaskMap) UpdateTaskInfo(hb *pb.ExecutorHeartbeat)

type Topology

type Topology struct {
	sync.RWMutex
	Executors map[string]*ExecutorInfo
}

Topology/////////////////

func NewTopology

func NewTopology() *Topology

func (*Topology) DropExecutorInfo

func (self *Topology) DropExecutorInfo(location *pb.Location)

func (*Topology) DuplicateExecutor

func (self *Topology) DuplicateExecutor(name string) error

func (*Topology) GetExecutor

func (self *Topology) GetExecutor(name string) *ExecutorInfo

func (*Topology) GetExecutorNumber

func (self *Topology) GetExecutorNumber() (busyNumber, number int32)

func (*Topology) GetExecutorStatus

func (self *Topology) GetExecutorStatus(name string) pb.TaskStatus

func (*Topology) GetExecutors

func (self *Topology) GetExecutors() []pb.Location

func (*Topology) HasExecutor

func (self *Topology) HasExecutor(name string) bool

func (*Topology) KillAllExecutors

func (self *Topology) KillAllExecutors() (err error)

func (*Topology) KillExecutor

func (self *Topology) KillExecutor(name string) error

func (*Topology) RestartExecutor

func (self *Topology) RestartExecutor(name string) error

func (*Topology) UpdateExecutorInfo

func (self *Topology) UpdateExecutorInfo(hb *pb.ExecutorHeartbeat)

Jump to

Keyboard shortcuts

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