runner

package
v0.0.0-...-e03655c Latest Latest
Warning

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

Go to latest
Published: May 1, 2020 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NanoCPUs = 1000 * 1000 * 1000
	Memory   = 2 * 1000 * 1000 * 100
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DockerManager

type DockerManager struct {
	Client *client.Client
}

DockerManager is a docker based manager

func (*DockerManager) New

func (m *DockerManager) New(ctx context.Context, name string, envs []Env) (Runner, error)

New creates runner docker with given user name mgu represents mongo url that is used in runners for collecting errors and access to thing data

func (*DockerManager) Pull

func (m *DockerManager) Pull(ctx context.Context) ([2]string, error)

Pull pulls latest images of i1820/elrunner and redis:alpine. Please consider that image names are defined globally.

func (*DockerManager) Remove

func (m *DockerManager) Remove(ctx context.Context, r Runner) error

Remove removes runner and redis dockers

func (*DockerManager) Restart

func (m *DockerManager) Restart(ctx context.Context, r Runner) error

Restart restarts runner docker (not redis)

type Env

type Env struct {
	Name  string
	Value string
}

Env provides environment variables in runners

type Manager

type Manager interface {
	New(context.Context, string, []Env) (Runner, error)
	Restart(context.Context, Runner) error
	Remove(context.Context, Runner) error
	Pull(context.Context) ([2]string, error)
}

Manager manages runners and their containers

func New

func New() (Manager, error)

New creates a new manager

type Runner

type Runner struct {
	ID      string `json:"id" bson:"id"`
	Port    string `json:"port" bson:"port"`
	RedisID string `json:"rid" bson:"redisid"`
}

Runner represents runner docker information

Jump to

Keyboard shortcuts

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