aws

package
v0.0.0-...-bc3f6f8 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const RnDMasterTag = "R&D_master"

RnDMasterTag is a filter for master instance

View Source
const RnDTag = "R&D"

RnDTag is a filter for slave instances

Variables

This section is empty.

Functions

func GenRemoteAddress

func GenRemoteAddress(ip string, port int) string

GenRemoteAddress generates Node address

func GenRemoteAddresses

func GenRemoteAddresses(instances []Instance) ([]string, []string)

GenRemoteAddresses generates n * 2 addresses: one for handel, one for the sync

func UpdateInstance

func UpdateInstance(instances *Instance, nodes []*lib.NodeInfo, cons lib.Constructor)

UpdateInstance bla

func UpdateInstances

func UpdateInstances(inst []*Instance, allocations map[string][]*lib.NodeInfo, cons lib.Constructor)

UpdateInstances updates the address of the instances

func WaitUntilAllInstancesRunning

func WaitUntilAllInstancesRunning(a Manager, delay func()) (int, error)

WaitUntilAllInstancesRunning blocks until all instances are in the "running" state

Types

type Commands

type Commands struct {
	MasterBinPath string
	SlaveBinPath  string
	ConfPath      string
	RegPath       string
	S3            string
	// contains filtered or unexported fields
}

Commands represents AWS platform specyfic commands.

func NewCommands

func NewCommands(masterBinPath, slaveBinPath, confPath, regPath, s3 string, copyBinFiles bool) Commands

NewCommands creates an instance of Commands

type Config

type Config struct {
	PemFile       string
	Regions       []string
	MasterTimeOut int
	SSHUser       string
	TargetSystem  string
	TargetArch    string
	CopyBinFiles  bool
	ConfTimeout   int
}

func LoadConfig

func LoadConfig(path string) *Config

type Instance

type Instance struct {
	// EC2 ID
	ID *string
	// IP Visible to the outside world
	PublicIP *string
	// State: running, pending, stopped
	State *string
	//EC2 Instance region
	Region string
	// EC2 Instance TAG
	Tag string

	Nodes []*lib.Node
}

Instance represents EC2 Amazon instance

func (*Instance) String

func (i *Instance) String() string

type Manager

type Manager interface {
	// Instances lists available instances in any state
	Instances() []Instance
	// RefreshInstances populates the instance list and updates instances status
	RefreshInstances() ([]Instance, error)
	// StartInstances starts all available instances and populates the instance list,
	// blocks until all instances are in "running" state
	StartInstances() error
	// StopInstances stops all available instances
	StopInstances() error
}

Manager manages group of EC2 instances

func NewAWS

func NewAWS(region string) Manager

NewAWS creates AWS manager for single region

func NewMultiRegionAWSManager

func NewMultiRegionAWSManager(regions []string) Manager

NewMultiRegionAWSManager creates AWS manager for list of regions

type MasterCommands

type MasterCommands struct {
	Commands
}

MasterCommands commands invoked on a master node

func (MasterCommands) Configure

func (c MasterCommands) Configure() map[int]string

func (MasterCommands) Kill

func (c MasterCommands) Kill() string

Kill previous run

func (MasterCommands) Start

func (c MasterCommands) Start(masterAddr string, timeOut int, run int, network, resFile string, monitorPort int) string

Start starts master executable

type NodeController

type NodeController interface {
	// CopyFiles copies files to equivalent location on a remote host
	// for example "/tmp/aws.csv" from localhost will be placed in
	// "/tmp/aws.csv" on the remote host
	CopyFiles(files ...string) error
	// Run runs command on a remote node, for example Run("ls -l") and blocks until completion
	Run(command string, pw *io.PipeWriter) error
	// Run starts command on a remote node
	Start(command string) error

	// Init inits connection to the remote node
	Init() error
	// Close
	Close()
}

NodeController represents avaliable operations to perform on a remote node

func NewSSHNodeController

func NewSSHNodeController(sshAddr string, pemBytes []byte, user string) (NodeController, error)

NewSSHNodeController creates ssh based NodeController

type SlaveCommands

type SlaveCommands struct {
	Commands
	SameBinary   bool
	SyncBasePort int
}

SlaveCommands commands invoked on a slave node

func (SlaveCommands) Configure

func (c SlaveCommands) Configure() map[int]string

func (SlaveCommands) CopyRegistryFileFromSharedDirToLocalStorage

func (c SlaveCommands) CopyRegistryFileFromSharedDirToLocalStorage() map[int]string

func (SlaveCommands) CopyRegistryFileFromSharedDirToLocalStorageQuitSSH

func (c SlaveCommands) CopyRegistryFileFromSharedDirToLocalStorageQuitSSH() map[int]string

func (SlaveCommands) Kill

func (c SlaveCommands) Kill() string

Kill previous run

func (SlaveCommands) Start

func (c SlaveCommands) Start(masterAddr, monitorAddr string, inst Instance, run int) string

func (SlaveCommands) StartAndQuitSSH

func (c SlaveCommands) StartAndQuitSSH(masterAddr, monitorAddr string, inst Instance, run int) string

Jump to

Keyboard shortcuts

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