runner

package
v0.0.0-...-3912389 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2016 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTimeOutNoMemory = errors.New("Task timed out. No available memory.")
	ErrFullQueue       = errors.New("The runner queue is full")

	WaitMemoryTimeout = 10 * time.Second
)

Functions

func NewFuncLogger

func NewFuncLogger(appName, path, function, requestID string) io.Writer

func RunAsyncRunner

func RunAsyncRunner(ctx context.Context, tasksrv string, n int)

RunAsyncRunner pulls tasks off a queue and processes them

Types

type Config

type Config struct {
	ID      string
	Image   string
	Timeout time.Duration
	AppName string
	Memory  uint64
	Env     map[string]string
	Stdin   io.Reader
	Stdout  io.Writer
	Stderr  io.Writer
}

type FuncLogger

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

FuncLogger reads STDERR output from a container and outputs it in a parseable structured log format, see: https://github.com/iron-io/functions/issues/76

func (*FuncLogger) Write

func (l *FuncLogger) Write(p []byte) (n int, err error)

type Logger

type Logger interface {
	Log(context.Context, map[string]interface{})
	LogCount(context.Context, string, int)
	LogGauge(context.Context, string, int)
	LogTime(context.Context, string, time.Duration)
}

type Metric

type Metric map[string]interface{}

type MetricLogger

type MetricLogger struct{}

func NewMetricLogger

func NewMetricLogger() *MetricLogger

func (*MetricLogger) Log

func (l *MetricLogger) Log(ctx context.Context, metric map[string]interface{})

func (*MetricLogger) LogCount

func (l *MetricLogger) LogCount(ctx context.Context, name string, value int)

func (*MetricLogger) LogGauge

func (l *MetricLogger) LogGauge(ctx context.Context, name string, value int)

func (*MetricLogger) LogTime

func (l *MetricLogger) LogTime(ctx context.Context, name string, value time.Duration)

type Runner

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

func New

func New(metricLogger Logger) (*Runner, error)

func (Runner) EnsureImageExists

func (r Runner) EnsureImageExists(ctx context.Context, cfg *Config) error

func (*Runner) Run

func (r *Runner) Run(ctx context.Context, cfg *Config) (drivers.RunResult, error)

Jump to

Keyboard shortcuts

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